aboutsummaryrefslogtreecommitdiffstats
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:59 -0500
commit6422e78de6880c66a82af512d9bd0c85eb62e661 (patch)
tree9cce4d385a6508056be7645fd3511ab019b346f4
parent7ff68e53ece8c175d2951bb8a30b3cce8f9c5579 (diff)
audit: remove audit_finish_fork as it can't be called
Audit entry,always rules are not allowed and are automatically changed in exit,always rules in userspace. The kernel refuses to load such rules. Thus a task in the middle of a syscall (and thus in audit_finish_fork()) can only be in one of two states: AUDIT_BUILD_CONTEXT or AUDIT_DISABLED. Since the current task cannot be in AUDIT_RECORD_CONTEXT we aren't every going to actually use the code in audit_finish_fork() since it will return without doing anything. Thus drop the code. Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--include/linux/audit.h2
-rw-r--r--kernel/auditsc.c20
-rw-r--r--kernel/fork.c2
3 files changed, 0 insertions, 24 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8eb8bda749b3..67b66c37a254 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -415,7 +415,6 @@ extern int audit_classify_arch(int arch);
415#ifdef CONFIG_AUDITSYSCALL 415#ifdef CONFIG_AUDITSYSCALL
416/* These are defined in auditsc.c */ 416/* These are defined in auditsc.c */
417 /* Public API */ 417 /* Public API */
418extern void audit_finish_fork(struct task_struct *child);
419extern int audit_alloc(struct task_struct *task); 418extern int audit_alloc(struct task_struct *task);
420extern void __audit_free(struct task_struct *task); 419extern void __audit_free(struct task_struct *task);
421extern void __audit_syscall_entry(int arch, 420extern void __audit_syscall_entry(int arch,
@@ -586,7 +585,6 @@ static inline void audit_mmap_fd(int fd, int flags)
586extern int audit_n_rules; 585extern int audit_n_rules;
587extern int audit_signals; 586extern int audit_signals;
588#else /* CONFIG_AUDITSYSCALL */ 587#else /* CONFIG_AUDITSYSCALL */
589#define audit_finish_fork(t)
590#define audit_alloc(t) ({ 0; }) 588#define audit_alloc(t) ({ 0; })
591#define audit_free(t) do { ; } while (0) 589#define audit_free(t) do { ; } while (0)
592#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 590#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 7aaeb38b262a..4d8920f5ab88 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1707,26 +1707,6 @@ void __audit_syscall_entry(int arch, int major,
1707 context->ppid = 0; 1707 context->ppid = 0;
1708} 1708}
1709 1709
1710void audit_finish_fork(struct task_struct *child)
1711{
1712 struct audit_context *ctx = current->audit_context;
1713 struct audit_context *p = child->audit_context;
1714 if (!p || !ctx)
1715 return;
1716 if (!ctx->in_syscall || ctx->current_state != AUDIT_RECORD_CONTEXT)
1717 return;
1718 p->arch = ctx->arch;
1719 p->major = ctx->major;
1720 memcpy(p->argv, ctx->argv, sizeof(ctx->argv));
1721 p->ctime = ctx->ctime;
1722 p->dummy = ctx->dummy;
1723 p->in_syscall = ctx->in_syscall;
1724 p->filterkey = kstrdup(ctx->filterkey, GFP_KERNEL);
1725 p->ppid = current->pid;
1726 p->prio = ctx->prio;
1727 p->current_state = ctx->current_state;
1728}
1729
1730/** 1710/**
1731 * audit_syscall_exit - deallocate audit context after a system call 1711 * audit_syscall_exit - deallocate audit context after a system call
1732 * @pt_regs: syscall registers 1712 * @pt_regs: syscall registers
diff --git a/kernel/fork.c b/kernel/fork.c
index 443f5125f11e..c1e5c21f48c1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1525,8 +1525,6 @@ long do_fork(unsigned long clone_flags,
1525 init_completion(&vfork); 1525 init_completion(&vfork);
1526 } 1526 }
1527 1527
1528 audit_finish_fork(p);
1529
1530 /* 1528 /*
1531 * We set PF_STARTING at creation in case tracing wants to 1529 * We set PF_STARTING at creation in case tracing wants to
1532 * use this to distinguish a fully live task from one that 1530 * use this to distinguish a fully live task from one that