21 May, 2011

1 commit

  • * 'ptrace' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc: (41 commits)
    signal: trivial, fix the "timespec declared inside parameter list" warning
    job control: reorganize wait_task_stopped()
    ptrace: fix signal->wait_chldexit usage in task_clear_group_stop_trapping()
    signal: sys_sigprocmask() needs retarget_shared_pending()
    signal: cleanup sys_sigprocmask()
    signal: rename signandsets() to sigandnsets()
    signal: do_sigtimedwait() needs retarget_shared_pending()
    signal: introduce do_sigtimedwait() to factor out compat/native code
    signal: sys_rt_sigtimedwait: simplify the timeout logic
    signal: cleanup sys_rt_sigprocmask()
    x86: signal: sys_rt_sigreturn() should use set_current_blocked()
    x86: signal: handle_signal() should use set_current_blocked()
    signal: sigprocmask() should do retarget_shared_pending()
    signal: sigprocmask: narrow the scope of ->siglock
    signal: retarget_shared_pending: optimize while_each_thread() loop
    signal: retarget_shared_pending: consider shared/unblocked signals only
    signal: introduce retarget_shared_pending()
    ptrace: ptrace_check_attach() should not do s/STOPPED/TRACED/
    signal: Turn SIGNAL_STOP_DEQUEUED into GROUP_STOP_DEQUEUED
    signal: do_signal_stop: Remove the unneeded task_clear_group_stop_pending()
    ...

    Linus Torvalds
     

25 Apr, 2011

1 commit

  • When a task is traced and is in a stopped state, the tracer
    may execute a ptrace request to examine the tracee state and
    get its task struct. Right after, the tracee can be killed
    and thus its breakpoints released.
    This can happen concurrently when the tracer is in the middle
    of reading or modifying these breakpoints, leading to dereferencing
    a freed pointer.

    Hence, to prepare the fix, create a generic breakpoint reference
    holding API. When a reference on the breakpoints of a task is
    held, the breakpoints won't be released until the last reference
    is dropped. After that, no more ptrace request on the task's
    breakpoints can be serviced for the tracer.

    Reported-by: Oleg Nesterov
    Signed-off-by: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Will Deacon
    Cc: Prasad
    Cc: Paul Mundt
    Cc: v2.6.33..
    Link: http://lkml.kernel.org/r/1302284067-7860-2-git-send-email-fweisbec@gmail.com

    Frederic Weisbecker
     


04 Apr, 2011

1 commit

  • After "ptrace: Clean transitions between TASK_STOPPED and TRACED"
    d79fdd6d96f46fabb779d86332e3677c6f5c2a4f, ptrace_check_attach()
    should never see a TASK_STOPPED tracee and s/STOPPED/TRACED/ is
    no longer legal. Add the warning.

    Note: ptrace_check_attach() can be greatly simplified, in particular
    it doesn't need tasklist. But I'd prefer another patch for that.

    Signed-off-by: Oleg Nesterov
    Signed-off-by: Tejun Heo

    Oleg Nesterov
     

24 Mar, 2011

1 commit

  • ptrace is allowed to tasks in the same user namespace according to the
    usual rules (i.e. the same rules as for two tasks in the init user
    namespace). ptrace is also allowed to a user namespace to which the
    current task the has CAP_SYS_PTRACE capability.

    Changelog:
    Dec 31: Address feedback by Eric:
    . Correct ptrace uid check
    . Rename may_ptrace_ns to ptrace_capable
    . Also fix the cap_ptrace checks.
    Jan 1: Use const cred struct
    Jan 11: use task_ns_capable() in place of ptrace_capable().
    Feb 23: same_or_ancestore_user_ns() was not an appropriate
    check to constrain cap_issubset. Rather, cap_issubset()
    only is meaningful when both capsets are in the same
    user_ns.

    Signed-off-by: Serge E. Hallyn
    Cc: "Eric W. Biederman"
    Acked-by: Daniel Lezcano
    Acked-by: David Howells
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn
     

23 Mar, 2011

