aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 83e946f1cdde..327e65d50674 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -131,11 +131,6 @@ struct audit_aux_data_execve {
131 struct mm_struct *mm; 131 struct mm_struct *mm;
132}; 132};
133 133
134struct audit_aux_data_fd_pair {
135 struct audit_aux_data d;
136 int fd[2];
137};
138
139struct audit_aux_data_pids { 134struct audit_aux_data_pids {
140 struct audit_aux_data d; 135 struct audit_aux_data d;
141 pid_t target_pid[AUDIT_AUX_PIDS]; 136 pid_t target_pid[AUDIT_AUX_PIDS];
@@ -241,6 +236,7 @@ struct audit_context {
241 struct mq_attr attr; 236 struct mq_attr attr;
242 } mq_open; 237 } mq_open;
243 }; 238 };
239 int fds[2];
244 240
245#if AUDIT_DEBUG 241#if AUDIT_DEBUG
246 int put_count; 242 int put_count;
@@ -1382,11 +1378,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1382 audit_log_execve_info(context, &ab, axi); 1378 audit_log_execve_info(context, &ab, axi);
1383 break; } 1379 break; }
1384 1380
1385 case AUDIT_FD_PAIR: {
1386 struct audit_aux_data_fd_pair *axs = (void *)aux;
1387 audit_log_format(ab, "fd0=%d fd1=%d", axs->fd[0], axs->fd[1]);
1388 break; }
1389
1390 case AUDIT_BPRM_FCAPS: { 1381 case AUDIT_BPRM_FCAPS: {
1391 struct audit_aux_data_bprm_fcaps *axs = (void *)aux; 1382 struct audit_aux_data_bprm_fcaps *axs = (void *)aux;
1392 audit_log_format(ab, "fver=%x", axs->fcap_ver); 1383 audit_log_format(ab, "fver=%x", axs->fcap_ver);
@@ -1416,6 +1407,15 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1416 if (context->type) 1407 if (context->type)
1417 show_special(context, &call_panic); 1408 show_special(context, &call_panic);
1418 1409
1410 if (context->fds[0] >= 0) {
1411 ab = audit_log_start(context, GFP_KERNEL, AUDIT_FD_PAIR);
1412 if (ab) {
1413 audit_log_format(ab, "fd0=%d fd1=%d",
1414 context->fds[0], context->fds[1]);
1415 audit_log_end(ab);
1416 }
1417 }
1418
1419 if (context->sockaddr_len) { 1419 if (context->sockaddr_len) {
1420 ab = audit_log_start(context, GFP_KERNEL, AUDIT_SOCKADDR); 1420 ab = audit_log_start(context, GFP_KERNEL, AUDIT_SOCKADDR);
1421 if (ab) { 1421 if (ab) {
@@ -1696,6 +1696,7 @@ void audit_syscall_exit(int valid, long return_code)
1696 context->target_sid = 0; 1696 context->target_sid = 0;
1697 context->sockaddr_len = 0; 1697 context->sockaddr_len = 0;
1698 context->type = 0; 1698 context->type = 0;
1699 context->fds[0] = -1;
1699 kfree(context->filterkey); 1700 kfree(context->filterkey);
1700 context->filterkey = NULL; 1701 context->filterkey = NULL;
1701 tsk->audit_context = context; 1702 tsk->audit_context = context;
@@ -2291,29 +2292,12 @@ void audit_socketcall(int nargs, unsigned long *args)
2291 * @fd1: the first file descriptor 2292 * @fd1: the first file descriptor
2292 * @fd2: the second file descriptor 2293 * @fd2: the second file descriptor
2293 * 2294 *
2294 * Returns 0 for success or NULL context or < 0 on error.
2295 */ 2295 */
2296int __audit_fd_pair(int fd1, int fd2) 2296void __audit_fd_pair(int fd1, int fd2)
2297{ 2297{
2298 struct audit_context *context = current->audit_context; 2298 struct audit_context *context = current->audit_context;
2299 struct audit_aux_data_fd_pair *ax; 2299 context->fds[0] = fd1;
2300 2300 context->fds[1] = fd2;
2301 if (likely(!context)) {
2302 return 0;
2303 }
2304
2305 ax = kmalloc(sizeof(*ax), GFP_KERNEL);
2306 if (!ax) {
2307 return -ENOMEM;
2308 }
2309
2310 ax->fd[0] = fd1;
2311 ax->fd[1] = fd2;
2312
2313 ax->d.type = AUDIT_FD_PAIR;
2314 ax->d.next = context->aux;
2315 context->aux = (void *)ax;
2316 return 0;
2317} 2301}
2318 2302
2319/** 2303/**