diff options
Diffstat (limited to 'arch/x86/include/asm/syscall.h')
-rw-r--r-- | arch/x86/include/asm/syscall.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h index 386b78686c4d..1ace47b62592 100644 --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h | |||
@@ -13,9 +13,11 @@ | |||
13 | #ifndef _ASM_X86_SYSCALL_H | 13 | #ifndef _ASM_X86_SYSCALL_H |
14 | #define _ASM_X86_SYSCALL_H | 14 | #define _ASM_X86_SYSCALL_H |
15 | 15 | ||
16 | #include <linux/audit.h> | ||
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/err.h> | 18 | #include <linux/err.h> |
18 | #include <asm/asm-offsets.h> /* For NR_syscalls */ | 19 | #include <asm/asm-offsets.h> /* For NR_syscalls */ |
20 | #include <asm/thread_info.h> /* for TS_COMPAT */ | ||
19 | #include <asm/unistd.h> | 21 | #include <asm/unistd.h> |
20 | 22 | ||
21 | extern const unsigned long sys_call_table[]; | 23 | extern const unsigned long sys_call_table[]; |
@@ -88,6 +90,12 @@ static inline void syscall_set_arguments(struct task_struct *task, | |||
88 | memcpy(®s->bx + i, args, n * sizeof(args[0])); | 90 | memcpy(®s->bx + i, args, n * sizeof(args[0])); |
89 | } | 91 | } |
90 | 92 | ||
93 | static inline int syscall_get_arch(struct task_struct *task, | ||
94 | struct pt_regs *regs) | ||
95 | { | ||
96 | return AUDIT_ARCH_I386; | ||
97 | } | ||
98 | |||
91 | #else /* CONFIG_X86_64 */ | 99 | #else /* CONFIG_X86_64 */ |
92 | 100 | ||
93 | static inline void syscall_get_arguments(struct task_struct *task, | 101 | static inline void syscall_get_arguments(struct task_struct *task, |
@@ -212,6 +220,25 @@ static inline void syscall_set_arguments(struct task_struct *task, | |||
212 | } | 220 | } |
213 | } | 221 | } |
214 | 222 | ||
223 | static inline int syscall_get_arch(struct task_struct *task, | ||
224 | struct pt_regs *regs) | ||
225 | { | ||
226 | #ifdef CONFIG_IA32_EMULATION | ||
227 | /* | ||
228 | * TS_COMPAT is set for 32-bit syscall entry and then | ||
229 | * remains set until we return to user mode. | ||
230 | * | ||
231 | * TIF_IA32 tasks should always have TS_COMPAT set at | ||
232 | * system call time. | ||
233 | * | ||
234 | * x32 tasks should be considered AUDIT_ARCH_X86_64. | ||
235 | */ | ||
236 | if (task_thread_info(task)->status & TS_COMPAT) | ||
237 | return AUDIT_ARCH_I386; | ||
238 | #endif | ||
239 | /* Both x32 and x86_64 are considered "64-bit". */ | ||
240 | return AUDIT_ARCH_X86_64; | ||
241 | } | ||
215 | #endif /* CONFIG_X86_32 */ | 242 | #endif /* CONFIG_X86_32 */ |
216 | 243 | ||
217 | #endif /* _ASM_X86_SYSCALL_H */ | 244 | #endif /* _ASM_X86_SYSCALL_H */ |