4 commits

  • Currently, __ptrace_unlink() wakes up the tracee iff it's in
    TASK_TRACED. For unlinking from PTRACE_DETACH, this is correct as the
    tracee is guaranteed to be in TASK_TRACED or dead; however, unlinking
    also happens when the ptracer exits and in this case the ptracee can
    be in any state and ptrace might be left running even if the group it
    belongs to is stopped.

    This patch updates __ptrace_unlink() such that GROUP_STOP_PENDING is
    reinstated regardless of the ptracee's current state as long as it's
    alive and makes sure that signal_wake_up() is called if execution
    state transition is necessary.

    Test case follows.

    #include
    #include
    #include
    #include
    #include

    static const struct timespec ts1s = { .tv_sec = 1 };

    int main(void)
    {
    pid_t tracee;
    siginfo_t si;

    tracee = fork();
    if (tracee == 0) {
    while (1) {
    nanosleep(&ts1s, NULL);
    write(1, ".", 1);
    }
    }

    ptrace(PTRACE_ATTACH, tracee, NULL, NULL);
    waitid(P_PID, tracee, &si, WSTOPPED);
    ptrace(PTRACE_CONT, tracee, NULL, (void *)(long)si.si_status);
    waitid(P_PID, tracee, &si, WSTOPPED);
    ptrace(PTRACE_CONT, tracee, NULL, (void *)(long)si.si_status);
    write(1, "exiting", 7);
    return 0;
    }

    Before the patch, after the parent process exits, the child is left
    running and prints out "." every second.

    exiting..... (continues)

    After the patch, the group stop initiated by the implied SIGSTOP from
    PTRACE_ATTACH is re-established when the parent exits.

    exiting

    Signed-off-by: Tejun Heo
    Reported-by: Oleg Nesterov
    Acked-by: Oleg Nesterov

    Tejun Heo
     
  • Remove the extra task_is_traced() check in __ptrace_unlink() and
    collapse ptrace_untrace() into __ptrace_unlink(). This is to prepare
    for further changes.

    While at it, drop the comment on top of ptrace_untrace() and convert
    __ptrace_unlink() comment to docbook format. Detailed comment will be
    added by the next patch.

    This patch doesn't cause any visible behavior changes.

    Signed-off-by: Tejun Heo
    Acked-by: Oleg Nesterov

    Tejun Heo
     
  • Currently, if the task is STOPPED on ptrace attach, it's left alone
    and the state is silently changed to TRACED on the next ptrace call.
    The behavior breaks the assumption that arch_ptrace_stop() is called
    before any task is poked by ptrace and is ugly in that a task
    manipulates the state of another task directly.

    With GROUP_STOP_PENDING, the transitions between TASK_STOPPED and
    TRACED can be made clean. The tracer can use the flag to tell the
    tracee to retry stop on attach and detach. On retry, the tracee will
    enter the desired state in the correct way. The lower 16bits of
    task->group_stop is used to remember the signal number which caused
    the last group stop. This is used while retrying for ptrace attach as
    the original group_exit_code could have been consumed with wait(2) by
    then.

    As the real parent may wait(2) and consume the group_exit_code
    anytime, the group_exit_code needs to be saved separately so that it
    can be used when switching from regular sleep to ptrace_stop(). This
    is recorded in the lower 16bits of task->group_stop.

    If a task is already stopped and there's no intervening SIGCONT, a
    ptrace request immediately following a successful PTRACE_ATTACH should
    always succeed even if the tracer doesn't wait(2) for attach
    completion; however, with this change, the tracee might still be
    TASK_RUNNING trying to enter TASK_TRACED which would cause the
    following request to fail with -ESRCH.

    This intermediate state is hidden from the ptracer by setting
    GROUP_STOP_TRAPPING on attach and making ptrace_check_attach() wait
    for it to clear on its signal->wait_chldexit. Completing the
    transition or getting killed clears TRAPPING and wakes up the tracer.

    Note that the STOPPED -> RUNNING -> TRACED transition is still visible
    to other threads which are in the same group as the ptracer and the
    reverse transition is visible to all. Please read the comments for
    details.

    Oleg:

    * Spotted a race condition where a task may retry group stop without
    proper bookkeeping. Fixed by redoing bookkeeping on retry.

    * Spotted that the transition is visible to userland in several
    different ways. Most are fixed with GROUP_STOP_TRAPPING. Unhandled
    corner case is documented.

    * Pointed out not setting GROUP_STOP_SIGMASK on an already stopped
    task would result in more consistent behavior.

    * Pointed out that calling ptrace_stop() from do_signal_stop() in
    TASK_STOPPED can race with group stop start logic and then confuse
    the TRAPPING wait in ptrace_check_attach(). ptrace_stop() is now
    called with TASK_RUNNING.

    * Suggested using signal->wait_chldexit instead of bit wait.

    * Spotted a race condition between TRACED transition and clearing of
    TRAPPING.

    Signed-off-by: Tejun Heo
    Acked-by: Oleg Nesterov
    Cc: Roland McGrath
    Cc: Jan Kratochvil

    Tejun Heo
     
  • This wake_up_state() has a turbulent history. This is a remnant from
    ancient ptrace implementation and patently wrong. Commit 95a3540d
    (ptrace_detach: the wrong wakeup breaks the ERESTARTxxx logic) removed
    it but the change was reverted later by commit edaba2c5 (ptrace:
    revert "ptrace_detach: the wrong wakeup breaks the ERESTARTxxx logic")
    citing compatibility breakage and general brokeness of the whole group
    stop / ptrace interaction. Then, recently, it got converted from
    wake_up_process() to wake_up_state() to make it less dangerous.

    Digging through the mailing archives, the compatibility breakage
    doesn't seem to be critical in the sense that the behavior isn't well
    defined or reliable to begin with and it seems to have been agreed to
    remove the wakeup with proper cleanup of the whole thing.

    Now that the group stop and its interaction with ptrace are being
    cleaned up, it's high time to finally kill this silliness.

    Signed-off-by: Tejun Heo
    Acked-by: Oleg Nesterov
    Cc: Roland McGrath

    Tejun Heo
     

