lkml.org 
[lkml]   [2011]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/7] ptrace: move SIGTRAP on exec(2) logic to ptrace_event()
    On 06/17, Tejun Heo wrote:
    >
    > Move SIGTRAP on exec(2) logic from tracehook_report_exec() to
    > ptrace_event(). This is part of changes to make ptrace_event()
    > smarter and handle ptrace event related details in one place.

    I am going to apply all patches except 6/7, but to be honest this
    one looks a bit ugly to me.

    > -static inline int ptrace_event(int event, unsigned long message)
    > +static inline void ptrace_event(int event, unsigned long message)
    > {
    > - if (likely(!ptrace_event_enabled(current, event)))
    > - return false;
    > - current->ptrace_message = message;
    > - ptrace_notify((event << 8) | SIGTRAP);
    > - return true;
    > + if (unlikely(ptrace_event_enabled(current, event))) {
    > + current->ptrace_message = message;
    > + ptrace_notify((event << 8) | SIGTRAP);
    > + } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) {
    > + /* legacy EXEC report via SIGTRAP */
    > + send_sig(SIGTRAP, current, 0);
    > + }

    Why does this make ptrace_event() smarter?

    OK, tracehooks should die. But why should we move this special case
    into ptrace_event? Say, a simple

    static inline void ptrace_exec_event(...)
    {
    if (!ptrace_event_enabled(PTRACE_EVENT_EXEC))
    send_sig(SIGTRAP, current, 0);
    else
    ptrace_event(PTRACE_EVENT_EXEC);
    }

    in fs/exec.c looks a bit better to me.

    Oleg.



    \
     
     \ /
      Last update: 2011-06-20 22:29    [W:2.551 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site