From 0b6176ae64342159dd41c675ea41a3624ad4f8c4 Mon Sep 17 00:00:00 2001 From: "Serge E. Hallyn" Date: Wed, 5 Nov 2008 16:08:52 -0600 Subject: [PATCH] --- yaml --- r: 120646 b: refs/heads/master c: 1f29fae29709b4668979e244c09b2fa78ff1ad59 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 4 ++++ trunk/include/linux/capability.h | 3 +++ trunk/kernel/capability.c | 11 +++++++++++ trunk/security/commoncap.c | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 62f9508840bb..90e444031a64 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e21e696edb498c7f7eed42ba3096f6bbe13927b6 +refs/heads/master: 1f29fae29709b4668979e244c09b2fa78ff1ad59 diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 1bbcaa8982b6..784443acca9c 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -1459,6 +1459,10 @@ and is between 256 and 4096 characters. It is defined in the file instruction doesn't work correctly and not to use it. + no_file_caps Tells the kernel not to honor file capabilities. The + only way then for a file to be executed with privilege + is to be setuid root or executed by root. + nohalt [IA-64] Tells the kernel not to use the power saving function PAL_HALT_LIGHT when idle. This increases power-consumption. On the positive side, it reduces diff --git a/trunk/include/linux/capability.h b/trunk/include/linux/capability.h index 9d1fe30b6f6c..5bc145bd759a 100644 --- a/trunk/include/linux/capability.h +++ b/trunk/include/linux/capability.h @@ -68,6 +68,9 @@ typedef struct __user_cap_data_struct { #define VFS_CAP_U32 VFS_CAP_U32_2 #define VFS_CAP_REVISION VFS_CAP_REVISION_2 +#ifdef CONFIG_SECURITY_FILE_CAPABILITIES +extern int file_caps_enabled; +#endif struct vfs_cap_data { __le32 magic_etc; /* Little endian */ diff --git a/trunk/kernel/capability.c b/trunk/kernel/capability.c index 33e51e78c2d8..e13a68535ad5 100644 --- a/trunk/kernel/capability.c +++ b/trunk/kernel/capability.c @@ -33,6 +33,17 @@ 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) +{ + file_caps_enabled = 0; + return 1; +} +__setup("no_file_caps", file_caps_disable); +#endif + /* * More recent versions of libcap are available from: * diff --git a/trunk/security/commoncap.c b/trunk/security/commoncap.c index 3976613db829..f88119cb2bc2 100644 --- a/trunk/security/commoncap.c +++ b/trunk/security/commoncap.c @@ -281,6 +281,9 @@ static int get_file_caps(struct linux_binprm *bprm) bprm_clear_caps(bprm); + if (!file_caps_enabled) + return 0; + if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) return 0;