05 Mar, 2011

1 commit


12 Feb, 2011

1 commit

  • The wake_up_process() call in ptrace_detach() is spurious and not
    interlocked with the tracee state. IOW, the tracee could be running or
    sleeping in any place in the kernel by the time wake_up_process() is
    called. This can lead to the tracee waking up unexpectedly which can be
    dangerous.

    The wake_up is spurious and should be removed but for now reduce its
    toxicity by only waking up if the tracee is in TRACED or STOPPED state.

    This bug can possibly be used as an attack vector. I don't think it
    will take too much effort to come up with an attack which triggers oops
    somewhere. Most sleeps are wrapped in condition test loops and should
    be safe but we have quite a number of places where sleep and wakeup
    conditions are expected to be interlocked. Although the window of
    opportunity is tiny, ptrace can be used by non-privileged users and with
    some loading the window can definitely be extended and exploited.

    Signed-off-by: Tejun Heo
    Acked-by: Roland McGrath
    Acked-by: Oleg Nesterov
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

28 Oct, 2010

4 commits

  • Oleg Nesterov pointed out we have to prevent multiple-threads-inside-exec
    itself and we can reuse ->cred_guard_mutex for it. Yes, concurrent
    execve() has no worth.

    Let's move ->cred_guard_mutex from task_struct to signal_struct. It
    naturally prevent multiple-threads-inside-exec.

    Signed-off-by: KOSAKI Motohiro
    Reviewed-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Acked-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KOSAKI Motohiro
     
  • Use new 'datavp' and 'datalp' variables to remove unnecesary castings.

    Signed-off-by: Namhyung Kim
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     
  • Since userspace API of ptrace syscall defines @addr and @data as void
    pointers, it would be more appropriate to define them as unsigned long in
    kernel. Therefore related functions are changed also.

    'unsigned long' is typically used in other places in kernel as an opaque
    data type and that using this helps cleaning up a lot of warnings from
    sparse.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Namhyung Kim
    Acked-by: Arnd Bergmann
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     
  • exit_ptrace() releases and regrabs tasklist_lock but was missing proper
    annotation. Add it.

    Signed-off-by: Namhyung Kim
    Acked-by: Roland McGrath
    Cc: Ingo Molnar
    Cc: Oleg Nesterov
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     

11 Aug, 2010

1 commit

  • exit_ptrace() takes tasklist_lock unconditionally. We need this lock to
    avoid the race with ptrace_traceme(), it acts as a barrier.

    Change its caller, forget_original_parent(), to call exit_ptrace() under
    tasklist_lock. Change exit_ptrace() to drop and reacquire this lock if
    needed.

    This allows us to add the fastpath list_empty(ptraced) check. In the
    likely no-tracees case exit_ptrace() just returns and we avoid the lock()
    + unlock() sequence.

    "Zhang, Yanmin" suggested to add this
    check, and he reports that this change adds about 11% improvement in some
    tests.

    Suggested-and-tested-by: "Zhang, Yanmin"
    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

28 May, 2010

