提交 203f7907 编写于 作者: A Andy Lutomirski 提交者: Linus Torvalds

sparc/syscall: fix syscall_get_arch

Sparc's syscall_get_arch was buggy: it returned the task arch, not the
syscall arch.  This could confuse seccomp and audit.

I don't think this is as bad for seccomp as it looks: sparc's 32-bit and
64-bit syscalls are numbered the same.
Signed-off-by: NAndy Lutomirski <luto@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 069923d8
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <uapi/linux/audit.h> #include <uapi/linux/audit.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
...@@ -128,7 +129,13 @@ static inline void syscall_set_arguments(struct task_struct *task, ...@@ -128,7 +129,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
static inline int syscall_get_arch(void) static inline int syscall_get_arch(void)
{ {
return is_32bit_task() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64; #if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT)
return in_compat_syscall() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
#elif defined(CONFIG_SPARC64)
return AUDIT_ARCH_SPARC64;
#else
return AUDIT_ARCH_SPARC;
#endif
} }
#endif /* __ASM_SPARC_SYSCALL_H */ #endif /* __ASM_SPARC_SYSCALL_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册