aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
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 /arch/sh
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 ...
Diffstat (limited to 'arch/sh')
-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
4 files changed, 26 insertions, 29 deletions
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];