diff options
author | Will Deacon <will.deacon@arm.com> | 2014-06-27 12:01:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-06-29 05:29:35 -0400 |
commit | 42309ab450b608ddcfafa90e4cfa93a5001ecfba (patch) | |
tree | fb60021f23adfdff7d525d88e8b6c50f14f138f0 /arch/arm/kernel | |
parent | 6980c3e2514e5ae36b43ec8302f4920d6e3c9434 (diff) |
ARM: 8087/1: ptrace: reload syscall number after secure_computing() check
On the syscall tracing path, we call out to secure_computing() to allow
seccomp to check the syscall number being attempted. As part of this, a
SIGTRAP may be sent to the tracer and the syscall could be re-written by
a subsequent SET_SYSCALL ptrace request. Unfortunately, this new syscall
is ignored by the current code unless TIF_SYSCALL_TRACE is also set on
the current thread.
This patch slightly reworks the enter path of the syscall tracing code
so that we always reload the syscall number from
current_thread_info()->syscall after the potential ptrace traps.
Acked-by: Kees Cook <keescook@chromium.org>
Tested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/ptrace.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 0dd3b79b15c3..0c27ed6f3f23 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -908,7 +908,7 @@ enum ptrace_syscall_dir { | |||
908 | PTRACE_SYSCALL_EXIT, | 908 | PTRACE_SYSCALL_EXIT, |
909 | }; | 909 | }; |
910 | 910 | ||
911 | static int tracehook_report_syscall(struct pt_regs *regs, | 911 | static void tracehook_report_syscall(struct pt_regs *regs, |
912 | enum ptrace_syscall_dir dir) | 912 | enum ptrace_syscall_dir dir) |
913 | { | 913 | { |
914 | unsigned long ip; | 914 | unsigned long ip; |
@@ -926,7 +926,6 @@ static int tracehook_report_syscall(struct pt_regs *regs, | |||
926 | current_thread_info()->syscall = -1; | 926 | current_thread_info()->syscall = -1; |
927 | 927 | ||
928 | regs->ARM_ip = ip; | 928 | regs->ARM_ip = ip; |
929 | return current_thread_info()->syscall; | ||
930 | } | 929 | } |
931 | 930 | ||
932 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | 931 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) |
@@ -938,7 +937,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | |||
938 | return -1; | 937 | return -1; |
939 | 938 | ||
940 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 939 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
941 | scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); | 940 | tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); |
941 | |||
942 | scno = current_thread_info()->syscall; | ||
942 | 943 | ||
943 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 944 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
944 | trace_sys_enter(regs, scno); | 945 | trace_sys_enter(regs, scno); |