aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-01-03 14:23:07 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-17 16:16:57 -0500
commit07c49417877f8658a6aa0ad9b4e21e4fd4df11b6 (patch)
tree59a64b96c9f35b8559db4c46b5a43d2d9510c190 /kernel
parent56179a6ec65a56e0279a58e35cb450d38f061b94 (diff)
audit: inline checks for not needing to collect aux records
A number of audit hooks make function calls before they determine that auxilary records do not need to be collected. Do those checks as static inlines since the most common case is going to be that records are not needed and we can skip the function call overhead. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c15
1 files changed, 3 insertions, 12 deletions
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
2312int audit_bprm(struct linux_binprm *bprm) 2312int __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 */
2340void audit_socketcall(int nargs, unsigned long *args) 2337void __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 */
2372int audit_sockaddr(int len, void *a) 2366int __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)