lkml.org 
[lkml]   [2008]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/4] Add support for userspace stacktraces in tracing/iter_ctrl
    On 2008-10-12 16:31, Frédéric Weisbecker wrote:
    > 2008/10/12 Török Edwin <edwintorok@gmail.com>:
    >
    >> +static int copy_stack_frame(const void __user *fp, struct stack_frame *frame)
    >> +{
    >> + int ret;
    >> +
    >> + if (!access_ok(VERIFY_READ, fp, sizeof(*frame)))
    >> + return 0;
    >> +
    >> + ret = 1;
    >> + pagefault_disable();
    >> + if (__copy_from_user_inatomic(frame, fp, sizeof(*frame)))
    >> + ret = 0;
    >> + pagefault_enable();
    >> +
    >> + return ret;
    >> +}
    >> +
    >>
    >
    > Hello Török,
    >
    > I don't understand why you are using this pagefault disabling and
    > atomic copy here.
    > Wouldn't a simple copy_from_user actually take of this? You don't seem
    > to be in atomic
    > context.
    >

    Hello,

    This function is called from ftrace, as such I could be holding a
    spinlock. It can also be called from
    __rwsem_do_wake, which takes a spinlock.
    This code is from sysprof's copy_stack_frame. Maybe pagefault_disable()
    is not needed.

    Best regards,
    --Edwin
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2008-10-12 15:55    [W:4.054 / U:0.172 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site