|
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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.