Skip to contentSkip to conversation

remove CONFIG_SECURITY_FILE_CAPABILITIES compile option

RFC In review Serge E. Hallyn 1 participant 2 messages Nov 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 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:

SECURITY=n,SECURITY_FILE_CAPABILITIES=n: 53641039
SECURITY=n,SECURITY_FILE_CAPABILITIES=y: 53646053

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.

---
 include/linux/capability.h |    2 -
 include/linux/init_task.h  |    4 ---
 kernel/capability.c        |    2 -
 security/Kconfig           |    9 --------
 security/commoncap.c       |   50 --------------------------------------------
 5 files changed, 0 insertions(+), 67 deletions(-)
include/linux/capability.h +0 -2
index c8f2a5f..39e5ff5 100644
@@ -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
index 21a6f5d..8d10aa7 100644
@@ -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
index 4e17041..31ad005 100644
@@ -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
index fb363cd..5fdd57d 100644
@@ -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 SECURITY_ROOTPLUG
 	bool "Root Plug Support"
 	depends on USB=y && SECURITY
security/commoncap.c +0 -50

106 lines not on this page · raw message

Signature · 1 line
1.6.1
#1 lore raw

security/commoncap.c static inline int get_file_caps(struct linux_binprm *bprm, bool *effective) · line 463

Quoted 8 lines · Serge E. Hallyn
security/commoncap.c +0 -2
@@ -457,10 +429,8 @@ static inline int get_file_caps(struct linux_binprm *bprm, bool *effective)
  */
 static inline int cap_limit_ptraced_target(void)
 {
-#ifndef CONFIG_SECURITY_FILE_CAPABILITIES
 	if (capable(CAP_SETPCAP))
 		return 0;
-#endif

Gah. Will fix, of course, but general question/rfc still stands.

-serge