aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/audit.h2
-rw-r--r--kernel/auditsc.c17
-rw-r--r--kernel/fork.c1
3 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 6272a395d43c..1b2a6a5c1876 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -391,6 +391,7 @@ extern int audit_classify_arch(int arch);
391#ifdef CONFIG_AUDITSYSCALL 391#ifdef CONFIG_AUDITSYSCALL
392/* These are defined in auditsc.c */ 392/* These are defined in auditsc.c */
393 /* Public API */ 393 /* Public API */
394extern void audit_finish_fork(struct task_struct *child);
394extern int audit_alloc(struct task_struct *task); 395extern int audit_alloc(struct task_struct *task);
395extern void audit_free(struct task_struct *task); 396extern void audit_free(struct task_struct *task);
396extern void audit_syscall_entry(int arch, 397extern void audit_syscall_entry(int arch,
@@ -504,6 +505,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
504extern int audit_n_rules; 505extern int audit_n_rules;
505extern int audit_signals; 506extern int audit_signals;
506#else 507#else
508#define audit_finish_fork(t)
507#define audit_alloc(t) ({ 0; }) 509#define audit_alloc(t) ({ 0; })
508#define audit_free(t) do { ; } while (0) 510#define audit_free(t) do { ; } while (0)
509#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 511#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index cf5bc2f5f9c3..de8468050afa 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1548,6 +1548,23 @@ void audit_syscall_entry(int arch, int major,
1548 context->ppid = 0; 1548 context->ppid = 0;
1549} 1549}
1550 1550
1551void audit_finish_fork(struct task_struct *child)
1552{
1553 struct audit_context *ctx = current->audit_context;
1554 struct audit_context *p = child->audit_context;
1555 if (!p || !ctx || !ctx->auditable)
1556 return;
1557 p->arch = ctx->arch;
1558 p->major = ctx->major;
1559 memcpy(p->argv, ctx->argv, sizeof(ctx->argv));
1560 p->ctime = ctx->ctime;
1561 p->dummy = ctx->dummy;
1562 p->auditable = ctx->auditable;
1563 p->in_syscall = ctx->in_syscall;
1564 p->filterkey = kstrdup(ctx->filterkey, GFP_KERNEL);
1565 p->ppid = current->pid;
1566}
1567
1551/** 1568/**
1552 * audit_syscall_exit - deallocate audit context after a system call 1569 * audit_syscall_exit - deallocate audit context after a system call
1553 * @tsk: task being audited 1570 * @tsk: task being audited
diff --git a/kernel/fork.c b/kernel/fork.c
index 2a372a0e206f..8d6a7dd9282b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1398,6 +1398,7 @@ long do_fork(unsigned long clone_flags,
1398 init_completion(&vfork); 1398 init_completion(&vfork);
1399 } 1399 }
1400 1400
1401 audit_finish_fork(p);
1401 tracehook_report_clone(trace, regs, clone_flags, nr, p); 1402 tracehook_report_clone(trace, regs, clone_flags, nr, p);
1402 1403
1403 /* 1404 /*