aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-19 19:25:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-19 19:25:56 -0400
commitab074ade9c33b3585da86d62e87bcb3e897a3f54 (patch)
tree142b42182889c64813af997b8701707a3397e834
parent61ed53deb1c6a4386d8710dbbfcee8779c381931 (diff)
parent2991dd2b0117e864f394c826af6df144206ce0db (diff)
Merge git://git.infradead.org/users/eparis/audit
Pull audit updates from Eric Paris: "So this change across a whole bunch of arches really solves one basic problem. We want to audit when seccomp is killing a process. seccomp hooks in before the audit syscall entry code. audit_syscall_entry took as an argument the arch of the given syscall. Since the arch is part of what makes a syscall number meaningful it's an important part of the record, but it isn't available when seccomp shoots the syscall... For most arch's we have a better way to get the arch (syscall_get_arch) So the solution was two fold: Implement syscall_get_arch() everywhere there is audit which didn't have it. Use syscall_get_arch() in the seccomp audit code. Having syscall_get_arch() everywhere meant it was a useless flag on the stack and we could get rid of it for the typical syscall entry. The other changes inside the audit system aren't grand, fixed some records that had invalid spaces. Better locking around the task comm field. Removing some dead functions and structs. Make some things static. Really minor stuff" * git://git.infradead.org/users/eparis/audit: (31 commits) audit: rename audit_log_remove_rule to disambiguate for trees audit: cull redundancy in audit_rule_change audit: WARN if audit_rule_change called illegally audit: put rule existence check in canonical order next: openrisc: Fix build audit: get comm using lock to avoid race in string printing audit: remove open_arg() function that is never used audit: correct AUDIT_GET_FEATURE return message type audit: set nlmsg_len for multicast messages. audit: use union for audit_field values since they are mutually exclusive audit: invalid op= values for rules audit: use atomic_t to simplify audit_serial() kernel/audit.c: use ARRAY_SIZE instead of sizeof/sizeof[0] audit: reduce scope of audit_log_fcaps audit: reduce scope of audit_net_id audit: arm64: Remove the audit arch argument to audit_syscall_entry arm64: audit: Add audit hook in syscall_trace_enter/exit() audit: x86: drop arch from __audit_syscall_entry() interface sparc: implement is_32bit_task sparc: properly conditionalize use of TIF_32BIT ...
-rw-r--r--arch/alpha/include/asm/syscall.h11
-rw-r--r--arch/alpha/kernel/ptrace.c2
-rw-r--r--arch/arm/kernel/ptrace.c4
-rw-r--r--arch/arm64/kernel/ptrace.c4
-rw-r--r--arch/ia64/include/asm/syscall.h6
-rw-r--r--arch/ia64/kernel/ptrace.c2
-rw-r--r--arch/microblaze/include/asm/syscall.h5
-rw-r--r--arch/microblaze/kernel/ptrace.c3
-rw-r--r--arch/mips/include/asm/syscall.h2
-rw-r--r--arch/mips/kernel/ptrace.c4
-rw-r--r--arch/openrisc/include/asm/syscall.h5
-rw-r--r--arch/openrisc/include/uapi/asm/elf.h3
-rw-r--r--arch/openrisc/kernel/ptrace.c3
-rw-r--r--arch/parisc/include/asm/syscall.h11
-rw-r--r--arch/parisc/kernel/ptrace.c9
-rw-r--r--arch/powerpc/include/asm/syscall.h6
-rw-r--r--arch/powerpc/kernel/ptrace.c7
-rw-r--r--arch/s390/kernel/ptrace.c4
-rw-r--r--arch/sh/include/asm/syscall_32.h10
-rw-r--r--arch/sh/include/asm/syscall_64.h14
-rw-r--r--arch/sh/kernel/ptrace_32.c14
-rw-r--r--arch/sh/kernel/ptrace_64.c17
-rw-r--r--arch/sparc/include/asm/syscall.h7
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h2
-rw-r--r--arch/sparc/kernel/ptrace_64.c9
-rw-r--r--arch/um/kernel/ptrace.c3
-rw-r--r--arch/x86/ia32/ia32entry.S12
-rw-r--r--arch/x86/kernel/entry_32.S11
-rw-r--r--arch/x86/kernel/ptrace.c4
-rw-r--r--arch/x86/um/asm/ptrace.h4
-rw-r--r--arch/x86/um/asm/syscall.h15
-rw-r--r--arch/xtensa/kernel/ptrace.c2
-rw-r--r--include/asm-generic/syscall.h2
-rw-r--r--include/linux/audit.h25
-rw-r--r--include/uapi/linux/audit.h14
-rw-r--r--include/uapi/linux/elf-em.h1
-rw-r--r--kernel/audit.c30
-rw-r--r--kernel/audit.h1
-rw-r--r--kernel/audit_tree.c6
-rw-r--r--kernel/audit_watch.c4
-rw-r--r--kernel/auditfilter.c56
-rw-r--r--kernel/auditsc.c28
43 files changed, 204 insertions, 180 deletions
diff --git a/arch/alpha/include/asm/syscall.h b/arch/alpha/include/asm/syscall.h
new file mode 100644
index 000000000000..88d28eb2a566
--- /dev/null
+++ b/arch/alpha/include/asm/syscall.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_ALPHA_SYSCALL_H
2#define _ASM_ALPHA_SYSCALL_H
3
4#include <uapi/linux/audit.h>
5
6static inline int syscall_get_arch(void)
7{
8 return AUDIT_ARCH_ALPHA;
9}
10
11#endif /* _ASM_ALPHA_SYSCALL_H */
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index 86d835157b54..d9ee81769899 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -321,7 +321,7 @@ asmlinkage unsigned long syscall_trace_enter(void)
321 if (test_thread_flag(TIF_SYSCALL_TRACE) && 321 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
322 tracehook_report_syscall_entry(current_pt_regs())) 322 tracehook_report_syscall_entry(current_pt_regs()))
323 ret = -1UL; 323 ret = -1UL;
324 audit_syscall_entry(AUDIT_ARCH_ALPHA, regs->r0, regs->r16, regs->r17, regs->r18, regs->r19); 324 audit_syscall_entry(regs->r0, regs->r16, regs->r17, regs->r18, regs->r19);
325 return ret ?: current_pt_regs()->r0; 325 return ret ?: current_pt_regs()->r0;
326} 326}
327 327
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 5e772a21ab97..ef9119f7462e 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -949,8 +949,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
949 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 949 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
950 trace_sys_enter(regs, scno); 950 trace_sys_enter(regs, scno);
951 951
952 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 952 audit_syscall_entry(scno, regs->ARM_r0, regs->ARM_r1, regs->ARM_r2,
953 regs->ARM_r2, regs->ARM_r3); 953 regs->ARM_r3);
954 954
955 return scno; 955 return scno;
956} 956}
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index fe63ac5e9bf5..8a4ae8e73213 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1120,8 +1120,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1120 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 1120 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1121 trace_sys_enter(regs, regs->syscallno); 1121 trace_sys_enter(regs, regs->syscallno);
1122 1122
1123 audit_syscall_entry(syscall_get_arch(), regs->syscallno, 1123 audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
1124 regs->orig_x0, regs->regs[1], regs->regs[2], regs->regs[3]); 1124 regs->regs[2], regs->regs[3]);
1125 1125
1126 return regs->syscallno; 1126 return regs->syscallno;
1127} 1127}
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index a7ff1c6ab068..1d0b875fec44 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -13,6 +13,7 @@
13#ifndef _ASM_SYSCALL_H 13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1 14#define _ASM_SYSCALL_H 1
15 15
16#include <uapi/linux/audit.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
17#include <linux/err.h> 18#include <linux/err.h>
18 19
@@ -79,4 +80,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
79 80
80 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1); 81 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
81} 82}
83
84static inline int syscall_get_arch(void)
85{
86 return AUDIT_ARCH_IA64;
87}
82#endif /* _ASM_SYSCALL_H */ 88#endif /* _ASM_SYSCALL_H */
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index b7a5fffe0924..6f54d511cc50 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1219,7 +1219,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1219 ia64_sync_krbs(); 1219 ia64_sync_krbs();
1220 1220
1221 1221
1222 audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3); 1222 audit_syscall_entry(regs.r15, arg0, arg1, arg2, arg3);
1223 1223
1224 return 0; 1224 return 0;
1225} 1225}
diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index 9bc431783105..53cfaf34c343 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_MICROBLAZE_SYSCALL_H 1#ifndef __ASM_MICROBLAZE_SYSCALL_H
2#define __ASM_MICROBLAZE_SYSCALL_H 2#define __ASM_MICROBLAZE_SYSCALL_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
@@ -99,4 +100,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
99asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 100asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
100asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 101asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
101 102
103static inline int syscall_get_arch(void)
104{
105 return AUDIT_ARCH_MICROBLAZE;
106}
102#endif /* __ASM_MICROBLAZE_SYSCALL_H */ 107#endif /* __ASM_MICROBLAZE_SYSCALL_H */
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index 39cf50841f6d..bb10637ce688 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -147,8 +147,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
147 */ 147 */
148 ret = -1L; 148 ret = -1L;
149 149
150 audit_syscall_entry(EM_MICROBLAZE, regs->r12, regs->r5, regs->r6, 150 audit_syscall_entry(regs->r12, regs->r5, regs->r6, regs->r7, regs->r8);
151 regs->r7, regs->r8);
152 151
153 return ret ?: regs->r12; 152 return ret ?: regs->r12;
154} 153}
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index cdf68b33bd65..bb7963753730 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -129,7 +129,7 @@ extern const unsigned long sysn32_call_table[];
129 129
130static inline int syscall_get_arch(void) 130static inline int syscall_get_arch(void)
131{ 131{
132 int arch = EM_MIPS; 132 int arch = AUDIT_ARCH_MIPS;
133#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
134 if (!test_thread_flag(TIF_32BIT_REGS)) { 134 if (!test_thread_flag(TIF_32BIT_REGS)) {
135 arch |= __AUDIT_ARCH_64BIT; 135 arch |= __AUDIT_ARCH_64BIT;
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index f7aac5b57b4b..9d1487d83293 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -780,9 +780,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
780 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 780 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
781 trace_sys_enter(regs, regs->regs[2]); 781 trace_sys_enter(regs, regs->regs[2]);
782 782
783 audit_syscall_entry(syscall_get_arch(), 783 audit_syscall_entry(syscall, regs->regs[4], regs->regs[5],
784 syscall,
785 regs->regs[4], regs->regs[5],
786 regs->regs[6], regs->regs[7]); 784 regs->regs[6], regs->regs[7]);
787 return syscall; 785 return syscall;
788} 786}
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index b752bb67891d..2db9f1cf0694 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -19,6 +19,7 @@
19#ifndef __ASM_OPENRISC_SYSCALL_H__ 19#ifndef __ASM_OPENRISC_SYSCALL_H__
20#define __ASM_OPENRISC_SYSCALL_H__ 20#define __ASM_OPENRISC_SYSCALL_H__
21 21
22#include <uapi/linux/audit.h>
22#include <linux/err.h> 23#include <linux/err.h>
23#include <linux/sched.h> 24#include <linux/sched.h>
24 25
@@ -71,4 +72,8 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
71 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 72 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
72} 73}
73 74
75static inline int syscall_get_arch(void)
76{
77 return AUDIT_ARCH_OPENRISC;
78}
74#endif 79#endif
diff --git a/arch/openrisc/include/uapi/asm/elf.h b/arch/openrisc/include/uapi/asm/elf.h
index f02ea5830420..88842760e66f 100644
--- a/arch/openrisc/include/uapi/asm/elf.h
+++ b/arch/openrisc/include/uapi/asm/elf.h
@@ -55,9 +55,8 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
55/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */ 55/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
56typedef unsigned long elf_fpregset_t; 56typedef unsigned long elf_fpregset_t;
57 57
58/* This should be moved to include/linux/elf.h */ 58/* EM_OPENRISC is defined in linux/elf-em.h */
59#define EM_OR32 0x8472 59#define EM_OR32 0x8472
60#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
61 60
62/* 61/*
63 * These are used to set parameters in the core dumps. 62 * These are used to set parameters in the core dumps.
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 71a2a0c34c65..4f59fa4e34e5 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -187,8 +187,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
187 */ 187 */
188 ret = -1L; 188 ret = -1L;
189 189
190 audit_syscall_entry(AUDIT_ARCH_OPENRISC, regs->gpr[11], 190 audit_syscall_entry(regs->gpr[11], regs->gpr[3], regs->gpr[4],
191 regs->gpr[3], regs->gpr[4],
192 regs->gpr[5], regs->gpr[6]); 191 regs->gpr[5], regs->gpr[6]);
193 192
194 return ret ? : regs->gpr[11]; 193 return ret ? : regs->gpr[11];
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 8bdfd2c8c39f..a5eba95d87fe 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -3,6 +3,8 @@
3#ifndef _ASM_PARISC_SYSCALL_H_ 3#ifndef _ASM_PARISC_SYSCALL_H_
4#define _ASM_PARISC_SYSCALL_H_ 4#define _ASM_PARISC_SYSCALL_H_
5 5
6#include <uapi/linux/audit.h>
7#include <linux/compat.h>
6#include <linux/err.h> 8#include <linux/err.h>
7#include <asm/ptrace.h> 9#include <asm/ptrace.h>
8 10
@@ -37,4 +39,13 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
37 } 39 }
38} 40}
39 41
42static inline int syscall_get_arch(void)
43{
44 int arch = AUDIT_ARCH_PARISC;
45#ifdef CONFIG_64BIT
46 if (!is_compat_task())
47 arch = AUDIT_ARCH_PARISC64;
48#endif
49 return arch;
50}
40#endif /*_ASM_PARISC_SYSCALL_H_*/ 51#endif /*_ASM_PARISC_SYSCALL_H_*/
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 92438c21d453..9585c81f755f 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -280,14 +280,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
280 280
281#ifdef CONFIG_64BIT 281#ifdef CONFIG_64BIT
282 if (!is_compat_task()) 282 if (!is_compat_task())
283 audit_syscall_entry(AUDIT_ARCH_PARISC64, 283 audit_syscall_entry(regs->gr[20], regs->gr[26], regs->gr[25],
284 regs->gr[20], 284 regs->gr[24], regs->gr[23]);
285 regs->gr[26], regs->gr[25],
286 regs->gr[24], regs->gr[23]);
287 else 285 else
288#endif 286#endif
289 audit_syscall_entry(AUDIT_ARCH_PARISC, 287 audit_syscall_entry(regs->gr[20] & 0xffffffff,
290 regs->gr[20] & 0xffffffff,
291 regs->gr[26] & 0xffffffff, 288 regs->gr[26] & 0xffffffff,
292 regs->gr[25] & 0xffffffff, 289 regs->gr[25] & 0xffffffff,
293 regs->gr[24] & 0xffffffff, 290 regs->gr[24] & 0xffffffff,
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index b54b2add07be..6fa2708da153 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -13,7 +13,9 @@
13#ifndef _ASM_SYSCALL_H 13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1 14#define _ASM_SYSCALL_H 1
15 15
16#include <uapi/linux/audit.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/thread_info.h>
17 19
18/* ftrace syscalls requires exporting the sys_call_table */ 20/* ftrace syscalls requires exporting the sys_call_table */
19#ifdef CONFIG_FTRACE_SYSCALLS 21#ifdef CONFIG_FTRACE_SYSCALLS
@@ -86,4 +88,8 @@ static inline void syscall_set_arguments(struct task_struct *task,
86 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 88 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
87} 89}
88 90
91static inline int syscall_get_arch(void)
92{
93 return is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64;
94}
89#endif /* _ASM_SYSCALL_H */ 95#endif /* _ASM_SYSCALL_H */
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index cdb404ea3468..f21897b42057 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1788,14 +1788,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1788 1788
1789#ifdef CONFIG_PPC64 1789#ifdef CONFIG_PPC64
1790 if (!is_32bit_task()) 1790 if (!is_32bit_task())
1791 audit_syscall_entry(AUDIT_ARCH_PPC64, 1791 audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
1792 regs->gpr[0],
1793 regs->gpr[3], regs->gpr[4],
1794 regs->gpr[5], regs->gpr[6]); 1792 regs->gpr[5], regs->gpr[6]);
1795 else 1793 else
1796#endif 1794#endif
1797 audit_syscall_entry(AUDIT_ARCH_PPC, 1795 audit_syscall_entry(regs->gpr[0],
1798 regs->gpr[0],
1799 regs->gpr[3] & 0xffffffff, 1796 regs->gpr[3] & 0xffffffff,
1800 regs->gpr[4] & 0xffffffff, 1797 regs->gpr[4] & 0xffffffff,
1801 regs->gpr[5] & 0xffffffff, 1798 regs->gpr[5] & 0xffffffff,
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f537e937a988..99a567b70d16 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -834,9 +834,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
834 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 834 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
835 trace_sys_enter(regs, regs->gprs[2]); 835 trace_sys_enter(regs, regs->gprs[2]);
836 836
837 audit_syscall_entry(is_compat_task() ? 837 audit_syscall_entry(regs->gprs[2], regs->orig_gpr2,
838 AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
839 regs->gprs[2], regs->orig_gpr2,
840 regs->gprs[3], regs->gprs[4], 838 regs->gprs[3], regs->gprs[4],
841 regs->gprs[5]); 839 regs->gprs[5]);
842out: 840out:
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 7d80df4f09cb..95be3b0ce0ac 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_SYSCALL_32_H 1#ifndef __ASM_SH_SYSCALL_32_H
2#define __ASM_SH_SYSCALL_32_H 2#define __ASM_SH_SYSCALL_32_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <linux/err.h> 7#include <linux/err.h>
@@ -93,4 +94,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
93 } 94 }
94} 95}
95 96
97static inline int syscall_get_arch(void)
98{
99 int arch = AUDIT_ARCH_SH;
100
101#ifdef CONFIG_CPU_LITTLE_ENDIAN
102 arch |= __AUDIT_ARCH_LE;
103#endif
104 return arch;
105}
96#endif /* __ASM_SH_SYSCALL_32_H */ 106#endif /* __ASM_SH_SYSCALL_32_H */
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index c3561ca72bee..c6a797b90b80 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_SYSCALL_64_H 1#ifndef __ASM_SH_SYSCALL_64_H
2#define __ASM_SH_SYSCALL_64_H 2#define __ASM_SH_SYSCALL_64_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
@@ -61,4 +62,17 @@ static inline void syscall_set_arguments(struct task_struct *task,
61 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0])); 62 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
62} 63}
63 64
65static inline int syscall_get_arch(void)
66{
67 int arch = AUDIT_ARCH_SH;
68
69#ifdef CONFIG_64BIT
70 arch |= __AUDIT_ARCH_64BIT;
71#endif
72#ifdef CONFIG_CPU_LITTLE_ENDIAN
73 arch |= __AUDIT_ARCH_LE;
74#endif
75
76 return arch;
77}
64#endif /* __ASM_SH_SYSCALL_64_H */ 78#endif /* __ASM_SH_SYSCALL_64_H */
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 668c81631c08..c1a6b89bfe70 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -484,17 +484,6 @@ long arch_ptrace(struct task_struct *child, long request,
484 return ret; 484 return ret;
485} 485}
486 486
487static inline int audit_arch(void)
488{
489 int arch = EM_SH;
490
491#ifdef CONFIG_CPU_LITTLE_ENDIAN
492 arch |= __AUDIT_ARCH_LE;
493#endif
494
495 return arch;
496}
497
498asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 487asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
499{ 488{
500 long ret = 0; 489 long ret = 0;
@@ -513,8 +502,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
513 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 502 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
514 trace_sys_enter(regs, regs->regs[0]); 503 trace_sys_enter(regs, regs->regs[0]);
515 504
516 audit_syscall_entry(audit_arch(), regs->regs[3], 505 audit_syscall_entry(regs->regs[3], regs->regs[4], regs->regs[5],
517 regs->regs[4], regs->regs[5],
518 regs->regs[6], regs->regs[7]); 506 regs->regs[6], regs->regs[7]);
519 507
520 return ret ?: regs->regs[0]; 508 return ret ?: regs->regs[0];
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index af90339dadcd..5cea973a65b2 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -504,20 +504,6 @@ asmlinkage int sh64_ptrace(long request, long pid,
504 return sys_ptrace(request, pid, addr, data); 504 return sys_ptrace(request, pid, addr, data);
505} 505}
506 506
507static inline int audit_arch(void)
508{
509 int arch = EM_SH;
510
511#ifdef CONFIG_64BIT
512 arch |= __AUDIT_ARCH_64BIT;
513#endif
514#ifdef CONFIG_CPU_LITTLE_ENDIAN
515 arch |= __AUDIT_ARCH_LE;
516#endif
517
518 return arch;
519}
520
521asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs) 507asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
522{ 508{
523 long long ret = 0; 509 long long ret = 0;
@@ -536,8 +522,7 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
536 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 522 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
537 trace_sys_enter(regs, regs->regs[9]); 523 trace_sys_enter(regs, regs->regs[9]);
538 524
539 audit_syscall_entry(audit_arch(), regs->regs[1], 525 audit_syscall_entry(regs->regs[1], regs->regs[2], regs->regs[3],
540 regs->regs[2], regs->regs[3],
541 regs->regs[4], regs->regs[5]); 526 regs->regs[4], regs->regs[5]);
542 527
543 return ret ?: regs->regs[9]; 528 return ret ?: regs->regs[9];
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 025a02ad2e31..49f71fd5b56e 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -1,9 +1,11 @@
1#ifndef __ASM_SPARC_SYSCALL_H 1#ifndef __ASM_SPARC_SYSCALL_H
2#define __ASM_SPARC_SYSCALL_H 2#define __ASM_SPARC_SYSCALL_H
3 3
4#include <uapi/linux/audit.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/sched.h> 6#include <linux/sched.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8#include <asm/thread_info.h>
7 9
8/* 10/*
9 * The syscall table always contains 32 bit pointers since we know that the 11 * The syscall table always contains 32 bit pointers since we know that the
@@ -124,4 +126,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
124 regs->u_regs[UREG_I0 + i + j] = args[j]; 126 regs->u_regs[UREG_I0 + i + j] = args[j];
125} 127}
126 128
129static inline int syscall_get_arch(void)
130{
131 return is_32bit_task() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
132}
133
127#endif /* __ASM_SPARC_SYSCALL_H */ 134#endif /* __ASM_SPARC_SYSCALL_H */
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 96efa7adc223..025c98446b1e 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -130,6 +130,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
130#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ 130#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
131 _TIF_SIGPENDING) 131 _TIF_SIGPENDING)
132 132
133#define is_32bit_task() (1)
134
133#endif /* __KERNEL__ */ 135#endif /* __KERNEL__ */
134 136
135#endif /* _ASM_THREAD_INFO_H */ 137#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index cc6275c931a5..798f0279a4b5 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -221,6 +221,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
221 _TIF_NEED_RESCHED) 221 _TIF_NEED_RESCHED)
222#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING) 222#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
223 223
224#define is_32bit_task() (test_thread_flag(TIF_32BIT))
225
224/* 226/*
225 * Thread-synchronous status. 227 * Thread-synchronous status.
226 * 228 *
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index c13c9f25d83a..9ddc4928a089 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -1076,13 +1076,8 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1076 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1076 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1077 trace_sys_enter(regs, regs->u_regs[UREG_G1]); 1077 trace_sys_enter(regs, regs->u_regs[UREG_G1]);
1078 1078
1079 audit_syscall_entry((test_thread_flag(TIF_32BIT) ? 1079 audit_syscall_entry(regs->u_regs[UREG_G1], regs->u_regs[UREG_I0],
1080 AUDIT_ARCH_SPARC : 1080 regs->u_regs[UREG_I1], regs->u_regs[UREG_I2],
1081 AUDIT_ARCH_SPARC64),
1082 regs->u_regs[UREG_G1],
1083 regs->u_regs[UREG_I0],
1084 regs->u_regs[UREG_I1],
1085 regs->u_regs[UREG_I2],
1086 regs->u_regs[UREG_I3]); 1081 regs->u_regs[UREG_I3]);
1087 1082
1088 return ret; 1083 return ret;
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 694d551c8899..62435ef003d9 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -165,8 +165,7 @@ static void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
165 */ 165 */
166void syscall_trace_enter(struct pt_regs *regs) 166void syscall_trace_enter(struct pt_regs *regs)
167{ 167{
168 audit_syscall_entry(HOST_AUDIT_ARCH, 168 audit_syscall_entry(UPT_SYSCALL_NR(&regs->regs),
169 UPT_SYSCALL_NR(&regs->regs),
170 UPT_SYSCALL_ARG1(&regs->regs), 169 UPT_SYSCALL_ARG1(&regs->regs),
171 UPT_SYSCALL_ARG2(&regs->regs), 170 UPT_SYSCALL_ARG2(&regs->regs),
172 UPT_SYSCALL_ARG3(&regs->regs), 171 UPT_SYSCALL_ARG3(&regs->regs),
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 711de084ab57..8ffba18395c8 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -198,12 +198,12 @@ sysexit_from_sys_call:
198 198
199#ifdef CONFIG_AUDITSYSCALL 199#ifdef CONFIG_AUDITSYSCALL
200 .macro auditsys_entry_common 200 .macro auditsys_entry_common
201 movl %esi,%r9d /* 6th arg: 4th syscall arg */ 201 movl %esi,%r8d /* 5th arg: 4th syscall arg */
202 movl %edx,%r8d /* 5th arg: 3rd syscall arg */ 202 movl %ecx,%r9d /*swap with edx*/
203 /* (already in %ecx) 4th arg: 2nd syscall arg */ 203 movl %edx,%ecx /* 4th arg: 3rd syscall arg */
204 movl %ebx,%edx /* 3rd arg: 1st syscall arg */ 204 movl %r9d,%edx /* 3rd arg: 2nd syscall arg */
205 movl %eax,%esi /* 2nd arg: syscall number */ 205 movl %ebx,%esi /* 2nd arg: 1st syscall arg */
206 movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ 206 movl %eax,%edi /* 1st arg: syscall number */
207 call __audit_syscall_entry 207 call __audit_syscall_entry
208 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ 208 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
209 cmpq $(IA32_NR_syscalls-1),%rax 209 cmpq $(IA32_NR_syscalls-1),%rax
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 4b0e1dfa2226..b553ed89e5f5 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -449,12 +449,11 @@ sysenter_audit:
449 jnz syscall_trace_entry 449 jnz syscall_trace_entry
450 addl $4,%esp 450 addl $4,%esp
451 CFI_ADJUST_CFA_OFFSET -4 451 CFI_ADJUST_CFA_OFFSET -4
452 /* %esi already in 8(%esp) 6th arg: 4th syscall arg */ 452 movl %esi,4(%esp) /* 5th arg: 4th syscall arg */
453 /* %edx already in 4(%esp) 5th arg: 3rd syscall arg */ 453 movl %edx,(%esp) /* 4th arg: 3rd syscall arg */
454 /* %ecx already in 0(%esp) 4th arg: 2nd syscall arg */ 454 /* %ecx already in %ecx 3rd arg: 2nd syscall arg */
455 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */ 455 movl %ebx,%edx /* 2nd arg: 1st syscall arg */
456 movl %eax,%edx /* 2nd arg: syscall number */ 456 /* %eax already in %eax 1st arg: syscall number */
457 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
458 call __audit_syscall_entry 457 call __audit_syscall_entry
459 pushl_cfi %ebx 458 pushl_cfi %ebx
460 movl PT_EAX(%esp),%eax /* reload syscall number */ 459 movl PT_EAX(%esp),%eax /* reload syscall number */
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 29576c244699..749b0e423419 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1445,12 +1445,12 @@ static void do_audit_syscall_entry(struct pt_regs *regs, u32 arch)
1445{ 1445{
1446#ifdef CONFIG_X86_64 1446#ifdef CONFIG_X86_64
1447 if (arch == AUDIT_ARCH_X86_64) { 1447 if (arch == AUDIT_ARCH_X86_64) {
1448 audit_syscall_entry(arch, regs->orig_ax, regs->di, 1448 audit_syscall_entry(regs->orig_ax, regs->di,
1449 regs->si, regs->dx, regs->r10); 1449 regs->si, regs->dx, regs->r10);
1450 } else 1450 } else
1451#endif 1451#endif
1452 { 1452 {
1453 audit_syscall_entry(arch, regs->orig_ax, regs->bx, 1453 audit_syscall_entry(regs->orig_ax, regs->bx,
1454 regs->cx, regs->dx, regs->si); 1454 regs->cx, regs->dx, regs->si);
1455 } 1455 }
1456} 1456}
diff --git a/arch/x86/um/asm/ptrace.h b/arch/x86/um/asm/ptrace.h
index 54f8102ccde5..e59eef20647b 100644
--- a/arch/x86/um/asm/ptrace.h
+++ b/arch/x86/um/asm/ptrace.h
@@ -47,8 +47,6 @@ struct user_desc;
47 47
48#ifdef CONFIG_X86_32 48#ifdef CONFIG_X86_32
49 49
50#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
51
52extern int ptrace_get_thread_area(struct task_struct *child, int idx, 50extern int ptrace_get_thread_area(struct task_struct *child, int idx,
53 struct user_desc __user *user_desc); 51 struct user_desc __user *user_desc);
54 52
@@ -57,8 +55,6 @@ extern int ptrace_set_thread_area(struct task_struct *child, int idx,
57 55
58#else 56#else
59 57
60#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
61
62#define PT_REGS_R8(r) UPT_R8(&(r)->regs) 58#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
63#define PT_REGS_R9(r) UPT_R9(&(r)->regs) 59#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
64#define PT_REGS_R10(r) UPT_R10(&(r)->regs) 60#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
diff --git a/arch/x86/um/asm/syscall.h b/arch/x86/um/asm/syscall.h
new file mode 100644
index 000000000000..9fe77b7b5a0e
--- /dev/null
+++ b/arch/x86/um/asm/syscall.h
@@ -0,0 +1,15 @@
1#ifndef __UM_ASM_SYSCALL_H
2#define __UM_ASM_SYSCALL_H
3
4#include <uapi/linux/audit.h>
5
6static inline int syscall_get_arch(void)
7{
8#ifdef CONFIG_X86_32
9 return AUDIT_ARCH_I386;
10#else
11 return AUDIT_ARCH_X86_64;
12#endif
13}
14
15#endif /* __UM_ASM_SYSCALL_H */
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 562fac664751..4d54b481123b 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -342,7 +342,7 @@ void do_syscall_trace_enter(struct pt_regs *regs)
342 do_syscall_trace(); 342 do_syscall_trace();
343 343
344#if 0 344#if 0
345 audit_syscall_entry(current, AUDIT_ARCH_XTENSA..); 345 audit_syscall_entry(...);
346#endif 346#endif
347} 347}
348 348
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index d401e5463fb0..0c938a4354f6 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -147,7 +147,7 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
147 * 147 *
148 * Returns the AUDIT_ARCH_* based on the system call convention in use. 148 * Returns the AUDIT_ARCH_* based on the system call convention in use.
149 * 149 *
150 * It's only valid to call this when @task is stopped on entry to a system 150 * It's only valid to call this when current is stopped on entry to a system
151 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP. 151 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
152 * 152 *
153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must 153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22cfddb75566..36dffeccebdb 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -66,12 +66,16 @@ struct audit_krule {
66 66
67struct audit_field { 67struct audit_field {
68 u32 type; 68 u32 type;
69 u32 val; 69 union {
70 kuid_t uid; 70 u32 val;
71 kgid_t gid; 71 kuid_t uid;
72 kgid_t gid;
73 struct {
74 char *lsm_str;
75 void *lsm_rule;
76 };
77 };
72 u32 op; 78 u32 op;
73 char *lsm_str;
74 void *lsm_rule;
75}; 79};
76 80
77extern int is_audit_feature_set(int which); 81extern int is_audit_feature_set(int which);
@@ -109,12 +113,13 @@ extern void audit_log_session_info(struct audit_buffer *ab);
109#endif 113#endif
110 114
111#ifdef CONFIG_AUDITSYSCALL 115#ifdef CONFIG_AUDITSYSCALL
116#include <asm/syscall.h> /* for syscall_get_arch() */
117
112/* These are defined in auditsc.c */ 118/* These are defined in auditsc.c */
113 /* Public API */ 119 /* Public API */
114extern int audit_alloc(struct task_struct *task); 120extern int audit_alloc(struct task_struct *task);
115extern void __audit_free(struct task_struct *task); 121extern void __audit_free(struct task_struct *task);
116extern void __audit_syscall_entry(int arch, 122extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
117 int major, unsigned long a0, unsigned long a1,
118 unsigned long a2, unsigned long a3); 123 unsigned long a2, unsigned long a3);
119extern void __audit_syscall_exit(int ret_success, long ret_value); 124extern void __audit_syscall_exit(int ret_success, long ret_value);
120extern struct filename *__audit_reusename(const __user char *uptr); 125extern struct filename *__audit_reusename(const __user char *uptr);
@@ -141,12 +146,12 @@ static inline void audit_free(struct task_struct *task)
141 if (unlikely(task->audit_context)) 146 if (unlikely(task->audit_context))
142 __audit_free(task); 147 __audit_free(task);
143} 148}
144static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 149static inline void audit_syscall_entry(int major, unsigned long a0,
145 unsigned long a1, unsigned long a2, 150 unsigned long a1, unsigned long a2,
146 unsigned long a3) 151 unsigned long a3)
147{ 152{
148 if (unlikely(current->audit_context)) 153 if (unlikely(current->audit_context))
149 __audit_syscall_entry(arch, major, a0, a1, a2, a3); 154 __audit_syscall_entry(major, a0, a1, a2, a3);
150} 155}
151static inline void audit_syscall_exit(void *pt_regs) 156static inline void audit_syscall_exit(void *pt_regs)
152{ 157{
@@ -322,7 +327,7 @@ static inline int audit_alloc(struct task_struct *task)
322} 327}
323static inline void audit_free(struct task_struct *task) 328static inline void audit_free(struct task_struct *task)
324{ } 329{ }
325static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 330static inline void audit_syscall_entry(int major, unsigned long a0,
326 unsigned long a1, unsigned long a2, 331 unsigned long a1, unsigned long a2,
327 unsigned long a3) 332 unsigned long a3)
328{ } 333{ }
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 3b9ff33e1768..d4dbef14d4df 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -352,6 +352,7 @@ enum {
352#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 352#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
353#define AUDIT_ARCH_M32R (EM_M32R) 353#define AUDIT_ARCH_M32R (EM_M32R)
354#define AUDIT_ARCH_M68K (EM_68K) 354#define AUDIT_ARCH_M68K (EM_68K)
355#define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE)
355#define AUDIT_ARCH_MIPS (EM_MIPS) 356#define AUDIT_ARCH_MIPS (EM_MIPS)
356#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) 357#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
357#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) 358#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
@@ -445,17 +446,4 @@ struct audit_rule_data {
445 char buf[0]; /* string fields buffer */ 446 char buf[0]; /* string fields buffer */
446}; 447};
447 448
448/* audit_rule is supported to maintain backward compatibility with
449 * userspace. It supports integer fields only and corresponds to
450 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
451 */
452struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
453 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
454 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
455 __u32 field_count;
456 __u32 mask[AUDIT_BITMASK_SIZE];
457 __u32 fields[AUDIT_MAX_FIELDS];
458 __u32 values[AUDIT_MAX_FIELDS];
459};
460
461#endif /* _UAPI_LINUX_AUDIT_H_ */ 449#endif /* _UAPI_LINUX_AUDIT_H_ */
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 01529bd96438..aa90bc98b6e2 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -32,6 +32,7 @@
32#define EM_V850 87 /* NEC v850 */ 32#define EM_V850 87 /* NEC v850 */
33#define EM_M32R 88 /* Renesas M32R */ 33#define EM_M32R 88 /* Renesas M32R */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */ 37#define EM_TI_C6000 140 /* TI C6X DSPs */
37#define EM_AARCH64 183 /* ARM 64 bit */ 38#define EM_AARCH64 183 /* ARM 64 bit */
diff --git a/kernel/audit.c b/kernel/audit.c
index ba2ff5a5c600..80983df92cd4 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -126,7 +126,7 @@ static atomic_t audit_lost = ATOMIC_INIT(0);
126 126
127/* The netlink socket. */ 127/* The netlink socket. */
128static struct sock *audit_sock; 128static struct sock *audit_sock;
129int audit_net_id; 129static int audit_net_id;
130 130
131/* Hash for inode-based rules */ 131/* Hash for inode-based rules */
132struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS]; 132struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
@@ -724,7 +724,7 @@ static int audit_get_feature(struct sk_buff *skb)
724 724
725 seq = nlmsg_hdr(skb)->nlmsg_seq; 725 seq = nlmsg_hdr(skb)->nlmsg_seq;
726 726
727 audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &af, sizeof(af)); 727 audit_send_reply(skb, seq, AUDIT_GET_FEATURE, 0, 0, &af, sizeof(af));
728 728
729 return 0; 729 return 0;
730} 730}
@@ -750,7 +750,7 @@ static int audit_set_feature(struct sk_buff *skb)
750 struct audit_features *uaf; 750 struct audit_features *uaf;
751 int i; 751 int i;
752 752
753 BUILD_BUG_ON(AUDIT_LAST_FEATURE + 1 > sizeof(audit_feature_names)/sizeof(audit_feature_names[0])); 753 BUILD_BUG_ON(AUDIT_LAST_FEATURE + 1 > ARRAY_SIZE(audit_feature_names));
754 uaf = nlmsg_data(nlmsg_hdr(skb)); 754 uaf = nlmsg_data(nlmsg_hdr(skb));
755 755
756 /* if there is ever a version 2 we should handle that here */ 756 /* if there is ever a version 2 we should handle that here */
@@ -1301,19 +1301,9 @@ err:
1301 */ 1301 */
1302unsigned int audit_serial(void) 1302unsigned int audit_serial(void)
1303{ 1303{
1304 static DEFINE_SPINLOCK(serial_lock); 1304 static atomic_t serial = ATOMIC_INIT(0);
1305 static unsigned int serial = 0;
1306 1305
1307 unsigned long flags; 1306 return atomic_add_return(1, &serial);
1308 unsigned int ret;
1309
1310 spin_lock_irqsave(&serial_lock, flags);
1311 do {
1312 ret = ++serial;
1313 } while (unlikely(!ret));
1314 spin_unlock_irqrestore(&serial_lock, flags);
1315
1316 return ret;
1317} 1307}
1318 1308
1319static inline void audit_get_stamp(struct audit_context *ctx, 1309static inline void audit_get_stamp(struct audit_context *ctx,
@@ -1681,7 +1671,7 @@ void audit_log_cap(struct audit_buffer *ab, char *prefix, kernel_cap_t *cap)
1681 } 1671 }
1682} 1672}
1683 1673
1684void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name) 1674static void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name)
1685{ 1675{
1686 kernel_cap_t *perm = &name->fcap.permitted; 1676 kernel_cap_t *perm = &name->fcap.permitted;
1687 kernel_cap_t *inh = &name->fcap.inheritable; 1677 kernel_cap_t *inh = &name->fcap.inheritable;
@@ -1860,7 +1850,7 @@ EXPORT_SYMBOL(audit_log_task_context);
1860void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) 1850void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
1861{ 1851{
1862 const struct cred *cred; 1852 const struct cred *cred;
1863 char name[sizeof(tsk->comm)]; 1853 char comm[sizeof(tsk->comm)];
1864 struct mm_struct *mm = tsk->mm; 1854 struct mm_struct *mm = tsk->mm;
1865 char *tty; 1855 char *tty;
1866 1856
@@ -1894,9 +1884,8 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
1894 from_kgid(&init_user_ns, cred->fsgid), 1884 from_kgid(&init_user_ns, cred->fsgid),
1895 tty, audit_get_sessionid(tsk)); 1885 tty, audit_get_sessionid(tsk));
1896 1886
1897 get_task_comm(name, tsk);
1898 audit_log_format(ab, " comm="); 1887 audit_log_format(ab, " comm=");
1899 audit_log_untrustedstring(ab, name); 1888 audit_log_untrustedstring(ab, get_task_comm(comm, tsk));
1900 1889
1901 if (mm) { 1890 if (mm) {
1902 down_read(&mm->mmap_sem); 1891 down_read(&mm->mmap_sem);
@@ -1959,6 +1948,7 @@ void audit_log_end(struct audit_buffer *ab)
1959 } else { 1948 } else {
1960 struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); 1949 struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
1961 1950
1951 nlh->nlmsg_len = ab->skb->len;
1962 kauditd_send_multicast_skb(ab->skb); 1952 kauditd_send_multicast_skb(ab->skb);
1963 1953
1964 /* 1954 /*
@@ -1970,7 +1960,7 @@ void audit_log_end(struct audit_buffer *ab)
1970 * protocol between the kaudit kernel subsystem and the auditd 1960 * protocol between the kaudit kernel subsystem and the auditd
1971 * userspace code. 1961 * userspace code.
1972 */ 1962 */
1973 nlh->nlmsg_len = ab->skb->len - NLMSG_HDRLEN; 1963 nlh->nlmsg_len -= NLMSG_HDRLEN;
1974 1964
1975 if (audit_pid) { 1965 if (audit_pid) {
1976 skb_queue_tail(&audit_skb_queue, ab->skb); 1966 skb_queue_tail(&audit_skb_queue, ab->skb);
diff --git a/kernel/audit.h b/kernel/audit.h
index 7bb65730c890..3cdffad5a1d9 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -222,7 +222,6 @@ extern void audit_copy_inode(struct audit_names *name,
222 const struct inode *inode); 222 const struct inode *inode);
223extern void audit_log_cap(struct audit_buffer *ab, char *prefix, 223extern void audit_log_cap(struct audit_buffer *ab, char *prefix,
224 kernel_cap_t *cap); 224 kernel_cap_t *cap);
225extern void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name);
226extern void audit_log_name(struct audit_context *context, 225extern void audit_log_name(struct audit_context *context,
227 struct audit_names *n, struct path *path, 226 struct audit_names *n, struct path *path,
228 int record_num, int *call_panic); 227 int record_num, int *call_panic);
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 135944a7b28a..e242e3a9864a 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -449,7 +449,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
449 return 0; 449 return 0;
450} 450}
451 451
452static void audit_log_remove_rule(struct audit_krule *rule) 452static void audit_tree_log_remove_rule(struct audit_krule *rule)
453{ 453{
454 struct audit_buffer *ab; 454 struct audit_buffer *ab;
455 455
@@ -457,7 +457,7 @@ static void audit_log_remove_rule(struct audit_krule *rule)
457 if (unlikely(!ab)) 457 if (unlikely(!ab))
458 return; 458 return;
459 audit_log_format(ab, "op="); 459 audit_log_format(ab, "op=");
460 audit_log_string(ab, "remove rule"); 460 audit_log_string(ab, "remove_rule");
461 audit_log_format(ab, " dir="); 461 audit_log_format(ab, " dir=");
462 audit_log_untrustedstring(ab, rule->tree->pathname); 462 audit_log_untrustedstring(ab, rule->tree->pathname);
463 audit_log_key(ab, rule->filterkey); 463 audit_log_key(ab, rule->filterkey);
@@ -476,7 +476,7 @@ static void kill_rules(struct audit_tree *tree)
476 list_del_init(&rule->rlist); 476 list_del_init(&rule->rlist);
477 if (rule->tree) { 477 if (rule->tree) {
478 /* not a half-baked one */ 478 /* not a half-baked one */
479 audit_log_remove_rule(rule); 479 audit_tree_log_remove_rule(rule);
480 rule->tree = NULL; 480 rule->tree = NULL;
481 list_del_rcu(&entry->list); 481 list_del_rcu(&entry->list);
482 list_del(&entry->rule.list); 482 list_del(&entry->rule.list);
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 70b4554d2fbe..ad9c1682f616 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -314,7 +314,7 @@ static void audit_update_watch(struct audit_parent *parent,
314 &nentry->rule.list); 314 &nentry->rule.list);
315 } 315 }
316 316
317 audit_watch_log_rule_change(r, owatch, "updated rules"); 317 audit_watch_log_rule_change(r, owatch, "updated_rules");
318 318
319 call_rcu(&oentry->rcu, audit_free_rule_rcu); 319 call_rcu(&oentry->rcu, audit_free_rule_rcu);
320 } 320 }
@@ -342,7 +342,7 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
342 list_for_each_entry_safe(w, nextw, &parent->watches, wlist) { 342 list_for_each_entry_safe(w, nextw, &parent->watches, wlist) {
343 list_for_each_entry_safe(r, nextr, &w->rules, rlist) { 343 list_for_each_entry_safe(r, nextr, &w->rules, rlist) {
344 e = container_of(r, struct audit_entry, rule); 344 e = container_of(r, struct audit_entry, rule);
345 audit_watch_log_rule_change(r, w, "remove rule"); 345 audit_watch_log_rule_change(r, w, "remove_rule");
346 list_del(&r->rlist); 346 list_del(&r->rlist);
347 list_del(&r->list); 347 list_del(&r->list);
348 list_del_rcu(&e->list); 348 list_del_rcu(&e->list);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index c447cd9848d1..3598e13f2a65 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -71,6 +71,24 @@ static struct list_head audit_rules_list[AUDIT_NR_FILTERS] = {
71 71
72DEFINE_MUTEX(audit_filter_mutex); 72DEFINE_MUTEX(audit_filter_mutex);
73 73
74static void audit_free_lsm_field(struct audit_field *f)
75{
76 switch (f->type) {
77 case AUDIT_SUBJ_USER:
78 case AUDIT_SUBJ_ROLE:
79 case AUDIT_SUBJ_TYPE:
80 case AUDIT_SUBJ_SEN:
81 case AUDIT_SUBJ_CLR:
82 case AUDIT_OBJ_USER:
83 case AUDIT_OBJ_ROLE:
84 case AUDIT_OBJ_TYPE:
85 case AUDIT_OBJ_LEV_LOW:
86 case AUDIT_OBJ_LEV_HIGH:
87 kfree(f->lsm_str);
88 security_audit_rule_free(f->lsm_rule);
89 }
90}
91
74static inline void audit_free_rule(struct audit_entry *e) 92static inline void audit_free_rule(struct audit_entry *e)
75{ 93{
76 int i; 94 int i;
@@ -80,11 +98,8 @@ static inline void audit_free_rule(struct audit_entry *e)
80 if (erule->watch) 98 if (erule->watch)
81 audit_put_watch(erule->watch); 99 audit_put_watch(erule->watch);
82 if (erule->fields) 100 if (erule->fields)
83 for (i = 0; i < erule->field_count; i++) { 101 for (i = 0; i < erule->field_count; i++)
84 struct audit_field *f = &erule->fields[i]; 102 audit_free_lsm_field(&erule->fields[i]);
85 kfree(f->lsm_str);
86 security_audit_rule_free(f->lsm_rule);
87 }
88 kfree(erule->fields); 103 kfree(erule->fields);
89 kfree(erule->filterkey); 104 kfree(erule->filterkey);
90 kfree(e); 105 kfree(e);
@@ -148,7 +163,7 @@ static inline int audit_to_inode(struct audit_krule *krule,
148 struct audit_field *f) 163 struct audit_field *f)
149{ 164{
150 if (krule->listnr != AUDIT_FILTER_EXIT || 165 if (krule->listnr != AUDIT_FILTER_EXIT ||
151 krule->watch || krule->inode_f || krule->tree || 166 krule->inode_f || krule->watch || krule->tree ||
152 (f->op != Audit_equal && f->op != Audit_not_equal)) 167 (f->op != Audit_equal && f->op != Audit_not_equal))
153 return -EINVAL; 168 return -EINVAL;
154 169
@@ -422,10 +437,6 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
422 437
423 f->type = data->fields[i]; 438 f->type = data->fields[i];
424 f->val = data->values[i]; 439 f->val = data->values[i];
425 f->uid = INVALID_UID;
426 f->gid = INVALID_GID;
427 f->lsm_str = NULL;
428 f->lsm_rule = NULL;
429 440
430 /* Support legacy tests for a valid loginuid */ 441 /* Support legacy tests for a valid loginuid */
431 if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) { 442 if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) {
@@ -1053,30 +1064,27 @@ int audit_rule_change(int type, __u32 portid, int seq, void *data,
1053 int err = 0; 1064 int err = 0;
1054 struct audit_entry *entry; 1065 struct audit_entry *entry;
1055 1066
1067 entry = audit_data_to_entry(data, datasz);
1068 if (IS_ERR(entry))
1069 return PTR_ERR(entry);
1070
1056 switch (type) { 1071 switch (type) {
1057 case AUDIT_ADD_RULE: 1072 case AUDIT_ADD_RULE:
1058 entry = audit_data_to_entry(data, datasz);
1059 if (IS_ERR(entry))
1060 return PTR_ERR(entry);
1061
1062 err = audit_add_rule(entry); 1073 err = audit_add_rule(entry);
1063 audit_log_rule_change("add rule", &entry->rule, !err); 1074 audit_log_rule_change("add_rule", &entry->rule, !err);
1064 if (err)
1065 audit_free_rule(entry);
1066 break; 1075 break;
1067 case AUDIT_DEL_RULE: 1076 case AUDIT_DEL_RULE:
1068 entry = audit_data_to_entry(data, datasz);
1069 if (IS_ERR(entry))
1070 return PTR_ERR(entry);
1071
1072 err = audit_del_rule(entry); 1077 err = audit_del_rule(entry);
1073 audit_log_rule_change("remove rule", &entry->rule, !err); 1078 audit_log_rule_change("remove_rule", &entry->rule, !err);
1074 audit_free_rule(entry);
1075 break; 1079 break;
1076 default: 1080 default:
1077 return -EINVAL; 1081 err = -EINVAL;
1082 WARN_ON(1);
1078 } 1083 }
1079 1084
1085 if (err || type == AUDIT_DEL_RULE)
1086 audit_free_rule(entry);
1087
1080 return err; 1088 return err;
1081} 1089}
1082 1090
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 7208c1df248d..e420a0c41b5f 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -67,6 +67,7 @@
67#include <linux/binfmts.h> 67#include <linux/binfmts.h>
68#include <linux/highmem.h> 68#include <linux/highmem.h>
69#include <linux/syscalls.h> 69#include <linux/syscalls.h>
70#include <asm/syscall.h>
70#include <linux/capability.h> 71#include <linux/capability.h>
71#include <linux/fs_struct.h> 72#include <linux/fs_struct.h>
72#include <linux/compat.h> 73#include <linux/compat.h>
@@ -125,14 +126,6 @@ struct audit_tree_refs {
125 struct audit_chunk *c[31]; 126 struct audit_chunk *c[31];
126}; 127};
127 128
128static inline int open_arg(int flags, int mask)
129{
130 int n = ACC_MODE(flags);
131 if (flags & (O_TRUNC | O_CREAT))
132 n |= AUDIT_PERM_WRITE;
133 return n & mask;
134}
135
136static int audit_match_perm(struct audit_context *ctx, int mask) 129static int audit_match_perm(struct audit_context *ctx, int mask)
137{ 130{
138 unsigned n; 131 unsigned n;
@@ -1505,7 +1498,6 @@ void __audit_free(struct task_struct *tsk)
1505 1498
1506/** 1499/**
1507 * audit_syscall_entry - fill in an audit record at syscall entry 1500 * audit_syscall_entry - fill in an audit record at syscall entry
1508 * @arch: architecture type
1509 * @major: major syscall type (function) 1501 * @major: major syscall type (function)
1510 * @a1: additional syscall register 1 1502 * @a1: additional syscall register 1
1511 * @a2: additional syscall register 2 1503 * @a2: additional syscall register 2
@@ -1520,9 +1512,8 @@ void __audit_free(struct task_struct *tsk)
1520 * will only be written if another part of the kernel requests that it 1512 * will only be written if another part of the kernel requests that it
1521 * be written). 1513 * be written).
1522 */ 1514 */
1523void __audit_syscall_entry(int arch, int major, 1515void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2,
1524 unsigned long a1, unsigned long a2, 1516 unsigned long a3, unsigned long a4)
1525 unsigned long a3, unsigned long a4)
1526{ 1517{
1527 struct task_struct *tsk = current; 1518 struct task_struct *tsk = current;
1528 struct audit_context *context = tsk->audit_context; 1519 struct audit_context *context = tsk->audit_context;
@@ -1536,7 +1527,7 @@ void __audit_syscall_entry(int arch, int major,
1536 if (!audit_enabled) 1527 if (!audit_enabled)
1537 return; 1528 return;
1538 1529
1539 context->arch = arch; 1530 context->arch = syscall_get_arch();
1540 context->major = major; 1531 context->major = major;
1541 context->argv[0] = a1; 1532 context->argv[0] = a1;
1542 context->argv[1] = a2; 1533 context->argv[1] = a2;
@@ -2433,6 +2424,7 @@ static void audit_log_task(struct audit_buffer *ab)
2433 kgid_t gid; 2424 kgid_t gid;
2434 unsigned int sessionid; 2425 unsigned int sessionid;
2435 struct mm_struct *mm = current->mm; 2426 struct mm_struct *mm = current->mm;
2427 char comm[sizeof(current->comm)];
2436 2428
2437 auid = audit_get_loginuid(current); 2429 auid = audit_get_loginuid(current);
2438 sessionid = audit_get_sessionid(current); 2430 sessionid = audit_get_sessionid(current);
@@ -2445,7 +2437,7 @@ static void audit_log_task(struct audit_buffer *ab)
2445 sessionid); 2437 sessionid);
2446 audit_log_task_context(ab); 2438 audit_log_task_context(ab);
2447 audit_log_format(ab, " pid=%d comm=", task_pid_nr(current)); 2439 audit_log_format(ab, " pid=%d comm=", task_pid_nr(current));
2448 audit_log_untrustedstring(ab, current->comm); 2440 audit_log_untrustedstring(ab, get_task_comm(comm, current));
2449 if (mm) { 2441 if (mm) {
2450 down_read(&mm->mmap_sem); 2442 down_read(&mm->mmap_sem);
2451 if (mm->exe_file) 2443 if (mm->exe_file)
@@ -2488,11 +2480,9 @@ void __audit_seccomp(unsigned long syscall, long signr, int code)
2488 if (unlikely(!ab)) 2480 if (unlikely(!ab))
2489 return; 2481 return;
2490 audit_log_task(ab); 2482 audit_log_task(ab);
2491 audit_log_format(ab, " sig=%ld", signr); 2483 audit_log_format(ab, " sig=%ld arch=%x syscall=%ld compat=%d ip=0x%lx code=0x%x",
2492 audit_log_format(ab, " syscall=%ld", syscall); 2484 signr, syscall_get_arch(), syscall, is_compat_task(),
2493 audit_log_format(ab, " compat=%d", is_compat_task()); 2485 KSTK_EIP(current), code);
2494 audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));
2495 audit_log_format(ab, " code=0x%x", code);
2496 audit_log_end(ab); 2486 audit_log_end(ab);
2497} 2487}
2498 2488