Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARCH: AUDIT: implement syscall_get_arch for all arches

For all arches which support audit implement syscall_get_arch()
They are all pretty easy and straight forward, stolen from how the call
to audit_syscall_entry() determines the arch.

Based-on-patch-by: Richard Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Cc: linux-ia64@vger.kernel.org
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: linux-mips@linux-mips.org
Cc: linux@lists.openrisc.net
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: sparclinux@vger.kernel.org

+49 -1
+6
arch/ia64/include/asm/syscall.h
··· 13 13 #ifndef _ASM_SYSCALL_H 14 14 #define _ASM_SYSCALL_H 1 15 15 16 + #include <uapi/linux/audit.h> 16 17 #include <linux/sched.h> 17 18 #include <linux/err.h> 18 19 ··· 79 78 BUG_ON(i + n > 6); 80 79 81 80 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1); 81 + } 82 + 83 + static inline int syscall_get_arch(void) 84 + { 85 + return AUDIT_ARCH_IA64; 82 86 } 83 87 #endif /* _ASM_SYSCALL_H */
+5
arch/microblaze/include/asm/syscall.h
··· 1 1 #ifndef __ASM_MICROBLAZE_SYSCALL_H 2 2 #define __ASM_MICROBLAZE_SYSCALL_H 3 3 4 + #include <uapi/linux/audit.h> 4 5 #include <linux/kernel.h> 5 6 #include <linux/sched.h> 6 7 #include <asm/ptrace.h> ··· 100 99 asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 101 100 asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 102 101 102 + static inline int syscall_get_arch(void) 103 + { 104 + return AUDIT_ARCH_MICROBLAZE; 105 + } 103 106 #endif /* __ASM_MICROBLAZE_SYSCALL_H */
+1 -1
arch/mips/include/asm/syscall.h
··· 129 129 130 130 static inline int syscall_get_arch(void) 131 131 { 132 - int arch = EM_MIPS; 132 + int arch = AUDIT_ARCH_MIPS; 133 133 #ifdef CONFIG_64BIT 134 134 if (!test_thread_flag(TIF_32BIT_REGS)) 135 135 arch |= __AUDIT_ARCH_64BIT;
+5
arch/openrisc/include/asm/syscall.h
··· 19 19 #ifndef __ASM_OPENRISC_SYSCALL_H__ 20 20 #define __ASM_OPENRISC_SYSCALL_H__ 21 21 22 + #include <uapi/linux/audit.h> 22 23 #include <linux/err.h> 23 24 #include <linux/sched.h> 24 25 ··· 72 71 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 73 72 } 74 73 74 + static inline int syscall_get_arch(void) 75 + { 76 + return AUDIT_ARCH_OPENRISC; 77 + } 75 78 #endif
+11
arch/parisc/include/asm/syscall.h
··· 3 3 #ifndef _ASM_PARISC_SYSCALL_H_ 4 4 #define _ASM_PARISC_SYSCALL_H_ 5 5 6 + #include <uapi/linux/audit.h> 7 + #include <linux/compat.h> 6 8 #include <linux/err.h> 7 9 #include <asm/ptrace.h> 8 10 ··· 39 37 } 40 38 } 41 39 40 + static inline int syscall_get_arch(void) 41 + { 42 + int arch = AUDIT_ARCH_PARISC; 43 + #ifdef CONFIG_64BIT 44 + if (!is_compat_task()) 45 + arch = AUDIT_ARCH_PARISC64; 46 + #endif 47 + return arch; 48 + } 42 49 #endif /*_ASM_PARISC_SYSCALL_H_*/
+12
arch/powerpc/include/asm/syscall.h
··· 13 13 #ifndef _ASM_SYSCALL_H 14 14 #define _ASM_SYSCALL_H 1 15 15 16 + #include <uapi/linux/audit.h> 17 + #include <linux/compat.h> 16 18 #include <linux/sched.h> 17 19 18 20 /* ftrace syscalls requires exporting the sys_call_table */ ··· 88 86 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 89 87 } 90 88 89 + static inline int syscall_get_arch(void) 90 + { 91 + int arch = AUDIT_ARCH_PPC; 92 + 93 + #ifdef CONFIG_PPC64 94 + if (!is_32bit_task()) 95 + arch = AUDIT_ARCH_PPC64; 96 + #endif 97 + return arch; 98 + } 91 99 #endif /* _ASM_SYSCALL_H */
+8
arch/sparc/include/asm/syscall.h
··· 1 1 #ifndef __ASM_SPARC_SYSCALL_H 2 2 #define __ASM_SPARC_SYSCALL_H 3 3 4 + #include <uapi/linux/audit.h> 4 5 #include <linux/kernel.h> 5 6 #include <linux/sched.h> 6 7 #include <asm/ptrace.h> 8 + #include <asm/thread_info.h> 7 9 8 10 /* 9 11 * The syscall table always contains 32 bit pointers since we know that the ··· 124 122 125 123 for (j = 0; j < n; j++) 126 124 regs->u_regs[UREG_I0 + i + j] = args[j]; 125 + } 126 + 127 + static inline int syscall_get_arch(void) 128 + { 129 + return test_thread_flag(TIF_32BIT) ? AUDIT_ARCH_SPARC 130 + : AUDIT_ARCH_SPARC64; 127 131 } 128 132 129 133 #endif /* __ASM_SPARC_SYSCALL_H */
+1
include/uapi/linux/audit.h
··· 351 351 #define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 352 352 #define AUDIT_ARCH_M32R (EM_M32R) 353 353 #define AUDIT_ARCH_M68K (EM_68K) 354 + #define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE) 354 355 #define AUDIT_ARCH_MIPS (EM_MIPS) 355 356 #define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) 356 357 #define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)