diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:15 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:59 -0400 |
commit | 07f9479a40cc778bc1462ada11f95b01360ae4ff (patch) | |
tree | 0676cf38df3844004bb3ebfd99dfa67a4a8998f5 /security | |
parent | 9d5e6bdb3013acfb311ab407eeca0b6a6a3dedbf (diff) | |
parent | cd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff) |
Merge branch 'master' into for-next
Fast-forwarded to current state of Linus' tree as there are patches to be
applied for files that didn't exist on the old branch.
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/lsm.c | 5 | ||||
-rw-r--r-- | security/apparmor/match.c | 2 | ||||
-rw-r--r-- | security/apparmor/policy_unpack.c | 2 | ||||
-rw-r--r-- | security/capability.c | 2 | ||||
-rw-r--r-- | security/commoncap.c | 78 | ||||
-rw-r--r-- | security/security.c | 22 | ||||
-rw-r--r-- | security/selinux/avc.c | 36 | ||||
-rw-r--r-- | security/selinux/hooks.c | 39 | ||||
-rw-r--r-- | security/selinux/include/avc.h | 18 | ||||
-rw-r--r-- | security/selinux/netlabel.c | 2 | ||||
-rw-r--r-- | security/selinux/ss/services.c | 6 | ||||
-rw-r--r-- | security/smack/smack_access.c | 2 | ||||
-rw-r--r-- | security/smack/smack_lsm.c | 12 | ||||
-rw-r--r-- | security/smack/smackfs.c | 6 | ||||
-rw-r--r-- | security/tomoyo/load_policy.c | 2 |
15 files changed, 163 insertions, 71 deletions
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index d21a427a35ae..ae3a698415e6 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/ctype.h> | 22 | #include <linux/ctype.h> |
23 | #include <linux/sysctl.h> | 23 | #include <linux/sysctl.h> |
24 | #include <linux/audit.h> | 24 | #include <linux/audit.h> |
25 | #include <linux/user_namespace.h> | ||
25 | #include <net/sock.h> | 26 | #include <net/sock.h> |
26 | 27 | ||
27 | #include "include/apparmor.h" | 28 | #include "include/apparmor.h" |
@@ -136,11 +137,11 @@ static int apparmor_capget(struct task_struct *target, kernel_cap_t *effective, | |||
136 | } | 137 | } |
137 | 138 | ||
138 | static int apparmor_capable(struct task_struct *task, const struct cred *cred, | 139 | static int apparmor_capable(struct task_struct *task, const struct cred *cred, |
139 | int cap, int audit) | 140 | struct user_namespace *ns, int cap, int audit) |
140 | { | 141 | { |
141 | struct aa_profile *profile; | 142 | struct aa_profile *profile; |
142 | /* cap_capable returns 0 on success, else -EPERM */ | 143 | /* cap_capable returns 0 on success, else -EPERM */ |
143 | int error = cap_capable(task, cred, cap, audit); | 144 | int error = cap_capable(task, cred, ns, cap, audit); |
144 | if (!error) { | 145 | if (!error) { |
145 | profile = aa_cred_profile(cred); | 146 | profile = aa_cred_profile(cred); |
146 | if (!unconfined(profile)) | 147 | if (!unconfined(profile)) |
diff --git a/security/apparmor/match.c b/security/apparmor/match.c index 5cb4dc1f6992..06d764ccbbe5 100644 --- a/security/apparmor/match.c +++ b/security/apparmor/match.c | |||
@@ -195,7 +195,7 @@ void aa_dfa_free_kref(struct kref *kref) | |||
195 | * | 195 | * |
196 | * Unpack a dfa that has been serialized. To find information on the dfa | 196 | * Unpack a dfa that has been serialized. To find information on the dfa |
197 | * format look in Documentation/apparmor.txt | 197 | * format look in Documentation/apparmor.txt |
198 | * Assumes the dfa @blob stream has been aligned on a 8 byte boundry | 198 | * Assumes the dfa @blob stream has been aligned on a 8 byte boundary |
199 | * | 199 | * |
200 | * Returns: an unpacked dfa ready for matching or ERR_PTR on failure | 200 | * Returns: an unpacked dfa ready for matching or ERR_PTR on failure |
201 | */ | 201 | */ |
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index eb3700e9fd37..e33aaf7e5744 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c | |||
@@ -359,7 +359,7 @@ fail: | |||
359 | * @e: serialized data extent information (NOT NULL) | 359 | * @e: serialized data extent information (NOT NULL) |
360 | * @profile: profile to add the accept table to (NOT NULL) | 360 | * @profile: profile to add the accept table to (NOT NULL) |
361 | * | 361 | * |
362 | * Returns: 1 if table succesfully unpacked | 362 | * Returns: 1 if table successfully unpacked |
363 | */ | 363 | */ |
364 | static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile) | 364 | static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile) |
365 | { | 365 | { |
diff --git a/security/capability.c b/security/capability.c index 2984ea4f776f..bbb51156261b 100644 --- a/security/capability.c +++ b/security/capability.c | |||
@@ -181,7 +181,7 @@ static int cap_inode_follow_link(struct dentry *dentry, | |||
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int cap_inode_permission(struct inode *inode, int mask) | 184 | static int cap_inode_permission(struct inode *inode, int mask, unsigned flags) |
185 | { | 185 | { |
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
diff --git a/security/commoncap.c b/security/commoncap.c index 49c57fd60aea..f20e984ccfb4 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
28 | #include <linux/prctl.h> | 28 | #include <linux/prctl.h> |
29 | #include <linux/securebits.h> | 29 | #include <linux/securebits.h> |
30 | #include <linux/user_namespace.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * If a non-root user executes a setuid-root binary in | 33 | * If a non-root user executes a setuid-root binary in |
@@ -67,6 +68,7 @@ EXPORT_SYMBOL(cap_netlink_recv); | |||
67 | * cap_capable - Determine whether a task has a particular effective capability | 68 | * cap_capable - Determine whether a task has a particular effective capability |
68 | * @tsk: The task to query | 69 | * @tsk: The task to query |
69 | * @cred: The credentials to use | 70 | * @cred: The credentials to use |
71 | * @ns: The user namespace in which we need the capability | ||
70 | * @cap: The capability to check for | 72 | * @cap: The capability to check for |
71 | * @audit: Whether to write an audit message or not | 73 | * @audit: Whether to write an audit message or not |
72 | * | 74 | * |
@@ -78,10 +80,30 @@ EXPORT_SYMBOL(cap_netlink_recv); | |||
78 | * cap_has_capability() returns 0 when a task has a capability, but the | 80 | * cap_has_capability() returns 0 when a task has a capability, but the |
79 | * kernel's capable() and has_capability() returns 1 for this case. | 81 | * kernel's capable() and has_capability() returns 1 for this case. |
80 | */ | 82 | */ |
81 | int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap, | 83 | int cap_capable(struct task_struct *tsk, const struct cred *cred, |
82 | int audit) | 84 | struct user_namespace *targ_ns, int cap, int audit) |
83 | { | 85 | { |
84 | return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM; | 86 | for (;;) { |
87 | /* The creator of the user namespace has all caps. */ | ||
88 | if (targ_ns != &init_user_ns && targ_ns->creator == cred->user) | ||
89 | return 0; | ||
90 | |||
91 | /* Do we have the necessary capabilities? */ | ||
92 | if (targ_ns == cred->user->user_ns) | ||
93 | return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM; | ||
94 | |||
95 | /* Have we tried all of the parent namespaces? */ | ||
96 | if (targ_ns == &init_user_ns) | ||
97 | return -EPERM; | ||
98 | |||
99 | /* | ||
100 | *If you have a capability in a parent user ns, then you have | ||
101 | * it over all children user namespaces as well. | ||
102 | */ | ||
103 | targ_ns = targ_ns->creator->user_ns; | ||
104 | } | ||
105 | |||
106 | /* We never get here */ | ||
85 | } | 107 | } |
86 | 108 | ||
87 | /** | 109 | /** |
@@ -105,18 +127,30 @@ int cap_settime(const struct timespec *ts, const struct timezone *tz) | |||
105 | * @child: The process to be accessed | 127 | * @child: The process to be accessed |
106 | * @mode: The mode of attachment. | 128 | * @mode: The mode of attachment. |
107 | * | 129 | * |
130 | * If we are in the same or an ancestor user_ns and have all the target | ||
131 | * task's capabilities, then ptrace access is allowed. | ||
132 | * If we have the ptrace capability to the target user_ns, then ptrace | ||
133 | * access is allowed. | ||
134 | * Else denied. | ||
135 | * | ||
108 | * Determine whether a process may access another, returning 0 if permission | 136 | * Determine whether a process may access another, returning 0 if permission |
109 | * granted, -ve if denied. | 137 | * granted, -ve if denied. |
110 | */ | 138 | */ |
111 | int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) | 139 | int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) |
112 | { | 140 | { |
113 | int ret = 0; | 141 | int ret = 0; |
142 | const struct cred *cred, *child_cred; | ||
114 | 143 | ||
115 | rcu_read_lock(); | 144 | rcu_read_lock(); |
116 | if (!cap_issubset(__task_cred(child)->cap_permitted, | 145 | cred = current_cred(); |
117 | current_cred()->cap_permitted) && | 146 | child_cred = __task_cred(child); |
118 | !capable(CAP_SYS_PTRACE)) | 147 | if (cred->user->user_ns == child_cred->user->user_ns && |
119 | ret = -EPERM; | 148 | cap_issubset(child_cred->cap_permitted, cred->cap_permitted)) |
149 | goto out; | ||
150 | if (ns_capable(child_cred->user->user_ns, CAP_SYS_PTRACE)) | ||
151 | goto out; | ||
152 | ret = -EPERM; | ||
153 | out: | ||
120 | rcu_read_unlock(); | 154 | rcu_read_unlock(); |
121 | return ret; | 155 | return ret; |
122 | } | 156 | } |
@@ -125,18 +159,30 @@ int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) | |||
125 | * cap_ptrace_traceme - Determine whether another process may trace the current | 159 | * cap_ptrace_traceme - Determine whether another process may trace the current |
126 | * @parent: The task proposed to be the tracer | 160 | * @parent: The task proposed to be the tracer |
127 | * | 161 | * |
162 | * If parent is in the same or an ancestor user_ns and has all current's | ||
163 | * capabilities, then ptrace access is allowed. | ||
164 | * If parent has the ptrace capability to current's user_ns, then ptrace | ||
165 | * access is allowed. | ||
166 | * Else denied. | ||
167 | * | ||
128 | * Determine whether the nominated task is permitted to trace the current | 168 | * Determine whether the nominated task is permitted to trace the current |
129 | * process, returning 0 if permission is granted, -ve if denied. | 169 | * process, returning 0 if permission is granted, -ve if denied. |
130 | */ | 170 | */ |
131 | int cap_ptrace_traceme(struct task_struct *parent) | 171 | int cap_ptrace_traceme(struct task_struct *parent) |
132 | { | 172 | { |
133 | int ret = 0; | 173 | int ret = 0; |
174 | const struct cred *cred, *child_cred; | ||
134 | 175 | ||
135 | rcu_read_lock(); | 176 | rcu_read_lock(); |
136 | if (!cap_issubset(current_cred()->cap_permitted, | 177 | cred = __task_cred(parent); |
137 | __task_cred(parent)->cap_permitted) && | 178 | child_cred = current_cred(); |
138 | !has_capability(parent, CAP_SYS_PTRACE)) | 179 | if (cred->user->user_ns == child_cred->user->user_ns && |
139 | ret = -EPERM; | 180 | cap_issubset(child_cred->cap_permitted, cred->cap_permitted)) |
181 | goto out; | ||
182 | if (has_ns_capability(parent, child_cred->user->user_ns, CAP_SYS_PTRACE)) | ||
183 | goto out; | ||
184 | ret = -EPERM; | ||
185 | out: | ||
140 | rcu_read_unlock(); | 186 | rcu_read_unlock(); |
141 | return ret; | 187 | return ret; |
142 | } | 188 | } |
@@ -176,7 +222,8 @@ static inline int cap_inh_is_capped(void) | |||
176 | /* they are so limited unless the current task has the CAP_SETPCAP | 222 | /* they are so limited unless the current task has the CAP_SETPCAP |
177 | * capability | 223 | * capability |
178 | */ | 224 | */ |
179 | if (cap_capable(current, current_cred(), CAP_SETPCAP, | 225 | if (cap_capable(current, current_cred(), |
226 | current_cred()->user->user_ns, CAP_SETPCAP, | ||
180 | SECURITY_CAP_AUDIT) == 0) | 227 | SECURITY_CAP_AUDIT) == 0) |
181 | return 0; | 228 | return 0; |
182 | return 1; | 229 | return 1; |
@@ -828,7 +875,8 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
828 | & (new->securebits ^ arg2)) /*[1]*/ | 875 | & (new->securebits ^ arg2)) /*[1]*/ |
829 | || ((new->securebits & SECURE_ALL_LOCKS & ~arg2)) /*[2]*/ | 876 | || ((new->securebits & SECURE_ALL_LOCKS & ~arg2)) /*[2]*/ |
830 | || (arg2 & ~(SECURE_ALL_LOCKS | SECURE_ALL_BITS)) /*[3]*/ | 877 | || (arg2 & ~(SECURE_ALL_LOCKS | SECURE_ALL_BITS)) /*[3]*/ |
831 | || (cap_capable(current, current_cred(), CAP_SETPCAP, | 878 | || (cap_capable(current, current_cred(), |
879 | current_cred()->user->user_ns, CAP_SETPCAP, | ||
832 | SECURITY_CAP_AUDIT) != 0) /*[4]*/ | 880 | SECURITY_CAP_AUDIT) != 0) /*[4]*/ |
833 | /* | 881 | /* |
834 | * [1] no changing of bits that are locked | 882 | * [1] no changing of bits that are locked |
@@ -893,7 +941,7 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages) | |||
893 | { | 941 | { |
894 | int cap_sys_admin = 0; | 942 | int cap_sys_admin = 0; |
895 | 943 | ||
896 | if (cap_capable(current, current_cred(), CAP_SYS_ADMIN, | 944 | if (cap_capable(current, current_cred(), &init_user_ns, CAP_SYS_ADMIN, |
897 | SECURITY_CAP_NOAUDIT) == 0) | 945 | SECURITY_CAP_NOAUDIT) == 0) |
898 | cap_sys_admin = 1; | 946 | cap_sys_admin = 1; |
899 | return __vm_enough_memory(mm, pages, cap_sys_admin); | 947 | return __vm_enough_memory(mm, pages, cap_sys_admin); |
@@ -920,7 +968,7 @@ int cap_file_mmap(struct file *file, unsigned long reqprot, | |||
920 | int ret = 0; | 968 | int ret = 0; |
921 | 969 | ||
922 | if (addr < dac_mmap_min_addr) { | 970 | if (addr < dac_mmap_min_addr) { |
923 | ret = cap_capable(current, current_cred(), CAP_SYS_RAWIO, | 971 | ret = cap_capable(current, current_cred(), &init_user_ns, CAP_SYS_RAWIO, |
924 | SECURITY_CAP_AUDIT); | 972 | SECURITY_CAP_AUDIT); |
925 | /* set PF_SUPERPRIV if it turns out we allow the low mmap */ | 973 | /* set PF_SUPERPRIV if it turns out we allow the low mmap */ |
926 | if (ret == 0) | 974 | if (ret == 0) |
diff --git a/security/security.c b/security/security.c index 9187665a3fdd..4ba6d4cc061f 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -154,29 +154,33 @@ int security_capset(struct cred *new, const struct cred *old, | |||
154 | effective, inheritable, permitted); | 154 | effective, inheritable, permitted); |
155 | } | 155 | } |
156 | 156 | ||
157 | int security_capable(const struct cred *cred, int cap) | 157 | int security_capable(struct user_namespace *ns, const struct cred *cred, |
158 | int cap) | ||
158 | { | 159 | { |
159 | return security_ops->capable(current, cred, cap, SECURITY_CAP_AUDIT); | 160 | return security_ops->capable(current, cred, ns, cap, |
161 | SECURITY_CAP_AUDIT); | ||
160 | } | 162 | } |
161 | 163 | ||
162 | int security_real_capable(struct task_struct *tsk, int cap) | 164 | int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, |
165 | int cap) | ||
163 | { | 166 | { |
164 | const struct cred *cred; | 167 | const struct cred *cred; |
165 | int ret; | 168 | int ret; |
166 | 169 | ||
167 | cred = get_task_cred(tsk); | 170 | cred = get_task_cred(tsk); |
168 | ret = security_ops->capable(tsk, cred, cap, SECURITY_CAP_AUDIT); | 171 | ret = security_ops->capable(tsk, cred, ns, cap, SECURITY_CAP_AUDIT); |
169 | put_cred(cred); | 172 | put_cred(cred); |
170 | return ret; | 173 | return ret; |
171 | } | 174 | } |
172 | 175 | ||
173 | int security_real_capable_noaudit(struct task_struct *tsk, int cap) | 176 | int security_real_capable_noaudit(struct task_struct *tsk, |
177 | struct user_namespace *ns, int cap) | ||
174 | { | 178 | { |
175 | const struct cred *cred; | 179 | const struct cred *cred; |
176 | int ret; | 180 | int ret; |
177 | 181 | ||
178 | cred = get_task_cred(tsk); | 182 | cred = get_task_cred(tsk); |
179 | ret = security_ops->capable(tsk, cred, cap, SECURITY_CAP_NOAUDIT); | 183 | ret = security_ops->capable(tsk, cred, ns, cap, SECURITY_CAP_NOAUDIT); |
180 | put_cred(cred); | 184 | put_cred(cred); |
181 | return ret; | 185 | return ret; |
182 | } | 186 | } |
@@ -514,16 +518,14 @@ int security_inode_permission(struct inode *inode, int mask) | |||
514 | { | 518 | { |
515 | if (unlikely(IS_PRIVATE(inode))) | 519 | if (unlikely(IS_PRIVATE(inode))) |
516 | return 0; | 520 | return 0; |
517 | return security_ops->inode_permission(inode, mask); | 521 | return security_ops->inode_permission(inode, mask, 0); |
518 | } | 522 | } |
519 | 523 | ||
520 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) | 524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) |
521 | { | 525 | { |
522 | if (unlikely(IS_PRIVATE(inode))) | 526 | if (unlikely(IS_PRIVATE(inode))) |
523 | return 0; | 527 | return 0; |
524 | if (flags) | 528 | return security_ops->inode_permission(inode, MAY_EXEC, flags); |
525 | return -ECHILD; | ||
526 | return security_ops->inode_permission(inode, MAY_EXEC); | ||
527 | } | 529 | } |
528 | 530 | ||
529 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | 531 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) |
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 9da6420e2056..1d027e29ce8d 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -471,6 +471,7 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
471 | * @avd: access vector decisions | 471 | * @avd: access vector decisions |
472 | * @result: result from avc_has_perm_noaudit | 472 | * @result: result from avc_has_perm_noaudit |
473 | * @a: auxiliary audit data | 473 | * @a: auxiliary audit data |
474 | * @flags: VFS walk flags | ||
474 | * | 475 | * |
475 | * Audit the granting or denial of permissions in accordance | 476 | * Audit the granting or denial of permissions in accordance |
476 | * with the policy. This function is typically called by | 477 | * with the policy. This function is typically called by |
@@ -481,9 +482,10 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
481 | * be performed under a lock, to allow the lock to be released | 482 | * be performed under a lock, to allow the lock to be released |
482 | * before calling the auditing code. | 483 | * before calling the auditing code. |
483 | */ | 484 | */ |
484 | void avc_audit(u32 ssid, u32 tsid, | 485 | int avc_audit(u32 ssid, u32 tsid, |
485 | u16 tclass, u32 requested, | 486 | u16 tclass, u32 requested, |
486 | struct av_decision *avd, int result, struct common_audit_data *a) | 487 | struct av_decision *avd, int result, struct common_audit_data *a, |
488 | unsigned flags) | ||
487 | { | 489 | { |
488 | struct common_audit_data stack_data; | 490 | struct common_audit_data stack_data; |
489 | u32 denied, audited; | 491 | u32 denied, audited; |
@@ -515,11 +517,24 @@ void avc_audit(u32 ssid, u32 tsid, | |||
515 | else | 517 | else |
516 | audited = requested & avd->auditallow; | 518 | audited = requested & avd->auditallow; |
517 | if (!audited) | 519 | if (!audited) |
518 | return; | 520 | return 0; |
521 | |||
519 | if (!a) { | 522 | if (!a) { |
520 | a = &stack_data; | 523 | a = &stack_data; |
521 | COMMON_AUDIT_DATA_INIT(a, NONE); | 524 | COMMON_AUDIT_DATA_INIT(a, NONE); |
522 | } | 525 | } |
526 | |||
527 | /* | ||
528 | * When in a RCU walk do the audit on the RCU retry. This is because | ||
529 | * the collection of the dname in an inode audit message is not RCU | ||
530 | * safe. Note this may drop some audits when the situation changes | ||
531 | * during retry. However this is logically just as if the operation | ||
532 | * happened a little later. | ||
533 | */ | ||
534 | if ((a->type == LSM_AUDIT_DATA_FS) && | ||
535 | (flags & IPERM_FLAG_RCU)) | ||
536 | return -ECHILD; | ||
537 | |||
523 | a->selinux_audit_data.tclass = tclass; | 538 | a->selinux_audit_data.tclass = tclass; |
524 | a->selinux_audit_data.requested = requested; | 539 | a->selinux_audit_data.requested = requested; |
525 | a->selinux_audit_data.ssid = ssid; | 540 | a->selinux_audit_data.ssid = ssid; |
@@ -529,6 +544,7 @@ void avc_audit(u32 ssid, u32 tsid, | |||
529 | a->lsm_pre_audit = avc_audit_pre_callback; | 544 | a->lsm_pre_audit = avc_audit_pre_callback; |
530 | a->lsm_post_audit = avc_audit_post_callback; | 545 | a->lsm_post_audit = avc_audit_post_callback; |
531 | common_lsm_audit(a); | 546 | common_lsm_audit(a); |
547 | return 0; | ||
532 | } | 548 | } |
533 | 549 | ||
534 | /** | 550 | /** |
@@ -793,6 +809,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
793 | * @tclass: target security class | 809 | * @tclass: target security class |
794 | * @requested: requested permissions, interpreted based on @tclass | 810 | * @requested: requested permissions, interpreted based on @tclass |
795 | * @auditdata: auxiliary audit data | 811 | * @auditdata: auxiliary audit data |
812 | * @flags: VFS walk flags | ||
796 | * | 813 | * |
797 | * Check the AVC to determine whether the @requested permissions are granted | 814 | * Check the AVC to determine whether the @requested permissions are granted |
798 | * for the SID pair (@ssid, @tsid), interpreting the permissions | 815 | * for the SID pair (@ssid, @tsid), interpreting the permissions |
@@ -802,14 +819,19 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
802 | * permissions are granted, -%EACCES if any permissions are denied, or | 819 | * permissions are granted, -%EACCES if any permissions are denied, or |
803 | * another -errno upon other errors. | 820 | * another -errno upon other errors. |
804 | */ | 821 | */ |
805 | int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, | 822 | int avc_has_perm_flags(u32 ssid, u32 tsid, u16 tclass, |
806 | u32 requested, struct common_audit_data *auditdata) | 823 | u32 requested, struct common_audit_data *auditdata, |
824 | unsigned flags) | ||
807 | { | 825 | { |
808 | struct av_decision avd; | 826 | struct av_decision avd; |
809 | int rc; | 827 | int rc, rc2; |
810 | 828 | ||
811 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); | 829 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); |
812 | avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); | 830 | |
831 | rc2 = avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata, | ||
832 | flags); | ||
833 | if (rc2) | ||
834 | return rc2; | ||
813 | return rc; | 835 | return rc; |
814 | } | 836 | } |
815 | 837 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6475e1f0223e..f7cf0ea6faea 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/mutex.h> | 79 | #include <linux/mutex.h> |
80 | #include <linux/posix-timers.h> | 80 | #include <linux/posix-timers.h> |
81 | #include <linux/syslog.h> | 81 | #include <linux/syslog.h> |
82 | #include <linux/user_namespace.h> | ||
82 | 83 | ||
83 | #include "avc.h" | 84 | #include "avc.h" |
84 | #include "objsec.h" | 85 | #include "objsec.h" |
@@ -1445,8 +1446,11 @@ static int task_has_capability(struct task_struct *tsk, | |||
1445 | } | 1446 | } |
1446 | 1447 | ||
1447 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); | 1448 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); |
1448 | if (audit == SECURITY_CAP_AUDIT) | 1449 | if (audit == SECURITY_CAP_AUDIT) { |
1449 | avc_audit(sid, sid, sclass, av, &avd, rc, &ad); | 1450 | int rc2 = avc_audit(sid, sid, sclass, av, &avd, rc, &ad, 0); |
1451 | if (rc2) | ||
1452 | return rc2; | ||
1453 | } | ||
1450 | return rc; | 1454 | return rc; |
1451 | } | 1455 | } |
1452 | 1456 | ||
@@ -1466,7 +1470,8 @@ static int task_has_system(struct task_struct *tsk, | |||
1466 | static int inode_has_perm(const struct cred *cred, | 1470 | static int inode_has_perm(const struct cred *cred, |
1467 | struct inode *inode, | 1471 | struct inode *inode, |
1468 | u32 perms, | 1472 | u32 perms, |
1469 | struct common_audit_data *adp) | 1473 | struct common_audit_data *adp, |
1474 | unsigned flags) | ||
1470 | { | 1475 | { |
1471 | struct inode_security_struct *isec; | 1476 | struct inode_security_struct *isec; |
1472 | struct common_audit_data ad; | 1477 | struct common_audit_data ad; |
@@ -1486,7 +1491,7 @@ static int inode_has_perm(const struct cred *cred, | |||
1486 | ad.u.fs.inode = inode; | 1491 | ad.u.fs.inode = inode; |
1487 | } | 1492 | } |
1488 | 1493 | ||
1489 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, adp); | 1494 | return avc_has_perm_flags(sid, isec->sid, isec->sclass, perms, adp, flags); |
1490 | } | 1495 | } |
1491 | 1496 | ||
1492 | /* Same as inode_has_perm, but pass explicit audit data containing | 1497 | /* Same as inode_has_perm, but pass explicit audit data containing |
@@ -1503,7 +1508,7 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
1503 | COMMON_AUDIT_DATA_INIT(&ad, FS); | 1508 | COMMON_AUDIT_DATA_INIT(&ad, FS); |
1504 | ad.u.fs.path.mnt = mnt; | 1509 | ad.u.fs.path.mnt = mnt; |
1505 | ad.u.fs.path.dentry = dentry; | 1510 | ad.u.fs.path.dentry = dentry; |
1506 | return inode_has_perm(cred, inode, av, &ad); | 1511 | return inode_has_perm(cred, inode, av, &ad, 0); |
1507 | } | 1512 | } |
1508 | 1513 | ||
1509 | /* Check whether a task can use an open file descriptor to | 1514 | /* Check whether a task can use an open file descriptor to |
@@ -1539,7 +1544,7 @@ static int file_has_perm(const struct cred *cred, | |||
1539 | /* av is zero if only checking access to the descriptor. */ | 1544 | /* av is zero if only checking access to the descriptor. */ |
1540 | rc = 0; | 1545 | rc = 0; |
1541 | if (av) | 1546 | if (av) |
1542 | rc = inode_has_perm(cred, inode, av, &ad); | 1547 | rc = inode_has_perm(cred, inode, av, &ad, 0); |
1543 | 1548 | ||
1544 | out: | 1549 | out: |
1545 | return rc; | 1550 | return rc; |
@@ -1846,11 +1851,11 @@ static int selinux_capset(struct cred *new, const struct cred *old, | |||
1846 | */ | 1851 | */ |
1847 | 1852 | ||
1848 | static int selinux_capable(struct task_struct *tsk, const struct cred *cred, | 1853 | static int selinux_capable(struct task_struct *tsk, const struct cred *cred, |
1849 | int cap, int audit) | 1854 | struct user_namespace *ns, int cap, int audit) |
1850 | { | 1855 | { |
1851 | int rc; | 1856 | int rc; |
1852 | 1857 | ||
1853 | rc = cap_capable(tsk, cred, cap, audit); | 1858 | rc = cap_capable(tsk, cred, ns, cap, audit); |
1854 | if (rc) | 1859 | if (rc) |
1855 | return rc; | 1860 | return rc; |
1856 | 1861 | ||
@@ -1931,7 +1936,8 @@ static int selinux_vm_enough_memory(struct mm_struct *mm, long pages) | |||
1931 | { | 1936 | { |
1932 | int rc, cap_sys_admin = 0; | 1937 | int rc, cap_sys_admin = 0; |
1933 | 1938 | ||
1934 | rc = selinux_capable(current, current_cred(), CAP_SYS_ADMIN, | 1939 | rc = selinux_capable(current, current_cred(), |
1940 | &init_user_ns, CAP_SYS_ADMIN, | ||
1935 | SECURITY_CAP_NOAUDIT); | 1941 | SECURITY_CAP_NOAUDIT); |
1936 | if (rc == 0) | 1942 | if (rc == 0) |
1937 | cap_sys_admin = 1; | 1943 | cap_sys_admin = 1; |
@@ -2101,7 +2107,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2101 | file = file_priv->file; | 2107 | file = file_priv->file; |
2102 | inode = file->f_path.dentry->d_inode; | 2108 | inode = file->f_path.dentry->d_inode; |
2103 | if (inode_has_perm(cred, inode, | 2109 | if (inode_has_perm(cred, inode, |
2104 | FILE__READ | FILE__WRITE, NULL)) { | 2110 | FILE__READ | FILE__WRITE, NULL, 0)) { |
2105 | drop_tty = 1; | 2111 | drop_tty = 1; |
2106 | } | 2112 | } |
2107 | } | 2113 | } |
@@ -2633,7 +2639,7 @@ static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *na | |||
2633 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); | 2639 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); |
2634 | } | 2640 | } |
2635 | 2641 | ||
2636 | static int selinux_inode_permission(struct inode *inode, int mask) | 2642 | static int selinux_inode_permission(struct inode *inode, int mask, unsigned flags) |
2637 | { | 2643 | { |
2638 | const struct cred *cred = current_cred(); | 2644 | const struct cred *cred = current_cred(); |
2639 | struct common_audit_data ad; | 2645 | struct common_audit_data ad; |
@@ -2655,7 +2661,7 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2655 | 2661 | ||
2656 | perms = file_mask_to_av(inode->i_mode, mask); | 2662 | perms = file_mask_to_av(inode->i_mode, mask); |
2657 | 2663 | ||
2658 | return inode_has_perm(cred, inode, perms, &ad); | 2664 | return inode_has_perm(cred, inode, perms, &ad, flags); |
2659 | } | 2665 | } |
2660 | 2666 | ||
2661 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) | 2667 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) |
@@ -2723,7 +2729,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2723 | if (!(sbsec->flags & SE_SBLABELSUPP)) | 2729 | if (!(sbsec->flags & SE_SBLABELSUPP)) |
2724 | return -EOPNOTSUPP; | 2730 | return -EOPNOTSUPP; |
2725 | 2731 | ||
2726 | if (!is_owner_or_cap(inode)) | 2732 | if (!inode_owner_or_capable(inode)) |
2727 | return -EPERM; | 2733 | return -EPERM; |
2728 | 2734 | ||
2729 | COMMON_AUDIT_DATA_INIT(&ad, FS); | 2735 | COMMON_AUDIT_DATA_INIT(&ad, FS); |
@@ -2834,7 +2840,8 @@ static int selinux_inode_getsecurity(const struct inode *inode, const char *name | |||
2834 | * and lack of permission just means that we fall back to the | 2840 | * and lack of permission just means that we fall back to the |
2835 | * in-core context value, not a denial. | 2841 | * in-core context value, not a denial. |
2836 | */ | 2842 | */ |
2837 | error = selinux_capable(current, current_cred(), CAP_MAC_ADMIN, | 2843 | error = selinux_capable(current, current_cred(), |
2844 | &init_user_ns, CAP_MAC_ADMIN, | ||
2838 | SECURITY_CAP_NOAUDIT); | 2845 | SECURITY_CAP_NOAUDIT); |
2839 | if (!error) | 2846 | if (!error) |
2840 | error = security_sid_to_context_force(isec->sid, &context, | 2847 | error = security_sid_to_context_force(isec->sid, &context, |
@@ -2968,7 +2975,7 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd, | |||
2968 | case KDSKBENT: | 2975 | case KDSKBENT: |
2969 | case KDSKBSENT: | 2976 | case KDSKBSENT: |
2970 | error = task_has_capability(current, cred, CAP_SYS_TTY_CONFIG, | 2977 | error = task_has_capability(current, cred, CAP_SYS_TTY_CONFIG, |
2971 | SECURITY_CAP_AUDIT); | 2978 | SECURITY_CAP_AUDIT); |
2972 | break; | 2979 | break; |
2973 | 2980 | ||
2974 | /* default case assumes that the command will go | 2981 | /* default case assumes that the command will go |
@@ -3202,7 +3209,7 @@ static int selinux_dentry_open(struct file *file, const struct cred *cred) | |||
3202 | * new inode label or new policy. | 3209 | * new inode label or new policy. |
3203 | * This check is not redundant - do not remove. | 3210 | * This check is not redundant - do not remove. |
3204 | */ | 3211 | */ |
3205 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL); | 3212 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL, 0); |
3206 | } | 3213 | } |
3207 | 3214 | ||
3208 | /* task security operations */ | 3215 | /* task security operations */ |
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h index 5615081b73ec..e77b2ac2908b 100644 --- a/security/selinux/include/avc.h +++ b/security/selinux/include/avc.h | |||
@@ -54,11 +54,11 @@ struct avc_cache_stats { | |||
54 | 54 | ||
55 | void __init avc_init(void); | 55 | void __init avc_init(void); |
56 | 56 | ||
57 | void avc_audit(u32 ssid, u32 tsid, | 57 | int avc_audit(u32 ssid, u32 tsid, |
58 | u16 tclass, u32 requested, | 58 | u16 tclass, u32 requested, |
59 | struct av_decision *avd, | 59 | struct av_decision *avd, |
60 | int result, | 60 | int result, |
61 | struct common_audit_data *a); | 61 | struct common_audit_data *a, unsigned flags); |
62 | 62 | ||
63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ | 63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ |
64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, | 64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, |
@@ -66,9 +66,17 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
66 | unsigned flags, | 66 | unsigned flags, |
67 | struct av_decision *avd); | 67 | struct av_decision *avd); |
68 | 68 | ||
69 | int avc_has_perm(u32 ssid, u32 tsid, | 69 | int avc_has_perm_flags(u32 ssid, u32 tsid, |
70 | u16 tclass, u32 requested, | 70 | u16 tclass, u32 requested, |
71 | struct common_audit_data *auditdata); | 71 | struct common_audit_data *auditdata, |
72 | unsigned); | ||
73 | |||
74 | static inline int avc_has_perm(u32 ssid, u32 tsid, | ||
75 | u16 tclass, u32 requested, | ||
76 | struct common_audit_data *auditdata) | ||
77 | { | ||
78 | return avc_has_perm_flags(ssid, tsid, tclass, requested, auditdata, 0); | ||
79 | } | ||
72 | 80 | ||
73 | u32 avc_policy_seqno(void); | 81 | u32 avc_policy_seqno(void); |
74 | 82 | ||
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c index 1c2fc46544bf..c3bf3ed07b06 100644 --- a/security/selinux/netlabel.c +++ b/security/selinux/netlabel.c | |||
@@ -151,7 +151,7 @@ void selinux_netlbl_sk_security_free(struct sk_security_struct *sksec) | |||
151 | * | 151 | * |
152 | * Description: | 152 | * Description: |
153 | * Called when the NetLabel state of a sk_security_struct needs to be reset. | 153 | * Called when the NetLabel state of a sk_security_struct needs to be reset. |
154 | * The caller is responsibile for all the NetLabel sk_security_struct locking. | 154 | * The caller is responsible for all the NetLabel sk_security_struct locking. |
155 | * | 155 | * |
156 | */ | 156 | */ |
157 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec) | 157 | void selinux_netlbl_sk_security_reset(struct sk_security_struct *sksec) |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 3e7544d2a07b..6ef4af47dac4 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -213,7 +213,7 @@ static u16 map_class(u16 pol_value) | |||
213 | return i; | 213 | return i; |
214 | } | 214 | } |
215 | 215 | ||
216 | return pol_value; | 216 | return SECCLASS_NULL; |
217 | } | 217 | } |
218 | 218 | ||
219 | static void map_decision(u16 tclass, struct av_decision *avd, | 219 | static void map_decision(u16 tclass, struct av_decision *avd, |
@@ -2806,7 +2806,7 @@ int selinux_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule) | |||
2806 | case AUDIT_SUBJ_CLR: | 2806 | case AUDIT_SUBJ_CLR: |
2807 | case AUDIT_OBJ_LEV_LOW: | 2807 | case AUDIT_OBJ_LEV_LOW: |
2808 | case AUDIT_OBJ_LEV_HIGH: | 2808 | case AUDIT_OBJ_LEV_HIGH: |
2809 | /* we do not allow a range, indicated by the presense of '-' */ | 2809 | /* we do not allow a range, indicated by the presence of '-' */ |
2810 | if (strchr(rulestr, '-')) | 2810 | if (strchr(rulestr, '-')) |
2811 | return -EINVAL; | 2811 | return -EINVAL; |
2812 | break; | 2812 | break; |
@@ -3075,7 +3075,7 @@ static void security_netlbl_cache_add(struct netlbl_lsm_secattr *secattr, | |||
3075 | * Description: | 3075 | * Description: |
3076 | * Convert the given NetLabel security attributes in @secattr into a | 3076 | * Convert the given NetLabel security attributes in @secattr into a |
3077 | * SELinux SID. If the @secattr field does not contain a full SELinux | 3077 | * SELinux SID. If the @secattr field does not contain a full SELinux |
3078 | * SID/context then use SECINITSID_NETMSG as the foundation. If possibile the | 3078 | * SID/context then use SECINITSID_NETMSG as the foundation. If possible the |
3079 | * 'cache' field of @secattr is set and the CACHE flag is set; this is to | 3079 | * 'cache' field of @secattr is set and the CACHE flag is set; this is to |
3080 | * allow the @secattr to be used by NetLabel to cache the secattr to SID | 3080 | * allow the @secattr to be used by NetLabel to cache the secattr to SID |
3081 | * conversion for future lookups. Returns zero on success, negative values on | 3081 | * conversion for future lookups. Returns zero on success, negative values on |
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index 86453db4333d..9637e107f7ea 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c | |||
@@ -431,7 +431,7 @@ char *smk_import(const char *string, int len) | |||
431 | * smack_from_secid - find the Smack label associated with a secid | 431 | * smack_from_secid - find the Smack label associated with a secid |
432 | * @secid: an integer that might be associated with a Smack label | 432 | * @secid: an integer that might be associated with a Smack label |
433 | * | 433 | * |
434 | * Returns a pointer to the appropraite Smack label if there is one, | 434 | * Returns a pointer to the appropriate Smack label if there is one, |
435 | * otherwise a pointer to the invalid Smack label. | 435 | * otherwise a pointer to the invalid Smack label. |
436 | */ | 436 | */ |
437 | char *smack_from_secid(const u32 secid) | 437 | char *smack_from_secid(const u32 secid) |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 23c7a6d0c80c..400a5d5cde61 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -686,7 +686,7 @@ static int smack_inode_rename(struct inode *old_inode, | |||
686 | * | 686 | * |
687 | * Returns 0 if access is permitted, -EACCES otherwise | 687 | * Returns 0 if access is permitted, -EACCES otherwise |
688 | */ | 688 | */ |
689 | static int smack_inode_permission(struct inode *inode, int mask) | 689 | static int smack_inode_permission(struct inode *inode, int mask, unsigned flags) |
690 | { | 690 | { |
691 | struct smk_audit_info ad; | 691 | struct smk_audit_info ad; |
692 | 692 | ||
@@ -696,6 +696,10 @@ static int smack_inode_permission(struct inode *inode, int mask) | |||
696 | */ | 696 | */ |
697 | if (mask == 0) | 697 | if (mask == 0) |
698 | return 0; | 698 | return 0; |
699 | |||
700 | /* May be droppable after audit */ | ||
701 | if (flags & IPERM_FLAG_RCU) | ||
702 | return -ECHILD; | ||
699 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); | 703 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); |
700 | smk_ad_setfield_u_fs_inode(&ad, inode); | 704 | smk_ad_setfield_u_fs_inode(&ad, inode); |
701 | return smk_curacc(smk_of_inode(inode), mask, &ad); | 705 | return smk_curacc(smk_of_inode(inode), mask, &ad); |
@@ -1794,7 +1798,7 @@ static void smack_set_catset(char *catset, struct netlbl_lsm_secattr *sap) | |||
1794 | * Casey says that CIPSO is good enough for now. | 1798 | * Casey says that CIPSO is good enough for now. |
1795 | * It can be used to effect. | 1799 | * It can be used to effect. |
1796 | * It can also be abused to effect when necessary. | 1800 | * It can also be abused to effect when necessary. |
1797 | * Appologies to the TSIG group in general and GW in particular. | 1801 | * Apologies to the TSIG group in general and GW in particular. |
1798 | */ | 1802 | */ |
1799 | static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp) | 1803 | static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp) |
1800 | { | 1804 | { |
@@ -2530,7 +2534,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) | |||
2530 | switch (sbp->s_magic) { | 2534 | switch (sbp->s_magic) { |
2531 | case SMACK_MAGIC: | 2535 | case SMACK_MAGIC: |
2532 | /* | 2536 | /* |
2533 | * Casey says that it's a little embarassing | 2537 | * Casey says that it's a little embarrassing |
2534 | * that the smack file system doesn't do | 2538 | * that the smack file system doesn't do |
2535 | * extended attributes. | 2539 | * extended attributes. |
2536 | */ | 2540 | */ |
@@ -3084,7 +3088,7 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
3084 | /* | 3088 | /* |
3085 | * We need to decide if we want to label the incoming connection here | 3089 | * We need to decide if we want to label the incoming connection here |
3086 | * if we do we only need to label the request_sock and the stack will | 3090 | * if we do we only need to label the request_sock and the stack will |
3087 | * propogate the wire-label to the sock when it is created. | 3091 | * propagate the wire-label to the sock when it is created. |
3088 | */ | 3092 | */ |
3089 | hdr = ip_hdr(skb); | 3093 | hdr = ip_hdr(skb); |
3090 | addr.sin_addr.s_addr = hdr->saddr; | 3094 | addr.sin_addr.s_addr = hdr->saddr; |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 90d1bbaaa6f3..f93460156dce 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -208,7 +208,7 @@ static ssize_t smk_write_load_list(struct file *file, const char __user *buf, | |||
208 | if (*ppos != 0) | 208 | if (*ppos != 0) |
209 | return -EINVAL; | 209 | return -EINVAL; |
210 | /* | 210 | /* |
211 | * Minor hack for backward compatability | 211 | * Minor hack for backward compatibility |
212 | */ | 212 | */ |
213 | if (count < (SMK_OLOADLEN) || count > SMK_LOADLEN) | 213 | if (count < (SMK_OLOADLEN) || count > SMK_LOADLEN) |
214 | return -EINVAL; | 214 | return -EINVAL; |
@@ -223,7 +223,7 @@ static ssize_t smk_write_load_list(struct file *file, const char __user *buf, | |||
223 | } | 223 | } |
224 | 224 | ||
225 | /* | 225 | /* |
226 | * More on the minor hack for backward compatability | 226 | * More on the minor hack for backward compatibility |
227 | */ | 227 | */ |
228 | if (count == (SMK_OLOADLEN)) | 228 | if (count == (SMK_OLOADLEN)) |
229 | data[SMK_OLOADLEN] = '-'; | 229 | data[SMK_OLOADLEN] = '-'; |
@@ -927,7 +927,7 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf, | |||
927 | } | 927 | } |
928 | } else { | 928 | } else { |
929 | /* we delete the unlabeled entry, only if the previous label | 929 | /* we delete the unlabeled entry, only if the previous label |
930 | * wasnt the special CIPSO option */ | 930 | * wasn't the special CIPSO option */ |
931 | if (skp->smk_label != smack_cipso_option) | 931 | if (skp->smk_label != smack_cipso_option) |
932 | rc = netlbl_cfg_unlbl_static_del(&init_net, NULL, | 932 | rc = netlbl_cfg_unlbl_static_del(&init_net, NULL, |
933 | &skp->smk_host.sin_addr, &skp->smk_mask, | 933 | &skp->smk_host.sin_addr, &skp->smk_mask, |
diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c index bbada7ca1b91..3312e5624f24 100644 --- a/security/tomoyo/load_policy.c +++ b/security/tomoyo/load_policy.c | |||
@@ -23,7 +23,7 @@ static bool tomoyo_policy_loader_exists(void) | |||
23 | * If the initrd includes /sbin/init but real-root-dev has not | 23 | * If the initrd includes /sbin/init but real-root-dev has not |
24 | * mounted on / yet, activating MAC will block the system since | 24 | * mounted on / yet, activating MAC will block the system since |
25 | * policies are not loaded yet. | 25 | * policies are not loaded yet. |
26 | * Thus, let do_execve() call this function everytime. | 26 | * Thus, let do_execve() call this function every time. |
27 | */ | 27 | */ |
28 | struct path path; | 28 | struct path path; |
29 | 29 | ||