2 commits

  • Now that Mike Frysinger unified the FDPIC ptrace code, we can fix the
    unsafe usage of child->mm in ptrace_request(PTRACE_GETFDPIC).

    We have the reference to task_struct, and ptrace_check_attach() verified
    the tracee is stopped. But nothing can protect from SIGKILL after that,
    we must not assume child->mm != NULL.

    Signed-off-by: Oleg Nesterov
    Acked-by: Mike Frysinger
    Acked-by: David Howells
    Cc: Paul Mundt
    Cc: Greg Ungerer
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • The Blackfin/FRV/SuperH guys all have the same exact FDPIC ptrace code in
    their arch handlers (since they were probably copied & pasted). Since
    these ptrace interfaces are an arch independent aspect of the FDPIC code,
    unify them in the common ptrace code so new FDPIC ports don't need to copy
    and paste this fundamental stuff yet again.

    Signed-off-by: Mike Frysinger
    Acked-by: Roland McGrath
    Acked-by: David Howells
    Acked-by: Paul Mundt
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Frysinger
     

18 May, 2010

1 commit

  • …git/tip/linux-2.6-tip

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
    perf tools: Add mode to build without newt support
    perf symbols: symbol inconsistency message should be done only at verbose=1
    perf tui: Add explicit -lslang option
    perf options: Type check all the remaining OPT_ variants
    perf options: Type check OPT_BOOLEAN and fix the offenders
    perf options: Check v type in OPT_U?INTEGER
    perf options: Introduce OPT_UINTEGER
    perf tui: Add workaround for slang < 2.1.4
    perf record: Fix bug mismatch with -c option definition
    perf options: Introduce OPT_U64
    perf tui: Add help window to show key associations
    perf tui: Make <- exit menus too
    perf newt: Add single key shortcuts for zoom into DSO and threads
    perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
    perf newt: Fix the 'A'/'a' shortcut for annotate
    perf newt: Make <- exit the ui_browser
    x86, perf: P4 PMU - fix counters management logic
    perf newt: Make <- zoom out filters
    perf report: Report number of events, not samples
    perf hist: Clarify events_stats fields usage
    ...

    Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c

    Linus Torvalds
     

27 Apr, 2010

1 commit

  • BKL isn't present anymore into this file thus we can safely remove
    smp_lock.h inclusion.

    Signed-off-by: Alessio Igor Bogani
    Cc: Roland McGrath
    Cc: Oleg Nesterov
    Cc: Andrew Morton
    Cc: James Morris
    Cc: Ingo Molnar
    Signed-off-by: Frederic Weisbecker

    Alessio Igor Bogani
     

10 Apr, 2010

1 commit

  • The comment suggests that this usage is stale. There is no bkl in the
    exec path so if there is a race lurking there, the bkl in ptrace is
    not going to help in this regard.

    Overview of the possibility of "accidental" races this bkl might
    protect:

    - ptrace_traceme() is protected against task removal and concurrent
    read/write on current->ptrace as it locks write tasklist_lock.

    - arch_ptrace_attach() is serialized by ptrace_traceme() against
    concurrent PTRACE_TRACEME or PTRACE_ATTACH

    - ptrace_attach() is protected the same way ptrace_traceme() and
    in turn serializes arch_ptrace_attach()

    - ptrace_check_attach() does its own well described serializing too.

    There is no obvious race here.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Frederic Weisbecker
    Acked-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Cc: Andrew Morton
    Cc: Roland McGrath

    Arnd Bergmann
     

26 Mar, 2010

1 commit

  • Support for the PMU's BTS features has been upstreamed in
    v2.6.32, but we still have the old and disabled ptrace-BTS,
    as Linus noticed it not so long ago.

    It's buggy: TIF_DEBUGCTLMSR is trampling all over that MSR without
    regard for other uses (perf) and doesn't provide the flexibility
    needed for perf either.

    Its users are ptrace-block-step and ptrace-bts, since ptrace-bts
    was never used and ptrace-block-step can be implemented using a
    much simpler approach.

    So axe all 3000 lines of it. That includes the *locked_memory*()
    APIs in mm/mlock.c as well.

    Reported-by: Linus Torvalds
    Signed-off-by: Peter Zijlstra
    Cc: Roland McGrath
    Cc: Oleg Nesterov
    Cc: Markus Metzger
    Cc: Steven Rostedt
    Cc: Andrew Morton
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

24 Feb, 2010

1 commit


12 Feb, 2010

