Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1418668
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 07/14] arm/ptrace: run seccomp after ptrace |
| Date | 2016-06-09 23:10 +0200 |
| Message-ID | <rIfnc-3pv-59@gated-at.bofh.it> (permalink) |
| References | <rIfnb-3pv-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Close the hole where ptrace can change a syscall out from under seccomp.
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
---
arch/arm/kernel/ptrace.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index ad5e90ab165c..dc7b372872ff 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -932,18 +932,19 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
{
current_thread_info()->syscall = scno;
- /* Do the secure computing check first; failures should be fast. */
+ if (test_thread_flag(TIF_SYSCALL_TRACE))
+ tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
+
+ /* Do seccomp after ptrace; syscall may have changed. */
#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
if (secure_computing(NULL) == -1)
return -1;
#else
/* XXX: remove this once OABI gets fixed */
- secure_computing_strict(scno);
+ secure_computing_strict(current_thread_info()->syscall);
#endif
- if (test_thread_flag(TIF_SYSCALL_TRACE))
- tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
-
+ /* Tracer or seccomp may have changed syscall. */
scno = current_thread_info()->syscall;
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/14] run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
[PATCH 10/14] parisc/ptrace: run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
[PATCH 11/14] s390/ptrace: run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
Re: [PATCH 11/14] s390/ptrace: run seccomp after ptrace Martin Schwidefsky <schwidefsky@de.ibm.com> - 2016-06-10 13:00 +0200
[PATCH 01/14] seccomp: add tests for ptrace hole Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
[PATCH 05/14] seccomp: recheck the syscall after RET_TRACE Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
Re: [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE Andy Lutomirski <luto@amacapital.net> - 2016-06-10 00:50 +0200
[PATCH 06/14] x86/ptrace: run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
Re: [PATCH 06/14] x86/ptrace: run seccomp after ptrace Andy Lutomirski <luto@amacapital.net> - 2016-06-10 01:00 +0200
Re: [PATCH 06/14] x86/ptrace: run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-10 04:10 +0200
[PATCH 07/14] arm/ptrace: run seccomp after ptrace Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
[PATCH 03/14] x86/entry: Get rid of two-phase syscall entry work Kees Cook <keescook@chromium.org> - 2016-06-09 23:10 +0200
csiph-web