[lkml]   [2008]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    SubjectRe: [Bug 10489] Kprobe smoke test lockdep warning
    Hi Peter,

    Thank you for the patch,

    Peter Zijlstra wrote:
    > So the below makes it work - but I'm not getting this code; at the time
    > I wrote that stuff I CC'ed each and every kprobe maintainer listed in
    > the usual places but got no reposonse - can some please explain this
    > stuff to me?

    Sure, I came to the same decision. It is enough to remove unnecessary
    trace_hardirqs_fixup_flags() from post_kprobe_handler. pt_regs->flags is
    just a variable on stack -- not effective flags in that time. So we don't
    need to change thread's hardirq flag.

    > Are the saved flags only for the TF bit or are they made in full effect
    > later (and if so, where) ?

    The saved flags is for TF and IF bits.
    Actually, kprobes does following:

    prepare_singlestep() : save regs->flags, set TF and clear IF on regs->flags
    "iret" : pop regs->flags image to EFLAGS reg.

    <single step an instruction>

    post_kprobe_handler() : restore regs->flags (clearing TF and restoring IF)
    "iret" : pop regs->flags image to EFLAGS reg.

    While executing a single step, EFLAGS is different from the original EFLAGS.
    However, it will be recovered soon by post_kprobe_handler.
    NOTE: if the single-stepping instruction is a pushf, kprobes writes saved
    EFLAGS to the top of stack.

    > Signed-off-by: Peter Zijlstra <>

    I tested it on x86-64/i386.

    Acked-by: Masami Hiramatsu <>

    > ---
    > diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
    > index 34a5912..fe71e64 100644
    > --- a/arch/x86/kernel/kprobes.c
    > +++ b/arch/x86/kernel/kprobes.c
    > @@ -865,7 +865,6 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
    > resume_execution(cur, regs, kcb);
    > regs->flags |= kcb->kprobe_saved_flags;
    > - trace_hardirqs_fixup_flags(regs->flags);
    > /* Restore back the original saved kprobes variables and continue. */
    > if (kcb->kprobe_status == KPROBE_REENTER) {

    Masami Hiramatsu

    Software Engineer
    Hitachi Computer Products (America) Inc.
    Software Solutions Division


     \ /
      Last update: 2008-04-22 18:21    [W:0.028 / U:1.148 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site