1 commit

  • Generic support for PTRACE_GETREGSET/PTRACE_SETREGSET commands which
    export the regsets supported by each architecture using the correponding
    NT_* types. These NT_* types are already part of the userland ABI, used
    in representing the architecture specific register sets as different NOTES
    in an ELF core file.

    'addr' parameter for the ptrace system call encode the REGSET type (using
    the corresppnding NT_* type) and the 'data' parameter points to the
    struct iovec having the user buffer and the length of that buffer.

    struct iovec iov = { buf, len};
    ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);

    On successful completion, iov.len will be updated by the kernel specifying
    how much the kernel has written/read to/from the user's iov.buf.

    x86 extended state registers are primarily exported using this interface.

    Signed-off-by: Suresh Siddha
    LKML-Reference:
    Acked-by: Hongjiu Lu
    Cc: Roland McGrath
    Signed-off-by: H. Peter Anvin

    Suresh Siddha
     

24 Sep, 2009

1 commit

  • The bug is old, it wasn't cause by recent changes.

    Test case:

    static void *tfunc(void *arg)
    {
    int pid = (long)arg;

    assert(ptrace(PTRACE_ATTACH, pid, NULL, NULL) == 0);
    kill(pid, SIGKILL);

    sleep(1);
    return NULL;
    }

    int main(void)
    {
    pthread_t th;
    long pid = fork();

    if (!pid)
    pause();

    signal(SIGCHLD, SIG_IGN);
    assert(pthread_create(&th, NULL, tfunc, (void*)pid) == 0);

    int r = waitpid(-1, NULL, __WNOTHREAD);
    printf("waitpid: %d %m\n", r);

    return 0;
    }

    Before the patch this program hangs, after this patch waitpid() correctly
    fails with errno == -ECHILD.

    The problem is, __ptrace_detach() reaps the EXIT_ZOMBIE tracee if its
    ->real_parent is our sub-thread and we ignore SIGCHLD. But in this case
    we should wake up other threads which can sleep in do_wait().

    Signed-off-by: Oleg Nesterov
    Cc: Roland McGrath
    Cc: Vitaly Mayatskikh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

13 Jul, 2009

1 commit


07 Jul, 2009

1 commit

  • do_execve() and ptrace_attach() return -EINTR if
    mutex_lock_interruptible(->cred_guard_mutex) fails.

    This is not right, change the code to return ERESTARTNOINTR.

    Perhaps we should also change proc_pid_attr_write().

    Signed-off-by: Oleg Nesterov
    Cc: David Howells
    Acked-by: Roland McGrath
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

24 Jun, 2009

1 commit


19 Jun, 2009

5 commits

  • Change ptrace_getsiginfo/ptrace_setsiginfo to use lock_task_sighand()
    without tasklist_lock. Perhaps it makes sense to make a single helper
    with "bool rw" argument.

    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • - Use rcu_read_lock() instead of tasklist_lock to find/get the task
    in ptrace_get_task_struct().

    - Make it static, it has no callers outside of ptrace.c.

    - The comment doesn't match the reality, this helper does not do
    any checks. Beacuse it is really trivial and static I removed the
    whole comment.

    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Remove the "Nasty, nasty" lock dance in ptrace_attach()/ptrace_traceme() -
    from now task_lock() has nothing to do with ptrace at all.

    With the recent changes nobody uses task_lock() to serialize with ptrace,
    but in fact it was never needed and it was never used consistently.

    However ptrace_attach() calls __ptrace_may_access() and needs task_lock()
    to pin task->mm for get_dumpable(). But we can call __ptrace_may_access()
    before we take tasklist_lock, ->cred_exec_mutex protects us against
    do_execve() path which can change creds and MMF_DUMP* flags.

    (ugly, but we can't use ptrace_may_access() because it hides the error
    code, so we have to take task_lock() and use __ptrace_may_access()).

    NOTE: this change assumes that LSM hooks, security_ptrace_may_access() and
    security_ptrace_traceme(), can be called without task_lock() held.

    Signed-off-by: Oleg Nesterov
    Cc: Chris Wright
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • ptrace_attach() and ptrace_traceme() are the last functions which look as
    if the untraced task can have task->ptrace != 0, this must not be
    possible. Change the code to just check ->ptrace != 0 and s/|=/=/ to set
    PT_PTRACED.

    Also, a couple of trivial whitespace cleanups in ptrace_attach().

    And move ptrace_traceme() up near ptrace_attach() to keep them close to
    each other.

    Signed-off-by: Oleg Nesterov
    Cc: Chris Wright
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • - Add PF_KTHREAD check to prevent attaching to the kernel thread
    with a borrowed ->mm.

    With or without this change we can race with daemonize() which
    can set PF_KTHREAD or clear ->mm after ptrace_attach() does the
    check, but this doesn't matter because reparent_to_kthreadd()
    does ptrace_unlink().

    - Kill "!task->mm" check. We don't really care about ->mm != NULL,
    and the task can call exit_mm() right after we drop task_lock().
    What we need is to make sure we can't attach after exit_notify(),
    check task->exit_state != 0 instead.

    Also, move the "already traced" check down for cosmetic reasons.

    Signed-off-by: Oleg Nesterov
    Cc: Chris Wright
    Acked-by: Roland McGrath
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

