diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 13:01:41 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 13:01:41 -0400 |
| commit | 3296ca27f50ecbd71db1d808c7a72d311027f919 (patch) | |
| tree | 833eaa58b2013bda86d4bd95faf6efad7a2d5ca4 /security | |
| parent | e893123c7378192c094747dadec326b7c000c190 (diff) | |
| parent | 73fbad283cfbbcf02939bdbda31fc4a30e729cca (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (44 commits)
nommu: Provide mmap_min_addr definition.
TOMOYO: Add description of lists and structures.
TOMOYO: Remove unused field.
integrity: ima audit dentry_open failure
TOMOYO: Remove unused parameter.
security: use mmap_min_addr indepedently of security models
TOMOYO: Simplify policy reader.
TOMOYO: Remove redundant markers.
SELinux: define audit permissions for audit tree netlink messages
TOMOYO: Remove unused mutex.
tomoyo: avoid get+put of task_struct
smack: Remove redundant initialization.
integrity: nfsd imbalance bug fix
rootplug: Remove redundant initialization.
smack: do not beyond ARRAY_SIZE of data
integrity: move ima_counts_get
integrity: path_check update
IMA: Add __init notation to ima functions
IMA: Minimal IMA policy and boot param for TCB IMA policy
selinux: remove obsolete read buffer limit from sel_read_bool
...
Diffstat (limited to 'security')
31 files changed, 1690 insertions, 440 deletions
diff --git a/security/Kconfig b/security/Kconfig index bb244774e9d7..d23c839038f0 100644 --- a/security/Kconfig +++ b/security/Kconfig | |||
| @@ -110,28 +110,8 @@ config SECURITY_ROOTPLUG | |||
| 110 | 110 | ||
| 111 | See <http://www.linuxjournal.com/article.php?sid=6279> for | 111 | See <http://www.linuxjournal.com/article.php?sid=6279> for |
| 112 | more information about this module. | 112 | more information about this module. |
| 113 | |||
| 114 | If you are unsure how to answer this question, answer N. | ||
| 115 | |||
| 116 | config SECURITY_DEFAULT_MMAP_MIN_ADDR | ||
| 117 | int "Low address space to protect from user allocation" | ||
| 118 | depends on SECURITY | ||
| 119 | default 0 | ||
| 120 | help | ||
| 121 | This is the portion of low virtual memory which should be protected | ||
| 122 | from userspace allocation. Keeping a user from writing to low pages | ||
| 123 | can help reduce the impact of kernel NULL pointer bugs. | ||
| 124 | |||
| 125 | For most ia64, ppc64 and x86 users with lots of address space | ||
| 126 | a value of 65536 is reasonable and should cause no problems. | ||
| 127 | On arm and other archs it should not be higher than 32768. | ||
| 128 | Programs which use vm86 functionality would either need additional | ||
| 129 | permissions from either the LSM or the capabilities module or have | ||
| 130 | this protection disabled. | ||
| 131 | |||
| 132 | This value can be changed after boot using the | ||
| 133 | /proc/sys/vm/mmap_min_addr tunable. | ||
| 134 | 113 | ||
| 114 | If you are unsure how to answer this question, answer N. | ||
| 135 | 115 | ||
| 136 | source security/selinux/Kconfig | 116 | source security/selinux/Kconfig |
| 137 | source security/smack/Kconfig | 117 | source security/smack/Kconfig |
diff --git a/security/Makefile b/security/Makefile index fa77021d9778..c67557cdaa85 100644 --- a/security/Makefile +++ b/security/Makefile | |||
| @@ -16,6 +16,9 @@ obj-$(CONFIG_SECURITYFS) += inode.o | |||
| 16 | # Must precede capability.o in order to stack properly. | 16 | # Must precede capability.o in order to stack properly. |
| 17 | obj-$(CONFIG_SECURITY_SELINUX) += selinux/built-in.o | 17 | obj-$(CONFIG_SECURITY_SELINUX) += selinux/built-in.o |
| 18 | obj-$(CONFIG_SECURITY_SMACK) += smack/built-in.o | 18 | obj-$(CONFIG_SECURITY_SMACK) += smack/built-in.o |
| 19 | ifeq ($(CONFIG_AUDIT),y) | ||
| 20 | obj-$(CONFIG_SECURITY_SMACK) += lsm_audit.o | ||
| 21 | endif | ||
| 19 | obj-$(CONFIG_SECURITY_TOMOYO) += tomoyo/built-in.o | 22 | obj-$(CONFIG_SECURITY_TOMOYO) += tomoyo/built-in.o |
| 20 | obj-$(CONFIG_SECURITY_ROOTPLUG) += root_plug.o | 23 | obj-$(CONFIG_SECURITY_ROOTPLUG) += root_plug.o |
| 21 | obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o | 24 | obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o |
diff --git a/security/commoncap.c b/security/commoncap.c index beac0258c2a8..48b7e0228fa3 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -28,6 +28,28 @@ | |||
| 28 | #include <linux/prctl.h> | 28 | #include <linux/prctl.h> |
| 29 | #include <linux/securebits.h> | 29 | #include <linux/securebits.h> |
| 30 | 30 | ||
| 31 | /* | ||
| 32 | * If a non-root user executes a setuid-root binary in | ||
| 33 | * !secure(SECURE_NOROOT) mode, then we raise capabilities. | ||
| 34 | * However if fE is also set, then the intent is for only | ||
| 35 | * the file capabilities to be applied, and the setuid-root | ||
| 36 | * bit is left on either to change the uid (plausible) or | ||
| 37 | * to get full privilege on a kernel without file capabilities | ||
| 38 | * support. So in that case we do not raise capabilities. | ||
| 39 | * | ||
| 40 | * Warn if that happens, once per boot. | ||
| 41 | */ | ||
| 42 | static void warn_setuid_and_fcaps_mixed(char *fname) | ||
| 43 | { | ||
| 44 | static int warned; | ||
| 45 | if (!warned) { | ||
| 46 | printk(KERN_INFO "warning: `%s' has both setuid-root and" | ||
| 47 | " effective capabilities. Therefore not raising all" | ||
| 48 | " capabilities.\n", fname); | ||
| 49 | warned = 1; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 31 | int cap_netlink_send(struct sock *sk, struct sk_buff *skb) | 53 | int cap_netlink_send(struct sock *sk, struct sk_buff *skb) |
| 32 | { | 54 | { |
| 33 | NETLINK_CB(skb).eff_cap = current_cap(); | 55 | NETLINK_CB(skb).eff_cap = current_cap(); |
| @@ -464,6 +486,15 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) | |||
| 464 | 486 | ||
| 465 | if (!issecure(SECURE_NOROOT)) { | 487 | if (!issecure(SECURE_NOROOT)) { |
| 466 | /* | 488 | /* |
| 489 | * If the legacy file capability is set, then don't set privs | ||
| 490 | * for a setuid root binary run by a non-root user. Do set it | ||
| 491 | * for a root user just to cause least surprise to an admin. | ||
| 492 | */ | ||
| 493 | if (effective && new->uid != 0 && new->euid == 0) { | ||
| 494 | warn_setuid_and_fcaps_mixed(bprm->filename); | ||
| 495 | goto skip; | ||
| 496 | } | ||
| 497 | /* | ||
| 467 | * To support inheritance of root-permissions and suid-root | 498 | * To support inheritance of root-permissions and suid-root |
| 468 | * executables under compatibility mode, we override the | 499 | * executables under compatibility mode, we override the |
| 469 | * capability sets for the file. | 500 | * capability sets for the file. |
| @@ -478,6 +509,7 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) | |||
| 478 | if (new->euid == 0) | 509 | if (new->euid == 0) |
| 479 | effective = true; | 510 | effective = true; |
| 480 | } | 511 | } |
| 512 | skip: | ||
| 481 | 513 | ||
| 482 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised | 514 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised |
| 483 | * credentials unless they have the appropriate permit | 515 | * credentials unless they have the appropriate permit |
diff --git a/security/inode.c b/security/inode.c index f3b91bfbe4cb..f7496c6a022b 100644 --- a/security/inode.c +++ b/security/inode.c | |||
| @@ -287,7 +287,7 @@ void securityfs_remove(struct dentry *dentry) | |||
| 287 | { | 287 | { |
| 288 | struct dentry *parent; | 288 | struct dentry *parent; |
| 289 | 289 | ||
| 290 | if (!dentry) | 290 | if (!dentry || IS_ERR(dentry)) |
| 291 | return; | 291 | return; |
| 292 | 292 | ||
| 293 | parent = dentry->d_parent; | 293 | parent = dentry->d_parent; |
diff --git a/security/integrity/ima/ima_audit.c b/security/integrity/ima/ima_audit.c index 1e082bb987be..ff513ff737f5 100644 --- a/security/integrity/ima/ima_audit.c +++ b/security/integrity/ima/ima_audit.c | |||
| @@ -22,18 +22,9 @@ static int ima_audit; | |||
| 22 | static int __init ima_audit_setup(char *str) | 22 | static int __init ima_audit_setup(char *str) |
| 23 | { | 23 | { |
| 24 | unsigned long audit; | 24 | unsigned long audit; |
| 25 | int rc, result = 0; | ||
| 26 | char *op = "ima_audit"; | ||
| 27 | char *cause; | ||
| 28 | 25 | ||
| 29 | rc = strict_strtoul(str, 0, &audit); | 26 | if (!strict_strtoul(str, 0, &audit)) |
| 30 | if (rc || audit > 1) | 27 | ima_audit = audit ? 1 : 0; |
