diff options
Diffstat (limited to 'security/security.c')
-rw-r--r-- | security/security.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/security/security.c b/security/security.c index 7b7308ace8c5..4ba6d4cc061f 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -154,38 +154,37 @@ 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 | } |
183 | 187 | ||
184 | int security_sysctl(struct ctl_table *table, int op) | ||
185 | { | ||
186 | return security_ops->sysctl(table, op); | ||
187 | } | ||
188 | |||
189 | int security_quotactl(int cmds, int type, int id, struct super_block *sb) | 188 | int security_quotactl(int cmds, int type, int id, struct super_block *sb) |
190 | { | 189 | { |
191 | return security_ops->quotactl(cmds, type, id, sb); | 190 | return security_ops->quotactl(cmds, type, id, sb); |
@@ -201,7 +200,7 @@ int security_syslog(int type) | |||
201 | return security_ops->syslog(type); | 200 | return security_ops->syslog(type); |
202 | } | 201 | } |
203 | 202 | ||
204 | int security_settime(struct timespec *ts, struct timezone *tz) | 203 | int security_settime(const struct timespec *ts, const struct timezone *tz) |
205 | { | 204 | { |
206 | return security_ops->settime(ts, tz); | 205 | return security_ops->settime(ts, tz); |
207 | } | 206 | } |
@@ -271,6 +270,11 @@ int security_sb_copy_data(char *orig, char *copy) | |||
271 | } | 270 | } |
272 | EXPORT_SYMBOL(security_sb_copy_data); | 271 | EXPORT_SYMBOL(security_sb_copy_data); |
273 | 272 | ||
273 | int security_sb_remount(struct super_block *sb, void *data) | ||
274 | { | ||
275 | return security_ops->sb_remount(sb, data); | ||
276 | } | ||
277 | |||
274 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data) | 278 | int security_sb_kern_mount(struct super_block *sb, int flags, void *data) |
275 | { | 279 | { |
276 | return security_ops->sb_kern_mount(sb, flags, data); | 280 | return security_ops->sb_kern_mount(sb, flags, data); |
@@ -335,11 +339,13 @@ void security_inode_free(struct inode *inode) | |||
335 | } | 339 | } |
336 | 340 | ||
337 | int security_inode_init_security(struct inode *inode, struct inode *dir, | 341 | int security_inode_init_security(struct inode *inode, struct inode *dir, |
338 | char **name, void **value, size_t *len) | 342 | const struct qstr *qstr, char **name, |
343 | void **value, size_t *len) | ||
339 | { | 344 | { |
340 | if (unlikely(IS_PRIVATE(inode))) | 345 | if (unlikely(IS_PRIVATE(inode))) |
341 | return -EOPNOTSUPP; | 346 | return -EOPNOTSUPP; |
342 | return security_ops->inode_init_security(inode, dir, name, value, len); | 347 | return security_ops->inode_init_security(inode, dir, qstr, name, value, |
348 | len); | ||
343 | } | 349 | } |
344 | EXPORT_SYMBOL(security_inode_init_security); | 350 | EXPORT_SYMBOL(security_inode_init_security); |
345 | 351 | ||
@@ -359,6 +365,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode) | |||
359 | return 0; | 365 | return 0; |
360 | return security_ops->path_mkdir(dir, dentry, mode); | 366 | return security_ops->path_mkdir(dir, dentry, mode); |
361 | } | 367 | } |
368 | EXPORT_SYMBOL(security_path_mkdir); | ||
362 | 369 | ||
363 | int security_path_rmdir(struct path *dir, struct dentry *dentry) | 370 | int security_path_rmdir(struct path *dir, struct dentry *dentry) |
364 | { | 371 | { |
@@ -373,6 +380,7 @@ int security_path_unlink(struct path *dir, struct dentry *dentry) | |||
373 | return 0; | 380 | return 0; |
374 | return security_ops->path_unlink(dir, dentry); | 381 | return security_ops->path_unlink(dir, dentry); |
375 | } | 382 | } |
383 | EXPORT_SYMBOL(security_path_unlink); | ||
376 | 384 | ||
377 | int security_path_symlink(struct path *dir, struct dentry *dentry, | 385 | int security_path_symlink(struct path *dir, struct dentry *dentry, |
378 | const char *old_name) | 386 | const char *old_name) |
@@ -399,6 +407,7 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | |||
399 | return security_ops->path_rename(old_dir, old_dentry, new_dir, | 407 | return security_ops->path_rename(old_dir, old_dentry, new_dir, |
400 | new_dentry); | 408 | new_dentry); |
401 | } | 409 | } |
410 | EXPORT_SYMBOL(security_path_rename); | ||
402 | 411 | ||
403 | int security_path_truncate(struct path *path) | 412 | int security_path_truncate(struct path *path) |
404 | { | 413 | { |
@@ -509,16 +518,14 @@ int security_inode_permission(struct inode *inode, int mask) | |||
509 | { | 518 | { |
510 | if (unlikely(IS_PRIVATE(inode))) | 519 | if (unlikely(IS_PRIVATE(inode))) |
511 | return 0; | 520 | return 0; |
512 | return security_ops->inode_permission(inode, mask); | 521 | return security_ops->inode_permission(inode, mask, 0); |
513 | } | 522 | } |
514 | 523 | ||
515 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) | 524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) |
516 | { | 525 | { |
517 | if (unlikely(IS_PRIVATE(inode))) | 526 | if (unlikely(IS_PRIVATE(inode))) |
518 | return 0; | 527 | return 0; |
519 | if (flags) | 528 | return security_ops->inode_permission(inode, MAY_EXEC, flags); |
520 | return -ECHILD; | ||
521 | return security_ops->inode_permission(inode, MAY_EXEC); | ||
522 | } | 529 | } |
523 | 530 | ||
524 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | 531 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) |
@@ -1100,7 +1107,7 @@ void security_sk_clone(const struct sock *sk, struct sock *newsk) | |||
1100 | 1107 | ||
1101 | void security_sk_classify_flow(struct sock *sk, struct flowi *fl) | 1108 | void security_sk_classify_flow(struct sock *sk, struct flowi *fl) |
1102 | { | 1109 | { |
1103 | security_ops->sk_getsecid(sk, &fl->secid); | 1110 | security_ops->sk_getsecid(sk, &fl->flowi_secid); |
1104 | } | 1111 | } |
1105 | EXPORT_SYMBOL(security_sk_classify_flow); | 1112 | EXPORT_SYMBOL(security_sk_classify_flow); |
1106 | 1113 | ||
@@ -1233,7 +1240,8 @@ int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir) | |||
1233 | } | 1240 | } |
1234 | 1241 | ||
1235 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, | 1242 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
1236 | struct xfrm_policy *xp, struct flowi *fl) | 1243 | struct xfrm_policy *xp, |
1244 | const struct flowi *fl) | ||
1237 | { | 1245 | { |
1238 | return security_ops->xfrm_state_pol_flow_match(x, xp, fl); | 1246 | return security_ops->xfrm_state_pol_flow_match(x, xp, fl); |
1239 | } | 1247 | } |
@@ -1245,7 +1253,7 @@ int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) | |||
1245 | 1253 | ||
1246 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) | 1254 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) |
1247 | { | 1255 | { |
1248 | int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0); | 1256 | int rc = security_ops->xfrm_decode_session(skb, &fl->flowi_secid, 0); |
1249 | 1257 | ||
1250 | BUG_ON(rc); | 1258 | BUG_ON(rc); |
1251 | } | 1259 | } |