12 Jun, 2009

1 commit

  • …s/security-testing-2.6

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (44 commits)
    nommu: Provide mmap_min_addr definition.
    TOMOYO: Add description of lists and structures.
    TOMOYO: Remove unused field.
    integrity: ima audit dentry_open failure
    TOMOYO: Remove unused parameter.
    security: use mmap_min_addr indepedently of security models
    TOMOYO: Simplify policy reader.
    TOMOYO: Remove redundant markers.
    SELinux: define audit permissions for audit tree netlink messages
    TOMOYO: Remove unused mutex.
    tomoyo: avoid get+put of task_struct
    smack: Remove redundant initialization.
    integrity: nfsd imbalance bug fix
    rootplug: Remove redundant initialization.
    smack: do not beyond ARRAY_SIZE of data
    integrity: move ima_counts_get
    integrity: path_check update
    IMA: Add __init notation to ima functions
    IMA: Minimal IMA policy and boot param for TCB IMA policy
    selinux: remove obsolete read buffer limit from sel_read_bool
    ...

    Linus Torvalds
     

11 Jun, 2009

1 commit

  • * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (244 commits)
    Revert "x86, bts: reenable ptrace branch trace support"
    tracing: do not translate event helper macros in print format
    ftrace/documentation: fix typo in function grapher name
    tracing/events: convert block trace points to TRACE_EVENT(), fix !CONFIG_BLOCK
    tracing: add protection around module events unload
    tracing: add trace_seq_vprint interface
    tracing: fix the block trace points print size
    tracing/events: convert block trace points to TRACE_EVENT()
    ring-buffer: fix ret in rb_add_time_stamp
    ring-buffer: pass in lockdep class key for reader_lock
    tracing: add annotation to what type of stack trace is recorded
    tracing: fix multiple use of __print_flags and __print_symbolic
    tracing/events: fix output format of user stack
    tracing/events: fix output format of kernel stack
    tracing/trace_stack: fix the number of entries in the header
    ring-buffer: discard timestamps that are at the start of the buffer
    ring-buffer: try to discard unneeded timestamps
    ring-buffer: fix bug in ring_buffer_discard_commit
    ftrace: do not profile functions when disabled
    tracing: make trace pipe recognize latency format flag
    ...

    Linus Torvalds
     

09 Jun, 2009

1 commit


05 Jun, 2009

1 commit

  • Commit 95a3540da9c81a5987be810e1d9a83640a366bd5 ("ptrace_detach: the wrong
    wakeup breaks the ERESTARTxxx logic") removed the "extra"
    wake_up_process() from ptrace_detach(), but as Jan pointed out this breaks
    the compatibility.

    I believe the changelog is right and this wake_up() is wrong in many
    ways, but GDB assumes that ptrace(PTRACE_DETACH, child, 0, 0) always
    wakes up the tracee.

    Despite the fact this breaks SIGNAL_STOP_STOPPED/group_stop_count logic,
    and despite the fact this wake_up_process() can break another
    assumption: PTRACE_DETACH with SIGSTOP should leave the tracee in
    TASK_STOPPED case. Because the untraced child can dequeue SIGSTOP and
    call do_signal_stop() before ptrace_detach() calls wake_up_process().

    Revert this change for now. We need some fixes even if we we want to keep
    the current behaviour, but these fixes are not for 2.6.30.

    Signed-off-by: Oleg Nesterov
    Acked-by: Roland McGrath
    Cc: Jan Kratochvil
    Cc: Denys Vlasenko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

11 May, 2009

1 commit


07 May, 2009

1 commit


27 Apr, 2009

1 commit