[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1337875681-20717-3-git-send-email-wad@chromium.org>
Date: Thu, 24 May 2012 11:08:00 -0500
From: Will Drewry <wad@...omium.org>
To: linux-kernel@...r.kernel.org
Cc: mcgrathr@...gle.com, hpa@...or.com, indan@....nu,
netdev@...isplace.org, linux-security-module@...r.kernel.org,
kernel-hardening@...ts.openwall.com, mingo@...hat.com,
oleg@...hat.com, peterz@...radead.org, rdunlap@...otime.net,
tglx@...utronix.de, luto@....edu, serge.hallyn@...onical.com,
pmoore@...hat.com, akpm@...ux-foundation.org, corbet@....net,
markus@...omium.org, coreyb@...ux.vnet.ibm.com,
keescook@...omium.org, viro@...iv.linux.org.uk, jmorris@...ei.org,
Will Drewry <wad@...omium.org>
Subject: [RFC PATCH 2/3] arch/x86: move secure_computing after ptrace
At present, seccomp modes 1 and 2 may have their
behavior changed by a ptrace()ing task. The ptracer
cannot change blocked/disallowed system calls, but it can
change allowed system calls to calls that would otherwise
not be allowed by the seccomp policy.
Signed-off-by: Will Drewry <wad@...omium.org>
---
arch/x86/kernel/ptrace.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 13b1990..ad649a6 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1479,13 +1479,6 @@ long syscall_trace_enter(struct pt_regs *regs)
if (test_thread_flag(TIF_SINGLESTEP))
regs->flags |= X86_EFLAGS_TF;
- /* do the secure computing check first */
- if (secure_computing(regs->orig_ax)) {
- /* seccomp failures shouldn't expose any additional code. */
- ret = -1L;
- goto out;
- }
-
if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
ret = -1L;
@@ -1493,6 +1486,12 @@ long syscall_trace_enter(struct pt_regs *regs)
tracehook_report_syscall_entry(regs))
ret = -1L;
+ /* check secure computing after userspace can't change the syscall. */
+ if (!ret && secure_computing(regs->orig_ax)) {
+ ret = -1L;
+ goto out;
+ }
+
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->orig_ax);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists