From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Andy Lutomirski <luto@kernel.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Chris Metcalf <cmetcalf@mellanox.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Helge Deller <deller@gmx.de>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
James Hogan <james.hogan@imgtec.com>,
Jeff Dike <jdike@addtoit.com>,
linux-arch@vger.kernel.org, linux-mips@linux-mips.org,
linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org,
"Maciej W. Rozycki" <macro@imgtec.com>,
Mark Rutland <mark.rutland@arm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Paul Mackerras <paulus@samba.org>,
Ralf Baechle <ralf@linux-mips.org>,
Richard Weinberger <richard@no>
Subject: [PATCH 07/14] arm/ptrace: run seccomp after ptrace
Date: Thu, 9 Jun 2016 14:01:57 -0700 [thread overview]
Message-ID: <1465506124-21866-8-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1465506124-21866-1-git-send-email-keescook@chromium.org>
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
next prev parent reply other threads:[~2016-06-09 21:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160609210150.02iS_UclFlk_k7F0bR5WeuTNvzgPV0QghkKvuUN5tIY@z>
2016-06-09 21:01 ` [PATCH 00/14] run seccomp after ptrace Kees Cook
[not found] ` <20160609210151.wY7r1jw5K8xeUNCEJmr9EUt6_YWJe34oTtadbXudu3c@z>
2016-06-09 21:01 ` [PATCH 01/14] seccomp: add tests for ptrace hole Kees Cook
[not found] ` <20160609210152.edXN5td_n_Bis1qhyhhnsh3K6XHfN7HxTRHpDbRSdWE@z>
2016-06-09 21:01 ` [PATCH 02/14] seccomp: Add a seccomp_data parameter secure_computing() Kees Cook
[not found] ` <20160609210153.BJ11_uq2ikL9pQKfBqCET0aHxkBRAXQj0MKFhCwU_HA@z>
2016-06-09 21:01 ` [PATCH 03/14] x86/entry: Get rid of two-phase syscall entry work Kees Cook
2016-06-09 21:01 ` [PATCH 04/14] seccomp: remove 2-phase API Kees Cook
[not found] ` <20160609210155.K_X-rqF7-klzYm1ai2IK7iH182VEO2fxDfEmT3MQEZI@z>
2016-06-09 21:01 ` [PATCH 05/14] seccomp: recheck the syscall after RET_TRACE Kees Cook
2016-06-09 22:46 ` Andy Lutomirski
2016-06-09 21:01 ` [PATCH 06/14] x86/ptrace: run seccomp after ptrace Kees Cook
2016-06-09 22:52 ` Andy Lutomirski
2016-06-10 2:01 ` Kees Cook
2016-06-14 2:27 ` Andy Lutomirski
2016-06-09 21:01 ` Kees Cook [this message]
2016-06-09 21:01 ` [PATCH 08/14] arm64/ptrace: " Kees Cook
2016-06-09 21:01 ` [PATCH 09/14] MIPS/ptrace: " Kees Cook
2016-06-09 21:02 ` [PATCH 10/14] parisc/ptrace: " Kees Cook
[not found] ` <20160609210201.Hu_D_1eK9Yd13IIzyOuO-xbcqtl3euj0e-_8XojxVRA@z>
2016-06-09 21:02 ` [PATCH 11/14] s390/ptrace: " Kees Cook
2016-06-10 10:51 ` Martin Schwidefsky
[not found] ` <20160609210202.B5BzbBxK7f4zHGjVA5R7YMb9RBk5Txc940xHfuYhPsQ@z>
2016-06-09 21:02 ` [PATCH 12/14] powerpc/ptrace: " Kees Cook
2016-06-09 21:02 ` [PATCH 13/14] tile/ptrace: " Kees Cook
[not found] ` <20160609210204.ZdmFDgRqxJbnsDo8OHw_X98phKMFf9sFUP8eRBT9Lsg@z>
2016-06-09 21:02 ` [PATCH 14/14] um/ptrace: " Kees Cook
2016-06-13 20:50 ` [PATCH 00/14] " Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465506124-21866-8-git-send-email-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=benh@kernel.crashing.org \
--cc=catalin.marinas@arm.com \
--cc=cmetcalf@mellanox.com \
--cc=deller@gmx.de \
--cc=heiko.carstens@de.ibm.com \
--cc=james.hogan@imgtec.com \
--cc=jdike@addtoit.com \
--cc=jejb@parisc-linux.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@kernel.org \
--cc=macro@imgtec.com \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=richard@no \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox