freebsd-skq/sys/conf
Pawel Jakub Dawidek 7008be5bd7 Change the cap_rights_t type from uint64_t to a structure that we can extend
in the future in a backward compatible (API and ABI) way.

The cap_rights_t represents capability rights. We used to use one bit to
represent one right, but we are running out of spare bits. Currently the new
structure provides place for 114 rights (so 50 more than the previous
cap_rights_t), but it is possible to grow the structure to hold at least 285
rights, although we can make it even larger if 285 rights won't be enough.

The structure definition looks like this:

	struct cap_rights {
		uint64_t	cr_rights[CAP_RIGHTS_VERSION + 2];
	};

The initial CAP_RIGHTS_VERSION is 0.

The top two bits in the first element of the cr_rights[] array contain total
number of elements in the array - 2. This means if those two bits are equal to
0, we have 2 array elements.

The top two bits in all remaining array elements should be 0.
The next five bits in all array elements contain array index. Only one bit is
used and bit position in this five-bits range defines array index. This means
there can be at most five array elements in the future.

To define new right the CAPRIGHT() macro must be used. The macro takes two
arguments - an array index and a bit to set, eg.

	#define	CAP_PDKILL	CAPRIGHT(1, 0x0000000000000800ULL)

We still support aliases that combine few rights, but the rights have to belong
to the same array element, eg:

	#define	CAP_LOOKUP	CAPRIGHT(0, 0x0000000000000400ULL)
	#define	CAP_FCHMOD	CAPRIGHT(0, 0x0000000000002000ULL)

	#define	CAP_FCHMODAT	(CAP_FCHMOD | CAP_LOOKUP)

There is new API to manage the new cap_rights_t structure:

	cap_rights_t *cap_rights_init(cap_rights_t *rights, ...);
	void cap_rights_set(cap_rights_t *rights, ...);
	void cap_rights_clear(cap_rights_t *rights, ...);
	bool cap_rights_is_set(const cap_rights_t *rights, ...);

	bool cap_rights_is_valid(const cap_rights_t *rights);
	void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src);
	void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src);
	bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);

Capability rights to the cap_rights_init(), cap_rights_set(),
cap_rights_clear() and cap_rights_is_set() functions are provided by
separating them with commas, eg:

	cap_rights_t rights;

	cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);

There is no need to terminate the list of rights, as those functions are
actually macros that take care of the termination, eg:

	#define	cap_rights_set(rights, ...)				\
		__cap_rights_set((rights), __VA_ARGS__, 0ULL)
	void __cap_rights_set(cap_rights_t *rights, ...);

Thanks to using one bit as an array index we can assert in those functions that
there are no two rights belonging to different array elements provided
together. For example this is illegal and will be detected, because CAP_LOOKUP
belongs to element 0 and CAP_PDKILL to element 1:

	cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);

Providing several rights that belongs to the same array's element this way is
correct, but is not advised. It should only be used for aliases definition.

This commit also breaks compatibility with some existing Capsicum system calls,
but I see no other way to do that. This should be fine as Capsicum is still
experimental and this change is not going to 9.x.

