diff options
-rw-r--r-- | include/linux/audit.h | 23 | ||||
-rw-r--r-- | kernel/auditsc.c | 15 |
2 files changed, 23 insertions, 15 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index f56ce2669b83..cf16faff6b8a 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -489,9 +489,9 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); | |||
489 | extern void audit_log_task_context(struct audit_buffer *ab); | 489 | extern void audit_log_task_context(struct audit_buffer *ab); |
490 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 490 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
491 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 491 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
492 | extern int audit_bprm(struct linux_binprm *bprm); | 492 | extern int __audit_bprm(struct linux_binprm *bprm); |
493 | extern void audit_socketcall(int nargs, unsigned long *args); | 493 | extern void __audit_socketcall(int nargs, unsigned long *args); |
494 | extern int audit_sockaddr(int len, void *addr); | 494 | extern int __audit_sockaddr(int len, void *addr); |
495 | extern void __audit_fd_pair(int fd1, int fd2); | 495 | extern void __audit_fd_pair(int fd1, int fd2); |
496 | extern int audit_set_macxattr(const char *name); | 496 | extern int audit_set_macxattr(const char *name); |
497 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); | 497 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
@@ -519,6 +519,23 @@ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid | |||
519 | if (unlikely(!audit_dummy_context())) | 519 | if (unlikely(!audit_dummy_context())) |
520 | __audit_ipc_set_perm(qbytes, uid, gid, mode); | 520 | __audit_ipc_set_perm(qbytes, uid, gid, mode); |
521 | } | 521 | } |
522 | static inline int audit_bprm(struct linux_binprm *bprm) | ||
523 | { | ||
524 | if (unlikely(!audit_dummy_context())) | ||
525 | return __audit_bprm(bprm); | ||
526 | return 0; | ||
527 | } | ||
528 | static inline void audit_socketcall(int nargs, unsigned long *args) | ||
529 | { | ||
530 | if (unlikely(!audit_dummy_context())) | ||
531 | __audit_socketcall(nargs, args); | ||
532 | } | ||
533 | static inline int audit_sockaddr(int len, void *addr) | ||
534 | { | ||
535 | if (unlikely(!audit_dummy_context())) | ||
536 | return __audit_sockaddr(len, addr); | ||
537 | return 0; | ||
538 | } | ||
522 | static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) | 539 | static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) |
523 | { | 540 | { |
524 | if (unlikely(!audit_dummy_context())) | 541 | if (unlikely(!audit_dummy_context())) |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index d7382c2aaa9e..e1062f66b01b 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -2309,14 +2309,11 @@ void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mo | |||
2309 | context->ipc.has_perm = 1; | 2309 | context->ipc.has_perm = 1; |
2310 | } | 2310 | } |
2311 | 2311 | ||
2312 | int audit_bprm(struct linux_binprm *bprm) | 2312 | int __audit_bprm(struct linux_binprm *bprm) |
2313 | { | 2313 | { |
2314 | struct audit_aux_data_execve *ax; | 2314 | struct audit_aux_data_execve *ax; |
2315 | struct audit_context *context = current->audit_context; | 2315 | struct audit_context *context = current->audit_context; |
2316 | 2316 | ||
2317 | if (likely(!audit_enabled || !context || context->dummy)) | ||
2318 | return 0; | ||
2319 | |||
2320 | ax = kmalloc(sizeof(*ax), GFP_KERNEL); | 2317 | ax = kmalloc(sizeof(*ax), GFP_KERNEL); |
2321 | if (!ax) | 2318 | if (!ax) |
2322 | return -ENOMEM; | 2319 | return -ENOMEM; |
@@ -2337,13 +2334,10 @@ int audit_bprm(struct linux_binprm *bprm) | |||
2337 | * @args: args array | 2334 | * @args: args array |
2338 | * | 2335 | * |
2339 | */ | 2336 | */ |
2340 | void audit_socketcall(int nargs, unsigned long *args) | 2337 | void __audit_socketcall(int nargs, unsigned long *args) |
2341 | { | 2338 | { |
2342 | struct audit_context *context = current->audit_context; | 2339 | struct audit_context *context = current->audit_context; |
2343 | 2340 | ||
2344 | if (likely(!context || context->dummy)) | ||
2345 | return; | ||
2346 | |||
2347 | context->type = AUDIT_SOCKETCALL; | 2341 | context->type = AUDIT_SOCKETCALL; |
2348 | context->socketcall.nargs = nargs; | 2342 | context->socketcall.nargs = nargs; |
2349 | memcpy(context->socketcall.args, args, nargs * sizeof(unsigned long)); | 2343 | memcpy(context->socketcall.args, args, nargs * sizeof(unsigned long)); |
@@ -2369,13 +2363,10 @@ void __audit_fd_pair(int fd1, int fd2) | |||
2369 | * | 2363 | * |
2370 | * Returns 0 for success or NULL context or < 0 on error. | 2364 | * Returns 0 for success or NULL context or < 0 on error. |
2371 | */ | 2365 | */ |
2372 | int audit_sockaddr(int len, void *a) | 2366 | int __audit_sockaddr(int len, void *a) |
2373 | { | 2367 | { |
2374 | struct audit_context *context = current->audit_context; | 2368 | struct audit_context *context = current->audit_context; |
2375 | 2369 | ||
2376 | if (likely(!context || context->dummy)) | ||
2377 | return 0; | ||
2378 | |||
2379 | if (!context->sockaddr) { | 2370 | if (!context->sockaddr) { |
2380 | void *p = kmalloc(sizeof(struct sockaddr_storage), GFP_KERNEL); | 2371 | void *p = kmalloc(sizeof(struct sockaddr_storage), GFP_KERNEL); |
2381 | if (!p) | 2372 | if (!p) |