remove CONFIG_SECURITY_FILE_CAPABILITIES compile option
Subsystems (2)
PATCH 1/1 remove CONFIG_SECURITY_FILE_CAPABILITIES compile option
As far as I know, all distros currently ship kernels with default CONFIG_SECURITY_FILE_CAPABILITIES=y. Since having the option on leaves a 'no_file_caps' option to boot without file capabilities, the main reason to keep the option is that turning it off saves you (on my s390x partition) 5k. In particular, vmlinux sizes came to:
without patch fscaps=n: 53598392
without patch fscaps=y: 53603406
with this patch applied: 53603342
with the security-next tree.
Against this we must weigh the fact that there is no simple way for userspace to figure out whether file capabilities are supported, while things like per-process securebits, capability bounding sets, and adding bits to pI if CAP_SETPCAP is in pE are not supported with SECURITY_FILE_CAPABILITIES=n, leaving a bit of a problem for applications wanting to know whether they can use them and/or why something failed.
It also adds another subtly different set of semantics which we must maintain at the risk of severe security regressions.
So this patch removes the SECURITY_FILE_CAPABILITIES compile option. It drops the kernel size by about 50k over the stock SECURITY_FILE_CAPABILITIES=y kernel, by removing the cap_limit_ptraced_target() function.
Changelog:
Nov 20: remove cap_limit_ptraced_target() as it's logic
was ifndef'ed.
--- include/linux/capability.h | 2 - include/linux/init_task.h | 4 -- kernel/capability.c | 2 - security/Kconfig | 9 ----- security/commoncap.c | 72 +------------------------------------------ 5 files changed, 2 insertions(+), 87 deletions(-)
include/linux/capability.h +0 -2
@@ -92,9 +92,7 @@ struct vfs_cap_data {#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3 -#ifdef CONFIG_SECURITY_FILE_CAPABILITIES extern int file_caps_enabled; -#endif typedef struct kernel_cap_struct { __u32 cap[_KERNEL_CAPABILITY_U32S];
include/linux/init_task.h +0 -4
@@ -83,16 +83,12 @@ extern struct group_info init_groups;#define INIT_IDS #endif -#ifdef CONFIG_SECURITY_FILE_CAPABILITIES /* * Because of the reduced scope of CAP_SETPCAP when filesystem * capabilities are in effect, it is safe to allow CAP_SETPCAP to * be available in the default configuration. */ # define CAP_INIT_BSET CAP_FULL_SET -#else -# define CAP_INIT_BSET CAP_INIT_EFF_SET -#endif #ifdef CONFIG_TREE_PREEMPT_RCU #define INIT_TASK_RCU_PREEMPT (tsk) \
kernel/capability.c +0 -2
@@ -29,7 +29,6 @@ EXPORT_SYMBOL(__cap_empty_set);EXPORT_SYMBOL (__cap_full_set);EXPORT_SYMBOL (__cap_init_eff_set); -#ifdef CONFIG_SECURITY_FILE_CAPABILITIES int file_caps_enabled =1 ;static int __init file_caps_disable (char *str)
@@ -38,7 +37,6 @@ static int __init file_caps_disable(char *str)return 1 ; }__setup ("no_file_caps" , file_caps_disable); -#endif /* * More recent versions of libcap are available from:
security/Kconfig +0 -9
@@ -91,15 +91,6 @@ config SECURITY_PATH implement pathname based access controls. If you are unsure how to answer this question, answer N. -config SECURITY_FILE_CAPABILITIES - bool "File POSIX Capabilities" - default n - help - This enables filesystem capabilities, allowing you to give - binaries a subset of root's powers without using setuid 0. - - If in doubt, answer N. - config INTEL_TXT bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)" depends on HAVE_INTEL_TXT
security/commoncap.c +2 -70
126 lines not on this page · raw message
Signature · 1 line
1.6.1
Quoted 21 lines · Serge E. Hallyn
As far as I know, all distros currently ship kernels with default
CONFIG_SECURITY_FILE_CAPABILITIES=y. Since having the option on leaves a 'no_file_caps' option to boot without file capabilities, the main reason to keep the option is that turning it off saves you (on my s390x partition) 5k. In particular, vmlinux sizes came to:without patch fscaps=n: 53598392
without patch fscaps=y: 53603406
with this patch applied: 53603342with the security-next tree.
Against this we must weigh the fact that there is no simple way for userspace to figure out whether file capabilities are supported, while things like per-process securebits, capability bounding sets, and adding bits to pI if
CAP_SETPCAPis in pE are not supported with SECURITY_FILE_CAPABILITIES=n, leaving a bit of a problem for applications wanting to know whether they can use them and/or why something failed.
Quoted 2 lines
It also adds another subtly different set of semantics which we must maintain at the risk of severe security regressions.
Hi,
This is or is not the same security option that is referred to in (new:) http://bugzilla.kernel.org/show_bug.cgi?id=14675 ?
Quoted 18 lines
So this patch removes the
SECURITY_FILE_CAPABILITIEScompile option. It drops the kernel size by about 50k over the stock SECURITY_FILE_CAPABILITIES=y kernel, by removing thecap_limit_ptraced_target()function.Changelog:
Nov 20: removecap_limit_ptraced_target()as it's logic
was ifndef'ed.Signed-off-by Serge E. Hallyn <[email protected]>--- include/linux/capability.h | 2 - include/linux/init_task.h | 4 -- kernel/capability.c | 2 - security/Kconfig | 9 ----- security/commoncap.c | 72 +------------------------------------------ 5 files changed, 2 insertions(+), 87 deletions(-)
Signature · 1 line
~Randy
Quoted 22 lines · Randy Dunlap
Quoted 21 lines · Serge E. Hallyn
As far as I know, all distros currently ship kernels with default
CONFIG_SECURITY_FILE_CAPABILITIES=y. Since having the option on leaves a 'no_file_caps' option to boot without file capabilities, the main reason to keep the option is that turning it off saves you (on my s390x partition) 5k. In particular, vmlinux sizes came to:without patch fscaps=n: 53598392
without patch fscaps=y: 53603406
with this patch applied: 53603342with the security-next tree.
Against this we must weigh the fact that there is no simple way for userspace to figure out whether file capabilities are supported, while things like per-process securebits, capability bounding sets, and adding bits to pI if
CAP_SETPCAPis in pE are not supported with SECURITY_FILE_CAPABILITIES=n, leaving a bit of a problem for applications wanting to know whether they can use them and/or why something failed.
Quoted 7 lines
Quoted 2 lines
It also adds another subtly different set of semantics which we must maintain at the risk of severe security regressions.
Hi,
This is or is not the same security option that is referred to in (new:) http://bugzilla.kernel.org/show_bug.cgi?id=14675 ?
I don't know. I would assume he meant 'CONFIG_SECURITY', but that wouldn't make sense since it should make no difference if no specific LSM is turned on.
I will subscribe to the bug so I can see his response. If it is in fact CONFIG_SECURITY_FILE_CAPABILITIES, then a binary which is setuid-root may be installed with some file capabilities, but without enough caps to do what it needs.
thanks,
-serge
Quoted 21 lines · Serge E. Hallyn
As far as I know, all distros currently ship kernels with default
CONFIG_SECURITY_FILE_CAPABILITIES=y. Since having the option on leaves a 'no_file_caps' option to boot without file capabilities, the main reason to keep the option is that turning it off saves you (on my s390x partition) 5k. In particular, vmlinux sizes came to:without patch fscaps=n: 53598392
without patch fscaps=y: 53603406
with this patch applied: 53603342with the security-next tree.
Against this we must weigh the fact that there is no simple way for userspace to figure out whether file capabilities are supported, while things like per-process securebits, capability bounding sets, and adding bits to pI if
CAP_SETPCAPis in pE are not supported with SECURITY_FILE_CAPABILITIES=n, leaving a bit of a problem for applications wanting to know whether they can use them and/or why something failed.
Quoted 5 lines
It also adds another subtly different set of semantics which we must maintain at the risk of severe security regressions.
So this patch removes the
SECURITY_FILE_CAPABILITIEScompile option. It drops the kernel size by about 50k over the stock
As Andrew points out, not 50k! Try about 50 bytes :) Sorry about that.
-serge
James Morris
maintainerQuoted 11 lines · Serge E. Hallyn
So this patch removes the
SECURITY_FILE_CAPABILITIEScompile option. It drops the kernel size by about 50k over the stock SECURITY_FILE_CAPABILITIES=y kernel, by removing thecap_limit_ptraced_target()function.Changelog:
Nov 20: removecap_limit_ptraced_target()as it's logic
was ifndef'ed.Signed-off-by Serge E. Hallyn <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
Signature · 2 lines
James Morris <[email protected]>