Sponsored by:	The FreeBSD Foundation
2013-09-05 00:09:56 +00:00
..
files Change the cap_rights_t type from uint64_t to a structure that we can extend 2013-09-05 00:09:56 +00:00
files.amd64 Use the fact that the AES-NI instructions can be pipelined to improve 2013-09-03 18:31:23 +00:00
files.arm Rename device vfp to option VFP and retire the ARM_VFP_SUPPORT option. This 2013-08-17 18:51:38 +00:00
files.i386 Use the fact that the AES-NI instructions can be pipelined to improve 2013-09-03 18:31:23 +00:00
files.ia64 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.mips - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.pc98 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.powerpc - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
files.sparc64 - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
kern.mk Spell extensions correctly. 2013-05-20 19:41:34 +00:00
kern.post.mk Some objects - such as *_genassym.o are not hooked into 2013-08-14 22:19:29 +00:00
kern.pre.mk opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG 2013-08-06 15:51:56 +00:00
kmod_syms.awk
kmod.mk amd64: use -mno-omit-leaf-frame-pointer in addition to -fno-omit-frame-pointer 2013-07-09 08:42:02 +00:00
ldscript.amd64 The new binutils has correctly redefined MAXPAGESIZE on amd64 as 0x200000 2011-03-28 06:35:17 +00:00
ldscript.arm Correctly align the unwind tables. Without this clang may incorrectly align 2013-03-10 00:47:19 +00:00
ldscript.i386 Step 2: sync sys/conf/ldscript.i386 with the binutils 2.17.50 version, 2010-11-05 19:40:27 +00:00
ldscript.ia64 Stop linking against a direct-mapped virtual address and instead 2011-04-30 20:49:00 +00:00
ldscript.mips Let the linker pick the right output format automatically 2010-11-13 18:38:35 +00:00
ldscript.mips.cfe Remove commented out _DYNAMIC sections. 2011-01-20 19:20:23 +00:00
ldscript.mips.mips64 Remove commented out _DYNAMIC sections. 2011-01-20 19:20:23 +00:00
ldscript.mips.octeon1 In fact, we don't need any of these __DYNAMIC. it is a.out leftover and commented out. 2011-01-20 19:24:50 +00:00
ldscript.powerpc In fact, we don't need any of these __DYNAMIC. it is a.out leftover and commented out. 2011-01-20 19:24:50 +00:00
ldscript.powerpc64 Add the .opd section, this is helps booting a profiled kernel. 2012-01-20 18:52:31 +00:00
ldscript.sparc64 Merge binutils 2.17.50 to head. This brings a number of improvements to 2011-02-18 20:54:12 +00:00
Makefile.amd64 Assemble linux32_locore.s and ia32_sigtramp.S with clang integrated assembler. 2013-08-27 18:35:04 +00:00
Makefile.arm 2 years, 10 months, 22 days after the projects/arm_eabi branch was created 2013-07-16 19:15:19 +00:00
Makefile.i386 Add basic support for FDT to i386 & amd64. This change includes: 2013-05-21 03:05:49 +00:00
Makefile.ia64
Makefile.mips Fill out fake preload structure to let userland tools like pmc(3) know 2012-03-15 05:29:51 +00:00
Makefile.pc98 MFi386: r232263 2012-11-10 14:56:35 +00:00
Makefile.powerpc Remove duplication and centralize testing of various config(8)ed features. 2012-09-12 14:19:40 +00:00
Makefile.sparc64
makeLINT.mk Generate a LINT for powerpc and for powerpc64. 2013-04-11 22:18:20 +00:00
makeLINT.sed Match the files directive and all the ways to add or subtract options 2011-10-04 17:11:38 +00:00
newvers.sh Use realpath(1) to determine the location of the newvers.sh script, 2013-08-11 13:57:14 +00:00
NOTES Allow UART_POLL_FREQ to be set as a kernel option as well as via tunable 2013-08-19 15:51:30 +00:00
options Allow UART_POLL_FREQ to be set as a kernel option as well as via tunable 2013-08-19 15:51:30 +00:00
options.amd64 The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. 2013-08-21 22:43:29 +00:00
options.arm Rename device vfp to option VFP and retire the ARM_VFP_SUPPORT option. This 2013-08-17 18:51:38 +00:00
options.i386 The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. 2013-08-21 22:43:29 +00:00
options.ia64 Port the new PV entry allocator from amd64/i386. This allocator has two 2012-10-26 03:02:39 +00:00
options.mips Add an option for the GE FES based packet engines. Its board IDs 2013-04-23 09:40:42 +00:00
options.pc98
options.powerpc Initial support for running FreeBSD on the Nintendo Wii. We're able to 2012-08-21 06:31:26 +00:00
options.sparc64 - While Netra X1 generally show no ill effects when registering a power 2013-03-02 00:37:31 +00:00
systags.sh
WITHOUT_SOURCELESS Move WITHOUT_SOURCELESS_* files to sys/conf/ in order to avoid "universe" 2012-02-12 14:55:27 +00:00
WITHOUT_SOURCELESS_HOST Import HighPoint DC Series Data Center HBA (DC7280 and R750) driver. 2013-07-06 07:49:41 +00:00
WITHOUT_SOURCELESS_UCODE Import OpenBSD's rsu(4) WLAN driver. 2013-07-30 02:07:57 +00:00