aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/kernel/ptrace.c9
-rw-r--r--arch/microblaze/kernel/ptrace.c6
-rw-r--r--arch/mips/kernel/ptrace.c7
-rw-r--r--arch/powerpc/kernel/ptrace.c26
-rw-r--r--arch/s390/kernel/ptrace.c11
-rw-r--r--arch/sh/kernel/ptrace_32.c7
-rw-r--r--arch/sh/kernel/ptrace_64.c7
-rw-r--r--arch/sparc/kernel/ptrace_64.c17
-rw-r--r--arch/um/kernel/ptrace.c20
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/ptrace.c22
-rw-r--r--arch/xtensa/kernel/ptrace.c3
-rw-r--r--include/linux/audit.h13
-rw-r--r--kernel/auditsc.c2
16 files changed, 72 insertions, 86 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 2c154088cce7..dad91661ddf9 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1246,15 +1246,8 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1246 if (test_thread_flag(TIF_RESTORE_RSE)) 1246 if (test_thread_flag(TIF_RESTORE_RSE))
1247 ia64_sync_krbs(); 1247 ia64_sync_krbs();
1248 1248
1249 if (unlikely(current->audit_context)) {
1250 long syscall;
1251 int arch;
1252 1249
1253 syscall = regs.r15; 1250 audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3);
1254 arch = AUDIT_ARCH_IA64;
1255
1256 audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3);
1257 }
1258 1251
1259 return 0; 1252 return 0;
1260} 1253}
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index f564b1bfd386..6eb2aa927d89 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -147,10 +147,8 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
147 */ 147 */
148 ret = -1L; 148 ret = -1L;
149 149
150 if (unlikely(current->audit_context)) 150 audit_syscall_entry(EM_MICROBLAZE, regs->r12, regs->r5, regs->r6,
151 audit_syscall_entry(EM_MICROBLAZE, regs->r12, 151 regs->r7, regs->r8);
152 regs->r5, regs->r6,
153 regs->r7, regs->r8);
154 152
155 return ret ?: regs->r12; 153 return ret ?: regs->r12;
156} 154}
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index ab0f1963a7bd..7786b608d932 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -560,10 +560,9 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
560 } 560 }
561 561
562out: 562out:
563 if (unlikely(current->audit_context)) 563 audit_syscall_entry(audit_arch(), regs->regs[2],
564 audit_syscall_entry(audit_arch(), regs->regs[2], 564 regs->regs[4], regs->regs[5],
565 regs->regs[4], regs->regs[5], 565 regs->regs[6], regs->regs[7]);
566 regs->regs[6], regs->regs[7]);
567} 566}
568 567
569/* 568/*
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 09d31c12a5e3..5b43325402bc 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1724,22 +1724,20 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1724 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1724 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1725 trace_sys_enter(regs, regs->gpr[0]); 1725 trace_sys_enter(regs, regs->gpr[0]);
1726 1726
1727 if (unlikely(current->audit_context)) {
1728#ifdef CONFIG_PPC64 1727#ifdef CONFIG_PPC64
1729 if (!is_32bit_task()) 1728 if (!is_32bit_task())
1730 audit_syscall_entry(AUDIT_ARCH_PPC64, 1729 audit_syscall_entry(AUDIT_ARCH_PPC64,
1731 regs->gpr[0], 1730 regs->gpr[0],
1732 regs->gpr[3], regs->gpr[4], 1731 regs->gpr[3], regs->gpr[4],
1733 regs->gpr[5], regs->gpr[6]); 1732 regs->gpr[5], regs->gpr[6]);
1734 else 1733 else
1735#endif 1734#endif
1736 audit_syscall_entry(AUDIT_ARCH_PPC, 1735 audit_syscall_entry(AUDIT_ARCH_PPC,
1737 regs->gpr[0], 1736 regs->gpr[0],
1738 regs->gpr[3] & 0xffffffff, 1737 regs->gpr[3] & 0xffffffff,
1739 regs->gpr[4] & 0xffffffff, 1738 regs->gpr[4] & 0xffffffff,
1740 regs->gpr[5] & 0xffffffff, 1739 regs->gpr[5] & 0xffffffff,
1741 regs->gpr[6] & 0xffffffff); 1740 regs->gpr[6] & 0xffffffff);
1742 }
1743 1741
1744 return ret ?: regs->gpr[0]; 1742 return ret ?: regs->gpr[0];
1745} 1743}
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f52758600980..9d82ed4bcb27 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -740,12 +740,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
740 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 740 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
741 trace_sys_enter(regs, regs->gprs[2]); 741 trace_sys_enter(regs, regs->gprs[2]);
742 742
743 if (unlikely(current->audit_context)) 743 audit_syscall_entry(is_compat_task() ?
744 audit_syscall_entry(is_compat_task() ? 744 AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
745 AUDIT_ARCH_S390 : AUDIT_ARCH_S390X, 745 regs->gprs[2], regs->orig_gpr2,
746 regs->gprs[2], regs->orig_gpr2, 746 regs->gprs[3], regs->gprs[4],
747 regs->gprs[3], regs->gprs[4], 747 regs->gprs[5]);
748 regs->gprs[5]);
749 return ret ?: regs->gprs[2]; 748 return ret ?: regs->gprs[2];
750} 749}
751 750
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index c0b5c179d27b..a3e651563763 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -518,10 +518,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
518 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 518 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
519 trace_sys_enter(regs, regs->regs[0]); 519 trace_sys_enter(regs, regs->regs[0]);
520 520
521 if (unlikely(current->audit_context)) 521 audit_syscall_entry(audit_arch(), regs->regs[3],
522 audit_syscall_entry(audit_arch(), regs->regs[3], 522 regs->regs[4], regs->regs[5],
523 regs->regs[4], regs->regs[5], 523 regs->regs[6], regs->regs[7]);
524 regs->regs[6], regs->regs[7]);
525 524
526 return ret ?: regs->regs[0]; 525 return ret ?: regs->regs[0];
527} 526}
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index ba720d686435..3d0080b5c976 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -536,10 +536,9 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
536 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 536 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
537 trace_sys_enter(regs, regs->regs[9]); 537 trace_sys_enter(regs, regs->regs[9]);
538 538
539 if (unlikely(current->audit_context)) 539 audit_syscall_entry(audit_arch(), regs->regs[1],
540 audit_syscall_entry(audit_arch(), regs->regs[1], 540 regs->regs[2], regs->regs[3],
541 regs->regs[2], regs->regs[3], 541 regs->regs[4], regs->regs[5]);
542 regs->regs[4], regs->regs[5]);
543 542
544 return ret ?: regs->regs[9]; 543 return ret ?: regs->regs[9];
545} 544}
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index c73c8c50f117..9388844cd88c 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -1071,15 +1071,14 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1071 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1071 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1072 trace_sys_enter(regs, regs->u_regs[UREG_G1]); 1072 trace_sys_enter(regs, regs->u_regs[UREG_G1]);
1073 1073
1074 if (unlikely(current->audit_context) && !ret) 1074 audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
1075 audit_syscall_entry((test_thread_flag(TIF_32BIT) ? 1075 AUDIT_ARCH_SPARC :
1076 AUDIT_ARCH_SPARC : 1076 AUDIT_ARCH_SPARC64),
1077 AUDIT_ARCH_SPARC64), 1077 regs->u_regs[UREG_G1],
1078 regs->u_regs[UREG_G1], 1078 regs->u_regs[UREG_I0],
1079 regs->u_regs[UREG_I0], 1079 regs->u_regs[UREG_I1],
1080 regs->u_regs[UREG_I1], 1080 regs->u_regs[UREG_I2],
1081 regs->u_regs[UREG_I2], 1081 regs->u_regs[UREG_I3]);
1082 regs->u_regs[UREG_I3]);
1083 1082
1084 return ret; 1083 return ret;
1085} 1084}
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 2ccf25c42feb..06b190390505 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -167,17 +167,15 @@ void syscall_trace(struct uml_pt_regs *regs, int entryexit)
167 int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit; 167 int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit;
168 int tracesysgood; 168 int tracesysgood;
169 169
170 if (unlikely(current->audit_context)) { 170 if (!entryexit)
171 if (!entryexit) 171 audit_syscall_entry(HOST_AUDIT_ARCH,
172 audit_syscall_entry(HOST_AUDIT_ARCH, 172 UPT_SYSCALL_NR(regs),
173 UPT_SYSCALL_NR(regs), 173 UPT_SYSCALL_ARG1(regs),
174 UPT_SYSCALL_ARG1(regs), 174 UPT_SYSCALL_ARG2(regs),
175 UPT_SYSCALL_ARG2(regs), 175 UPT_SYSCALL_ARG3(regs),
176 UPT_SYSCALL_ARG3(regs), 176 UPT_SYSCALL_ARG4(regs));
177 UPT_SYSCALL_ARG4(regs)); 177 else
178 else 178 audit_syscall_exit(regs);
179 audit_syscall_exit(regs);
180 }
181 179
182 /* Fake a debug trap */ 180 /* Fake a debug trap */
183 if (is_singlestep) 181 if (is_singlestep)
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 025f0f01d254..cecfd9a8f734 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -192,7 +192,7 @@ sysexit_from_sys_call:
192 movl %ebx,%edx /* 3rd arg: 1st syscall arg */ 192 movl %ebx,%edx /* 3rd arg: 1st syscall arg */
193 movl %eax,%esi /* 2nd arg: syscall number */ 193 movl %eax,%esi /* 2nd arg: syscall number */
194 movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ 194 movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
195 call audit_syscall_entry 195 call __audit_syscall_entry
196 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ 196 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
197 cmpq $(IA32_NR_syscalls-1),%rax 197 cmpq $(IA32_NR_syscalls-1),%rax
198 ja ia32_badsys 198 ja ia32_badsys
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index a22facf06f0e..1ccd742eba1b 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -456,7 +456,7 @@ sysenter_audit:
456 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */ 456 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */
457 movl %eax,%edx /* 2nd arg: syscall number */ 457 movl %eax,%edx /* 2nd arg: syscall number */
458 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */ 458 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
459 call audit_syscall_entry 459 call __audit_syscall_entry
460 pushl_cfi %ebx 460 pushl_cfi %ebx
461 movl PT_EAX(%esp),%eax /* reload syscall number */ 461 movl PT_EAX(%esp),%eax /* reload syscall number */
462 jmp sysenter_do_call 462 jmp sysenter_do_call
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e51393dd93a3..1ca66b650123 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -549,7 +549,7 @@ badsys:
549#ifdef CONFIG_AUDITSYSCALL 549#ifdef CONFIG_AUDITSYSCALL
550 /* 550 /*
551 * Fast path for syscall audit without full syscall trace. 551 * Fast path for syscall audit without full syscall trace.
552 * We just call audit_syscall_entry() directly, and then 552 * We just call __audit_syscall_entry() directly, and then
553 * jump back to the normal fast path. 553 * jump back to the normal fast path.
554 */ 554 */
555auditsys: 555auditsys:
@@ -559,7 +559,7 @@ auditsys:
559 movq %rdi,%rdx /* 3rd arg: 1st syscall arg */ 559 movq %rdi,%rdx /* 3rd arg: 1st syscall arg */
560 movq %rax,%rsi /* 2nd arg: syscall number */ 560 movq %rax,%rsi /* 2nd arg: syscall number */
561 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ 561 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */
562 call audit_syscall_entry 562 call __audit_syscall_entry
563 LOAD_ARGS 0 /* reload call-clobbered registers */ 563 LOAD_ARGS 0 /* reload call-clobbered registers */
564 jmp system_call_fastpath 564 jmp system_call_fastpath
565 565
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 8b0218758775..50267386b766 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1392,20 +1392,18 @@ long syscall_trace_enter(struct pt_regs *regs)
1392 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1392 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1393 trace_sys_enter(regs, regs->orig_ax); 1393 trace_sys_enter(regs, regs->orig_ax);
1394 1394
1395 if (unlikely(current->audit_context)) { 1395 if (IS_IA32)
1396 if (IS_IA32) 1396 audit_syscall_entry(AUDIT_ARCH_I386,
1397 audit_syscall_entry(AUDIT_ARCH_I386, 1397 regs->orig_ax,
1398 regs->orig_ax, 1398 regs->bx, regs->cx,
1399 regs->bx, regs->cx, 1399 regs->dx, regs->si);
1400 regs->dx, regs->si);
1401#ifdef CONFIG_X86_64 1400#ifdef CONFIG_X86_64
1402 else 1401 else
1403 audit_syscall_entry(AUDIT_ARCH_X86_64, 1402 audit_syscall_entry(AUDIT_ARCH_X86_64,
1404 regs->orig_ax, 1403 regs->orig_ax,
1405 regs->di, regs->si, 1404 regs->di, regs->si,
1406 regs->dx, regs->r10); 1405 regs->dx, regs->r10);
1407#endif 1406#endif
1408 }
1409 1407
1410 return ret ?: regs->orig_ax; 1408 return ret ?: regs->orig_ax;
1411} 1409}
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index a0d042aa2967..2dff698ab02e 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -334,8 +334,7 @@ void do_syscall_trace_enter(struct pt_regs *regs)
334 do_syscall_trace(); 334 do_syscall_trace();
335 335
336#if 0 336#if 0
337 if (unlikely(current->audit_context)) 337 audit_syscall_entry(current, AUDIT_ARCH_XTENSA..);
338 audit_syscall_entry(current, AUDIT_ARCH_XTENSA..);
339#endif 338#endif
340} 339}
341 340
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 3d65e4b3ba06..f56ce2669b83 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -418,9 +418,9 @@ extern int audit_classify_arch(int arch);
418extern void audit_finish_fork(struct task_struct *child); 418extern void audit_finish_fork(struct task_struct *child);
419extern int audit_alloc(struct task_struct *task); 419extern int audit_alloc(struct task_struct *task);
420extern void audit_free(struct task_struct *task); 420extern void audit_free(struct task_struct *task);
421extern void audit_syscall_entry(int arch, 421extern void __audit_syscall_entry(int arch,
422 int major, unsigned long a0, unsigned long a1, 422 int major, unsigned long a0, unsigned long a1,
423 unsigned long a2, unsigned long a3); 423 unsigned long a2, unsigned long a3);
424extern void __audit_syscall_exit(int ret_success, long ret_value); 424extern void __audit_syscall_exit(int ret_success, long ret_value);
425extern void __audit_getname(const char *name); 425extern void __audit_getname(const char *name);
426extern void audit_putname(const char *name); 426extern void audit_putname(const char *name);
@@ -435,6 +435,13 @@ static inline int audit_dummy_context(void)
435 void *p = current->audit_context; 435 void *p = current->audit_context;
436 return !p || *(int *)p; 436 return !p || *(int *)p;
437} 437}
438static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
439 unsigned long a1, unsigned long a2,
440 unsigned long a3)
441{
442 if (unlikely(!audit_dummy_context()))
443 __audit_syscall_entry(arch, major, a0, a1, a2, a3);
444}
438static inline void audit_syscall_exit(void *pt_regs) 445static inline void audit_syscall_exit(void *pt_regs)
439{ 446{
440 if (unlikely(current->audit_context)) { 447 if (unlikely(current->audit_context)) {
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 3d2853808185..b408100dd6ef 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1632,7 +1632,7 @@ void audit_free(struct task_struct *tsk)
1632 * will only be written if another part of the kernel requests that it 1632 * will only be written if another part of the kernel requests that it
1633 * be written). 1633 * be written).
1634 */ 1634 */
1635void audit_syscall_entry(int arch, int major, 1635void __audit_syscall_entry(int arch, int major,
1636 unsigned long a1, unsigned long a2, 1636 unsigned long a1, unsigned long a2,
1637 unsigned long a3, unsigned long a4) 1637 unsigned long a3, unsigned long a4)
1638{ 1638{