]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] return records for fork() both to child and parent
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 12 Nov 2008 23:37:41 +0000 (18:37 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Dec 2008 07:27:38 +0000 (02:27 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/audit.h
kernel/auditsc.c
kernel/fork.c

index 6272a395d43c0b73a6ef4fd5d0a19062d6154a38..1b2a6a5c18767fd58d2e13428dbaaecd4748dd33 100644 (file)
@@ -391,6 +391,7 @@ extern int audit_classify_arch(int arch);
 #ifdef CONFIG_AUDITSYSCALL
 /* These are defined in auditsc.c */
                                /* Public API */
+extern void audit_finish_fork(struct task_struct *child);
 extern int  audit_alloc(struct task_struct *task);
 extern void audit_free(struct task_struct *task);
 extern void audit_syscall_entry(int arch,
@@ -504,6 +505,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
 extern int audit_n_rules;
 extern int audit_signals;
 #else
+#define audit_finish_fork(t)
 #define audit_alloc(t) ({ 0; })
 #define audit_free(t) do { ; } while (0)
 #define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
index cf5bc2f5f9c3e527ac2ea72ec019d156be72ecb6..de8468050afae9893ee0173969e4efb8822cc317 100644 (file)
@@ -1548,6 +1548,23 @@ void audit_syscall_entry(int arch, int major,
        context->ppid       = 0;
 }
 
+void audit_finish_fork(struct task_struct *child)
+{
+       struct audit_context *ctx = current->audit_context;
+       struct audit_context *p = child->audit_context;
+       if (!p || !ctx || !ctx->auditable)
+               return;
+       p->arch = ctx->arch;
+       p->major = ctx->major;
+       memcpy(p->argv, ctx->argv, sizeof(ctx->argv));
+       p->ctime = ctx->ctime;
+       p->dummy = ctx->dummy;
+       p->auditable = ctx->auditable;
+       p->in_syscall = ctx->in_syscall;
+       p->filterkey = kstrdup(ctx->filterkey, GFP_KERNEL);
+       p->ppid = current->pid;
+}
+
 /**
  * audit_syscall_exit - deallocate audit context after a system call
  * @tsk: task being audited
index 2a372a0e206fa2de99dbfdd594f86f6eb927bf40..8d6a7dd9282b8308f041d20b18dab139b85c18b3 100644 (file)
@@ -1398,6 +1398,7 @@ long do_fork(unsigned long clone_flags,
                        init_completion(&vfork);
                }
 
+               audit_finish_fork(p);
                tracehook_report_clone(trace, regs, clone_flags, nr, p);
 
                /*