diff options
| author | Paul Moore <pmoore@redhat.com> | 2014-06-17 17:30:23 -0400 |
|---|---|---|
| committer | Paul Moore <pmoore@redhat.com> | 2014-06-17 17:30:23 -0400 |
| commit | 170b5910d9fbea79de1bb40df22eda5f98250c0c (patch) | |
| tree | ca9560e878d2842d45c6f99077d0d8b8f8b0f9ba /security | |
| parent | 47dd0b76ace953bd2c0479076db0d3e3b9594003 (diff) | |
| parent | 1860e379875dfe7271c649058aeddffe5afd9d0d (diff) | |
Merge tag 'v3.15' into next
Linux 3.15
Diffstat (limited to 'security')
34 files changed, 376 insertions, 235 deletions
diff --git a/security/Makefile b/security/Makefile index a5918e01a4f7..05f1c934d74b 100644 --- a/security/Makefile +++ b/security/Makefile | |||
| @@ -16,14 +16,14 @@ obj-$(CONFIG_MMU) += min_addr.o | |||
| 16 | # Object file lists | 16 | # Object file lists |
| 17 | obj-$(CONFIG_SECURITY) += security.o capability.o | 17 | obj-$(CONFIG_SECURITY) += security.o capability.o |
| 18 | obj-$(CONFIG_SECURITYFS) += inode.o | 18 | obj-$(CONFIG_SECURITYFS) += inode.o |
| 19 | obj-$(CONFIG_SECURITY_SELINUX) += selinux/built-in.o | 19 | obj-$(CONFIG_SECURITY_SELINUX) += selinux/ |
| 20 | obj-$(CONFIG_SECURITY_SMACK) += smack/built-in.o | 20 | obj-$(CONFIG_SECURITY_SMACK) += smack/ |
| 21 | obj-$(CONFIG_AUDIT) += lsm_audit.o | 21 | obj-$(CONFIG_AUDIT) += lsm_audit.o |
| 22 | obj-$(CONFIG_SECURITY_TOMOYO) += tomoyo/built-in.o | 22 | obj-$(CONFIG_SECURITY_TOMOYO) += tomoyo/ |
| 23 | obj-$(CONFIG_SECURITY_APPARMOR) += apparmor/built-in.o | 23 | obj-$(CONFIG_SECURITY_APPARMOR) += apparmor/ |
| 24 | obj-$(CONFIG_SECURITY_YAMA) += yama/built-in.o | 24 | obj-$(CONFIG_SECURITY_YAMA) += yama/ |
| 25 | obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o | 25 | obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o |
| 26 | 26 | ||
| 27 | # Object integrity file lists | 27 | # Object integrity file lists |
| 28 | subdir-$(CONFIG_INTEGRITY) += integrity | 28 | subdir-$(CONFIG_INTEGRITY) += integrity |
| 29 | obj-$(CONFIG_INTEGRITY) += integrity/built-in.o | 29 | obj-$(CONFIG_INTEGRITY) += integrity/ |
diff --git a/security/apparmor/include/apparmor.h b/security/apparmor/include/apparmor.h index 8fb1488a3cd4..97130f88838b 100644 --- a/security/apparmor/include/apparmor.h +++ b/security/apparmor/include/apparmor.h | |||
| @@ -66,7 +66,6 @@ extern int apparmor_initialized __initdata; | |||
| 66 | char *aa_split_fqname(char *args, char **ns_name); | 66 | char *aa_split_fqname(char *args, char **ns_name); |
| 67 | void aa_info_message(const char *str); | 67 | void aa_info_message(const char *str); |
| 68 | void *__aa_kvmalloc(size_t size, gfp_t flags); | 68 | void *__aa_kvmalloc(size_t size, gfp_t flags); |
| 69 | void kvfree(void *buffer); | ||
| 70 | 69 | ||
| 71 | static inline void *kvmalloc(size_t size) | 70 | static inline void *kvmalloc(size_t size) |
| 72 | { | 71 | { |
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 69689922c491..c1827e068454 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c | |||
| @@ -104,17 +104,3 @@ void *__aa_kvmalloc(size_t size, gfp_t flags) | |||
| 104 | } | 104 | } |
| 105 | return buffer; | 105 | return buffer; |
| 106 | } | 106 | } |
| 107 | |||
| 108 | /** | ||
| 109 | * kvfree - free an allocation do by kvmalloc | ||
| 110 | * @buffer: buffer to free (MAYBE_NULL) | ||
| 111 | * | ||
| 112 | * Free a buffer allocated by kvmalloc | ||
| 113 | */ | ||
| 114 | void kvfree(void *buffer) | ||
| 115 | { | ||
| 116 | if (is_vmalloc_addr(buffer)) | ||
| 117 | vfree(buffer); | ||
| 118 | else | ||
| 119 | kfree(buffer); | ||
| 120 | } | ||
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 4257b7e2796b..998100093332 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
| @@ -751,7 +751,7 @@ module_param_named(enabled, apparmor_enabled, bool, S_IRUGO); | |||
| 751 | static int __init apparmor_enabled_setup(char *str) | 751 | static int __init apparmor_enabled_setup(char *str) |
| 752 | { | 752 | { |
| 753 | unsigned long enabled; | 753 | unsigned long enabled; |
| 754 | int error = strict_strtoul(str, 0, &enabled); | 754 | int error = kstrtoul(str, 0, &enabled); |
| 755 | if (!error) | 755 | if (!error) |
| 756 | apparmor_enabled = enabled ? 1 : 0; | 756 | apparmor_enabled = enabled ? 1 : 0; |
| 757 | return 1; | 757 | return 1; |
diff --git a/security/capability.c b/security/capability.c index 21e2b9cae685..ad0d4de69944 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -116,7 +116,7 @@ static int cap_dentry_init_security(struct dentry *dentry, int mode, | |||
| 116 | struct qstr *name, void **ctx, | 116 | struct qstr *name, void **ctx, |
| 117 | u32 *ctxlen) | 117 | u32 *ctxlen) |
| 118 | { | 118 | { |
| 119 | return 0; | 119 | return -EOPNOTSUPP; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static int cap_inode_alloc_security(struct inode *inode) | 122 | static int cap_inode_alloc_security(struct inode *inode) |
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index d3b6d2cd3a06..9134dbf70d3e 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
| @@ -58,11 +58,9 @@ static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) | |||
| 58 | 58 | ||
| 59 | static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) | 59 | static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) |
| 60 | { | 60 | { |
| 61 | return css_to_devcgroup(task_css(task, devices_subsys_id)); | 61 | return css_to_devcgroup(task_css(task, devices_cgrp_id)); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | struct cgroup_subsys devices_subsys; | ||
| 65 | |||
| 66 | /* | 64 | /* |
| 67 | * called under devcgroup_mutex | 65 | * called under devcgroup_mutex |
| 68 | */ | 66 | */ |
| @@ -308,57 +306,138 @@ static int devcgroup_seq_show(struct seq_file *m, void *v) | |||
| 308 | } | 306 | } |
| 309 | 307 | ||
| 310 | /** | 308 | /** |
| 311 | * may_access - verifies if a new exception is part of what is allowed | 309 | * match_exception - iterates the exception list trying to find a complete match |
| 312 | * by a dev cgroup based on the default policy + | 310 | * @exceptions: list of exceptions |
| 313 | * exceptions. This is used to make sure a child cgroup | 311 | * @type: device type (DEV_BLOCK or DEV_CHAR) |
| 314 | * won't have more privileges than its parent or to | 312 | * @major: device file major number, ~0 to match all |
| 315 | * verify if a certain access is allowed. | 313 | * @minor: device file minor number, ~0 to match all |
| 316 | * @dev_cgroup: dev cgroup to be tested against | 314 | * @access: permission mask (ACC_READ, ACC_WRITE, ACC_MKNOD) |
| 317 | * @refex: new exception | 315 | * |
| 318 | * @behavior: behavior of the exception | 316 | * It is considered a complete match if an exception is found that will |
| 317 | * contain the entire range of provided parameters. | ||
| 318 | * | ||
| 319 | * Return: true in case it matches an exception completely | ||
| 319 | */ | 320 | */ |
| 320 | static bool may_access(struct dev_cgroup *dev_cgroup, | 321 | static bool match_exception(struct list_head *exceptions, short type, |
| 321 | struct dev_exception_item *refex, | 322 | u32 major, u32 minor, short access) |
| 322 | enum devcg_behavior behavior) | ||
| 323 | { | 323 | { |
| 324 | struct dev_exception_item *ex; | 324 | struct dev_exception_item *ex; |
| 325 | bool match = false; | ||
| 326 | 325 | ||
| 327 | rcu_lockdep_assert(rcu_read_lock_held() || | 326 | list_for_each_entry_rcu(ex, exceptions, list) { |
| 328 | lockdep_is_held(&devcgroup_mutex), | 327 | if ((type & DEV_BLOCK) && !(ex->type & DEV_BLOCK)) |
| 329 | "device_cgroup::may_access() called without proper synchronization"); | 328 | continue; |
| 329 | |||
