lkml.org 
[lkml]   [2012]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 2/3] arch/x86: move secure_computing after ptrace
    Date
    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@chromium.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


    \
     
     \ /
      Last update: 2012-05-24 20:02    [W:0.033 / U:59.064 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site