summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/syscall.h2
-rw-r--r--arch/arc/include/asm/elf.h6
-rw-r--r--arch/arc/include/asm/syscall.h11
-rw-r--r--arch/arm/include/asm/syscall.h2
-rw-r--r--arch/arm64/include/asm/syscall.h4
-rw-r--r--arch/c6x/include/asm/syscall.h7
-rw-r--r--arch/csky/include/asm/syscall.h2
-rw-r--r--arch/h8300/include/asm/syscall.h6
-rw-r--r--arch/hexagon/include/asm/elf.h6
-rw-r--r--arch/hexagon/include/asm/syscall.h8
-rw-r--r--arch/ia64/include/asm/syscall.h2
-rw-r--r--arch/m68k/include/asm/syscall.h12
-rw-r--r--arch/microblaze/include/asm/syscall.h2
-rw-r--r--arch/mips/include/asm/syscall.h6
-rw-r--r--arch/mips/kernel/ptrace.c2
-rw-r--r--arch/nds32/include/asm/elf.h3
-rw-r--r--arch/nds32/include/asm/syscall.h9
-rw-r--r--arch/nios2/include/asm/syscall.h6
-rw-r--r--arch/openrisc/include/asm/syscall.h2
-rw-r--r--arch/parisc/include/asm/syscall.h4
-rw-r--r--arch/powerpc/include/asm/syscall.h10
-rw-r--r--arch/riscv/include/asm/syscall.h2
-rw-r--r--arch/s390/include/asm/syscall.h4
-rw-r--r--arch/sh/include/asm/syscall_32.h2
-rw-r--r--arch/sh/include/asm/syscall_64.h2
-rw-r--r--arch/sparc/include/asm/syscall.h5
-rw-r--r--arch/unicore32/include/asm/elf.h3
-rw-r--r--arch/unicore32/include/asm/syscall.h12
-rw-r--r--arch/x86/include/asm/syscall.h8
-rw-r--r--arch/x86/um/asm/syscall.h2
-rw-r--r--arch/xtensa/include/asm/syscall.h2
31 files changed, 112 insertions, 42 deletions
diff --git a/arch/alpha/include/asm/syscall.h b/arch/alpha/include/asm/syscall.h
index d73a6fcb519c..11c688c1d7ec 100644
--- a/arch/alpha/include/asm/syscall.h
+++ b/arch/alpha/include/asm/syscall.h
@@ -4,7 +4,7 @@
4 4
5#include <uapi/linux/audit.h> 5#include <uapi/linux/audit.h>
6 6
7static inline int syscall_get_arch(void) 7static inline int syscall_get_arch(struct task_struct *task)
8{ 8{
9 return AUDIT_ARCH_ALPHA; 9 return AUDIT_ARCH_ALPHA;
10} 10}
diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h
index aa2d6da9d187..2b80c184c9c8 100644
--- a/arch/arc/include/asm/elf.h
+++ b/arch/arc/include/asm/elf.h
@@ -10,13 +10,9 @@
10#define __ASM_ARC_ELF_H 10#define __ASM_ARC_ELF_H
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/elf-em.h>
13#include <uapi/asm/elf.h> 14#include <uapi/asm/elf.h>
14 15
15/* These ELF defines belong to uapi but libc elf.h already defines them */
16#define EM_ARCOMPACT 93
17
18#define EM_ARCV2 195 /* ARCv2 Cores */
19
20#define EM_ARC_INUSE (IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \ 16#define EM_ARC_INUSE (IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \
21 EM_ARCOMPACT : EM_ARCV2) 17 EM_ARCOMPACT : EM_ARCV2)
22 18
diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h
index c7a4201ed62b..9cac959ca4e8 100644
--- a/arch/arc/include/asm/syscall.h
+++ b/arch/arc/include/asm/syscall.h
@@ -9,6 +9,7 @@
9#ifndef _ASM_ARC_SYSCALL_H 9#ifndef _ASM_ARC_SYSCALL_H
10#define _ASM_ARC_SYSCALL_H 1 10#define _ASM_ARC_SYSCALL_H 1
11 11
12#include <uapi/linux/audit.h>
12#include <linux/err.h> 13#include <linux/err.h>
13#include <linux/sched.h> 14#include <linux/sched.h>
14#include <asm/unistd.h> 15#include <asm/unistd.h>
@@ -67,4 +68,14 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
67 } 68 }
68} 69}
69 70
71static inline int
72syscall_get_arch(struct task_struct *task)
73{
74 return IS_ENABLED(CONFIG_ISA_ARCOMPACT)
75 ? (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
76 ? AUDIT_ARCH_ARCOMPACTBE : AUDIT_ARCH_ARCOMPACT)
77 : (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
78 ? AUDIT_ARCH_ARCV2BE : AUDIT_ARCH_ARCV2);
79}
80
70#endif 81#endif
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 080ce70cab12..fd02761ba06c 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -73,7 +73,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
73 memcpy(&regs->ARM_r0 + 1, args, 5 * sizeof(args[0])); 73 memcpy(&regs->ARM_r0 + 1, args, 5 * sizeof(args[0]));
74} 74}
75 75
76static inline int syscall_get_arch(void) 76static inline int syscall_get_arch(struct task_struct *task)
77{ 77{
78 /* ARM tasks don't change audit architectures on the fly. */ 78 /* ARM tasks don't change audit architectures on the fly. */
79 return AUDIT_ARCH_ARM; 79 return AUDIT_ARCH_ARM;
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index a179df3674a1..a65167f5cded 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -87,9 +87,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
87 * We don't care about endianness (__AUDIT_ARCH_LE bit) here because 87 * We don't care about endianness (__AUDIT_ARCH_LE bit) here because
88 * AArch64 has the same system calls both on little- and big- endian. 88 * AArch64 has the same system calls both on little- and big- endian.
89 */ 89 */
90static inline int syscall_get_arch(void) 90static inline int syscall_get_arch(struct task_struct *task)
91{ 91{
92 if (is_compat_task()) 92 if (is_compat_thread(task_thread_info(task)))
93 return AUDIT_ARCH_ARM; 93 return AUDIT_ARCH_ARM;
94 94
95 return AUDIT_ARCH_AARCH64; 95 return AUDIT_ARCH_AARCH64;
diff --git a/arch/c6x/include/asm/syscall.h b/arch/c6x/include/asm/syscall.h
index 15ba8599858e..5bcdcb651b19 100644
--- a/arch/c6x/include/asm/syscall.h
+++ b/arch/c6x/include/asm/syscall.h
@@ -11,6 +11,7 @@
11#ifndef __ASM_C6X_SYSCALL_H 11#ifndef __ASM_C6X_SYSCALL_H
12#define __ASM_C6X_SYSCALL_H 12#define __ASM_C6X_SYSCALL_H
13 13
14#include <uapi/linux/audit.h>
14#include <linux/err.h> 15#include <linux/err.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16 17
@@ -69,4 +70,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
69 regs->a9 = *args; 70 regs->a9 = *args;
70} 71}
71 72
73static inline int syscall_get_arch(struct task_struct *task)
74{
75 return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
76 ? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X;
77}
78
72#endif /* __ASM_C6X_SYSCALLS_H */ 79#endif /* __ASM_C6X_SYSCALLS_H */
diff --git a/arch/csky/include/asm/syscall.h b/arch/csky/include/asm/syscall.h
index bda0a446c63e..bc0d8717d28b 100644
--- a/arch/csky/include/asm/syscall.h
+++ b/arch/csky/include/asm/syscall.h
@@ -60,7 +60,7 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
60} 60}
61 61
62static inline int 62static inline int
63syscall_get_arch(void) 63syscall_get_arch(struct task_struct *task)
64{ 64{
65 return AUDIT_ARCH_CSKY; 65 return AUDIT_ARCH_CSKY;
66} 66}
diff --git a/arch/h8300/include/asm/syscall.h b/arch/h8300/include/asm/syscall.h
index ddd483c6ca95..01666b8bb263 100644
--- a/arch/h8300/include/asm/syscall.h
+++ b/arch/h8300/include/asm/syscall.h
@@ -8,6 +8,7 @@
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/ptrace.h> 10#include <linux/ptrace.h>
11#include <uapi/linux/audit.h>
11 12
12static inline int 13static inline int
13syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 14syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
@@ -27,6 +28,11 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
27 *args = regs->er6; 28 *args = regs->er6;
28} 29}
29 30
31static inline int
32syscall_get_arch(struct task_struct *task)
33{
34 return AUDIT_ARCH_H8300;
35}
30 36
31 37
32/* Misc syscall related bits */ 38/* Misc syscall related bits */
diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 80311e7b8ca6..d10fbd54ae51 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -23,11 +23,7 @@
23 23
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/user.h> 25#include <asm/user.h>
26 26#include <linux/elf-em.h>
27/*
28 * This should really be in linux/elf-em.h.
29 */
30#define EM_HEXAGON 164 /* QUALCOMM Hexagon */
31 27
32struct elf32_hdr; 28struct elf32_hdr;
33 29
diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
index ae3a1e24fabd..dab26a71f577 100644
--- a/arch/hexagon/include/asm/syscall.h
+++ b/arch/hexagon/include/asm/syscall.h
@@ -21,6 +21,8 @@
21#ifndef _ASM_HEXAGON_SYSCALL_H 21#ifndef _ASM_HEXAGON_SYSCALL_H
22#define _ASM_HEXAGON_SYSCALL_H 22#define _ASM_HEXAGON_SYSCALL_H
23 23
24#include <uapi/linux/audit.h>
25
24typedef long (*syscall_fn)(unsigned long, unsigned long, 26typedef long (*syscall_fn)(unsigned long, unsigned long,
25 unsigned long, unsigned long, 27 unsigned long, unsigned long,
26 unsigned long, unsigned long); 28 unsigned long, unsigned long);
@@ -41,4 +43,10 @@ static inline void syscall_get_arguments(struct task_struct *task,
41{ 43{
42 memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0])); 44 memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
43} 45}
46
47static inline int syscall_get_arch(struct task_struct *task)
48{
49 return AUDIT_ARCH_HEXAGON;
50}
51
44#endif 52#endif
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index 0d9e7fab4a79..da108cd45174 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -74,7 +74,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
74 ia64_syscall_get_set_arguments(task, regs, args, 1); 74 ia64_syscall_get_set_arguments(task, regs, args, 1);
75} 75}
76 76
77static inline int syscall_get_arch(void) 77static inline int syscall_get_arch(struct task_struct *task)
78{ 78{
79 return AUDIT_ARCH_IA64; 79 return AUDIT_ARCH_IA64;
80} 80}
diff --git a/arch/m68k/include/asm/syscall.h b/arch/m68k/include/asm/syscall.h
new file mode 100644
index 000000000000..465ac039be09
--- /dev/null
+++ b/arch/m68k/include/asm/syscall.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_M68K_SYSCALL_H
3#define _ASM_M68K_SYSCALL_H
4
5#include <uapi/linux/audit.h>
6
7static inline int syscall_get_arch(struct task_struct *task)
8{
9 return AUDIT_ARCH_M68K;
10}
11
12#endif /* _ASM_M68K_SYSCALL_H */
diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index 833d3a53dab3..3a6924f3cbde 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -105,7 +105,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
105asmlinkage unsigned long do_syscall_trace_enter(struct pt_regs *regs); 105asmlinkage unsigned long do_syscall_trace_enter(struct pt_regs *regs);
106asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 106asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
107 107
108static inline int syscall_get_arch(void) 108static inline int syscall_get_arch(struct task_struct *task)
109{ 109{
110 return AUDIT_ARCH_MICROBLAZE; 110 return AUDIT_ARCH_MICROBLAZE;
111} 111}
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index a2b4748655df..acf80ae0a430 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -141,14 +141,14 @@ extern const unsigned long sys_call_table[];
141extern const unsigned long sys32_call_table[]; 141extern const unsigned long sys32_call_table[];
142extern const unsigned long sysn32_call_table[]; 142extern const unsigned long sysn32_call_table[];
143 143
144static inline int syscall_get_arch(void) 144static inline int syscall_get_arch(struct task_struct *task)
145{ 145{
146 int arch = AUDIT_ARCH_MIPS; 146 int arch = AUDIT_ARCH_MIPS;
147#ifdef CONFIG_64BIT 147#ifdef CONFIG_64BIT
148 if (!test_thread_flag(TIF_32BIT_REGS)) { 148 if (!test_tsk_thread_flag(task, TIF_32BIT_REGS)) {
149 arch |= __AUDIT_ARCH_64BIT; 149 arch |= __AUDIT_ARCH_64BIT;
150 /* N32 sets only TIF_32BIT_ADDR */ 150 /* N32 sets only TIF_32BIT_ADDR */
151 if (test_thread_flag(TIF_32BIT_ADDR)) 151 if (test_tsk_thread_flag(task, TIF_32BIT_ADDR))
152 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; 152 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
153 } 153 }
154#endif 154#endif
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 3a62f80958e1..414b6e9c900b 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -1418,7 +1418,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
1418 unsigned long args[6]; 1418 unsigned long args[6];
1419 1419
1420 sd.nr = syscall; 1420 sd.nr = syscall;
1421 sd.arch = syscall_get_arch(); 1421 sd.arch = syscall_get_arch(current);
1422 syscall_get_arguments(current, regs, args); 1422 syscall_get_arguments(current, regs, args);
1423 for (i = 0; i < 6; i++) 1423 for (i = 0; i < 6; i++)
1424 sd.args[i] = args[i]; 1424 sd.args[i] = args[i];
diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h
index 95f3ea253e4c..02250626b9f0 100644
--- a/arch/nds32/include/asm/elf.h
+++ b/arch/nds32/include/asm/elf.h
@@ -10,14 +10,13 @@
10 10
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#include <asm/fpu.h> 12#include <asm/fpu.h>
13#include <linux/elf-em.h>
13 14
14typedef unsigned long elf_greg_t; 15typedef unsigned long elf_greg_t;
15typedef unsigned long elf_freg_t[3]; 16typedef unsigned long elf_freg_t[3];
16 17
17extern unsigned int elf_hwcap; 18extern unsigned int elf_hwcap;
18 19
19#define EM_NDS32 167
20
21#define R_NDS32_NONE 0 20#define R_NDS32_NONE 0
22#define R_NDS32_16_RELA 19 21#define R_NDS32_16_RELA 19
23#define R_NDS32_32_RELA 20 22#define R_NDS32_32_RELA 20
diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
index 671ebd357496..174b8571d362 100644
--- a/arch/nds32/include/asm/syscall.h
+++ b/arch/nds32/include/asm/syscall.h
@@ -5,6 +5,7 @@
5#ifndef _ASM_NDS32_SYSCALL_H 5#ifndef _ASM_NDS32_SYSCALL_H
6#define _ASM_NDS32_SYSCALL_H 1 6#define _ASM_NDS32_SYSCALL_H 1
7 7
8#include <uapi/linux/audit.h>
8#include <linux/err.h> 9#include <linux/err.h>
9struct task_struct; 10struct task_struct;
10struct pt_regs; 11struct pt_regs;
@@ -145,4 +146,12 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
145 146
146 memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0])); 147 memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
147} 148}
149
150static inline int
151syscall_get_arch(struct task_struct *task)
152{
153 return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)
154 ? AUDIT_ARCH_NDS32BE : AUDIT_ARCH_NDS32;
155}
156
148#endif /* _ASM_NDS32_SYSCALL_H */ 157#endif /* _ASM_NDS32_SYSCALL_H */
diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h
index d7624ed06efb..c4f3f8b86f28 100644
--- a/arch/nios2/include/asm/syscall.h
+++ b/arch/nios2/include/asm/syscall.h
@@ -17,6 +17,7 @@
17#ifndef __ASM_NIOS2_SYSCALL_H__ 17#ifndef __ASM_NIOS2_SYSCALL_H__
18#define __ASM_NIOS2_SYSCALL_H__ 18#define __ASM_NIOS2_SYSCALL_H__
19 19
20#include <uapi/linux/audit.h>
20#include <linux/err.h> 21#include <linux/err.h>
21#include <linux/sched.h> 22#include <linux/sched.h>
22 23
@@ -79,4 +80,9 @@ static inline void syscall_set_arguments(struct task_struct *task,
79 regs->r9 = *args; 80 regs->r9 = *args;
80} 81}
81 82
83static inline int syscall_get_arch(struct task_struct *task)
84{
85 return AUDIT_ARCH_NIOS2;
86}
87
82#endif 88#endif
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index b4ff07c1baed..61de227f53a1 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -68,7 +68,7 @@ syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
68 memcpy(&regs->gpr[3], args, 6 * sizeof(args[0])); 68 memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
69} 69}
70 70
71static inline int syscall_get_arch(void) 71static inline int syscall_get_arch(struct task_struct *task)
72{ 72{
73 return AUDIT_ARCH_OPENRISC; 73 return AUDIT_ARCH_OPENRISC;
74} 74}
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 62a6d477fae0..80757e43cf2c 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -48,11 +48,11 @@ static inline void syscall_rollback(struct task_struct *task,
48 /* do nothing */ 48 /* do nothing */
49} 49}
50 50
51static inline int syscall_get_arch(void) 51static inline int syscall_get_arch(struct task_struct *task)
52{ 52{
53 int arch = AUDIT_ARCH_PARISC; 53 int arch = AUDIT_ARCH_PARISC;
54#ifdef CONFIG_64BIT 54#ifdef CONFIG_64BIT
55 if (!is_compat_task()) 55 if (!__is_compat_task(task))
56 arch = AUDIT_ARCH_PARISC64; 56 arch = AUDIT_ARCH_PARISC64;
57#endif 57#endif
58 return arch; 58 return arch;
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 1243045bad2d..a048fed0722f 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -94,9 +94,15 @@ static inline void syscall_set_arguments(struct task_struct *task,
94 regs->orig_gpr3 = args[0]; 94 regs->orig_gpr3 = args[0];
95} 95}
96 96
97static inline int syscall_get_arch(void) 97static inline int syscall_get_arch(struct task_struct *task)
98{ 98{
99 int arch = is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64; 99 int arch;
100
101 if (IS_ENABLED(CONFIG_PPC64) && !test_tsk_thread_flag(task, TIF_32BIT))
102 arch = AUDIT_ARCH_PPC64;
103 else
104 arch = AUDIT_ARCH_PPC;
105
100#ifdef __LITTLE_ENDIAN__ 106#ifdef __LITTLE_ENDIAN__
101 arch |= __AUDIT_ARCH_LE; 107 arch |= __AUDIT_ARCH_LE;
102#endif 108#endif
diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h
index a3d5273ded7c..0f2fe1794c8f 100644
--- a/arch/riscv/include/asm/syscall.h
+++ b/arch/riscv/include/asm/syscall.h
@@ -88,7 +88,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
88 memcpy(&regs->a1, args, 5 * sizeof(regs->a1)); 88 memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
89} 89}
90 90
91static inline int syscall_get_arch(void) 91static inline int syscall_get_arch(struct task_struct *task)
92{ 92{
93#ifdef CONFIG_64BIT 93#ifdef CONFIG_64BIT
94 return AUDIT_ARCH_RISCV64; 94 return AUDIT_ARCH_RISCV64;
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index ab3407aa4fd8..f073292e9fdb 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -79,10 +79,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
79 regs->orig_gpr2 = args[0]; 79 regs->orig_gpr2 = args[0];
80} 80}
81 81
82static inline int syscall_get_arch(void) 82static inline int syscall_get_arch(struct task_struct *task)
83{ 83{
84#ifdef CONFIG_COMPAT 84#ifdef CONFIG_COMPAT
85 if (test_tsk_thread_flag(current, TIF_31BIT)) 85 if (test_tsk_thread_flag(task, TIF_31BIT))
86 return AUDIT_ARCH_S390; 86 return AUDIT_ARCH_S390;
87#endif 87#endif
88 return AUDIT_ARCH_S390X; 88 return AUDIT_ARCH_S390X;
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 8c9d7e5e5dcc..0b5b8e75edac 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -72,7 +72,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
72 regs->regs[4] = args[0]; 72 regs->regs[4] = args[0];
73} 73}
74 74
75static inline int syscall_get_arch(void) 75static inline int syscall_get_arch(struct task_struct *task)
76{ 76{
77 int arch = AUDIT_ARCH_SH; 77 int arch = AUDIT_ARCH_SH;
78 78
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index 22fad97da066..72efcbc76f91 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -59,7 +59,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
59 memcpy(&regs->regs[2], args, 6 * sizeof(args[0])); 59 memcpy(&regs->regs[2], args, 6 * sizeof(args[0]));
60} 60}
61 61
62static inline int syscall_get_arch(void) 62static inline int syscall_get_arch(struct task_struct *task)
63{ 63{
64 int arch = AUDIT_ARCH_SH; 64 int arch = AUDIT_ARCH_SH;
65 65
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 4d075434e816..62a5a78804c4 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -127,10 +127,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
127 regs->u_regs[UREG_I0 + i] = args[i]; 127 regs->u_regs[UREG_I0 + i] = args[i];
128} 128}
129 129
130static inline int syscall_get_arch(void) 130static inline int syscall_get_arch(struct task_struct *task)
131{ 131{
132#if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT) 132#if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT)
133 return in_compat_syscall() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64; 133 return test_tsk_thread_flag(task, TIF_32BIT)
134 ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
134#elif defined(CONFIG_SPARC64) 135#elif defined(CONFIG_SPARC64)
135 return AUDIT_ARCH_SPARC64; 136 return AUDIT_ARCH_SPARC64;
136#else 137#else
diff --git a/arch/unicore32/include/asm/elf.h b/arch/unicore32/include/asm/elf.h
index 829042d07722..ae66dc1be49e 100644
--- a/arch/unicore32/include/asm/elf.h
+++ b/arch/unicore32/include/asm/elf.h
@@ -19,6 +19,7 @@
19 * ELF register definitions.. 19 * ELF register definitions..
20 */ 20 */
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <linux/elf-em.h>
22 23
23typedef unsigned long elf_greg_t; 24typedef unsigned long elf_greg_t;
24typedef unsigned long elf_freg_t[3]; 25typedef unsigned long elf_freg_t[3];
@@ -28,8 +29,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
28 29
29typedef struct fp_state elf_fpregset_t; 30typedef struct fp_state elf_fpregset_t;
30 31
31#define EM_UNICORE 110
32
33#define R_UNICORE_NONE 0 32#define R_UNICORE_NONE 0
34#define R_UNICORE_PC24 1 33#define R_UNICORE_PC24 1
35#define R_UNICORE_ABS32 2 34#define R_UNICORE_ABS32 2
diff --git a/arch/unicore32/include/asm/syscall.h b/arch/unicore32/include/asm/syscall.h
new file mode 100644
index 000000000000..607961797fff
--- /dev/null
+++ b/arch/unicore32/include/asm/syscall.h
@@ -0,0 +1,12 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_UNICORE_SYSCALL_H
3#define _ASM_UNICORE_SYSCALL_H
4
5#include <uapi/linux/audit.h>
6
7static inline int syscall_get_arch(struct task_struct *task)
8{
9 return AUDIT_ARCH_UNICORE;
10}
11
12#endif /* _ASM_UNICORE_SYSCALL_H */
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 4c305471ec33..b05ad16174e5 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -105,7 +105,7 @@ static inline void syscall_set_arguments(struct task_struct *task,
105 memcpy(&regs->bx + i, args, n * sizeof(args[0])); 105 memcpy(&regs->bx + i, args, n * sizeof(args[0]));
106} 106}
107 107
108static inline int syscall_get_arch(void) 108static inline int syscall_get_arch(struct task_struct *task)
109{ 109{
110 return AUDIT_ARCH_I386; 110 return AUDIT_ARCH_I386;
111} 111}
@@ -160,10 +160,12 @@ static inline void syscall_set_arguments(struct task_struct *task,
160 } 160 }
161} 161}
162 162
163static inline int syscall_get_arch(void) 163static inline int syscall_get_arch(struct task_struct *task)
164{ 164{
165 /* x32 tasks should be considered AUDIT_ARCH_X86_64. */ 165 /* x32 tasks should be considered AUDIT_ARCH_X86_64. */
166 return in_ia32_syscall() ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64; 166 return (IS_ENABLED(CONFIG_IA32_EMULATION) &&
167 task->thread_info.status & TS_COMPAT)
168 ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64;
167} 169}
168#endif /* CONFIG_X86_32 */ 170#endif /* CONFIG_X86_32 */
169 171
diff --git a/arch/x86/um/asm/syscall.h b/arch/x86/um/asm/syscall.h
index ef898af102d1..56a2f0913e3c 100644
--- a/arch/x86/um/asm/syscall.h
+++ b/arch/x86/um/asm/syscall.h
@@ -9,7 +9,7 @@ typedef asmlinkage long (*sys_call_ptr_t)(unsigned long, unsigned long,
9 unsigned long, unsigned long, 9 unsigned long, unsigned long,
10 unsigned long, unsigned long); 10 unsigned long, unsigned long);
11 11
12static inline int syscall_get_arch(void) 12static inline int syscall_get_arch(struct task_struct *task)
13{ 13{
14#ifdef CONFIG_X86_32 14#ifdef CONFIG_X86_32
15 return AUDIT_ARCH_I386; 15 return AUDIT_ARCH_I386;
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index 91dc06d58060..359ab40e935a 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -14,7 +14,7 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <uapi/linux/audit.h> 15#include <uapi/linux/audit.h>
16 16
17static inline int syscall_get_arch(void) 17static inline int syscall_get_arch(struct task_struct *task)
18{ 18{
19 return AUDIT_ARCH_XTENSA; 19 return AUDIT_ARCH_XTENSA;
20} 20}