Hi,

The below patch fixes a lockdep error in 2.6.23-rc9 when using tcp_probe.

---

Subject: lockdep: annotate kprobes irq fiddling

kprobes disables irqs for jprobes, but does not tell lockdep about it.

CC: Prasanna S Panchamukhi <[EMAIL PROTECTED]>
CC: Ananth N Mavinakayanahalli <[EMAIL PROTECTED]>
CC: Anil S Keshavamurthy <[EMAIL PROTECTED]>
CC: David S. Miller <[EMAIL PROTECTED]>
Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]>
Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/i386/kernel/kprobes.c   |    8 ++++++++
 arch/x86_64/kernel/kprobes.c |    8 ++++++++
 2 files changed, 16 insertions(+)

Index: linux-2.6-2/arch/i386/kernel/kprobes.c
===================================================================
--- linux-2.6-2.orig/arch/i386/kernel/kprobes.c
+++ linux-2.6-2/arch/i386/kernel/kprobes.c
@@ -558,6 +558,13 @@ static int __kprobes post_kprobe_handler
 
        resume_execution(cur, regs, kcb);
        regs->eflags |= kcb->kprobe_saved_eflags;
+#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
+       if (raw_irqs_disabled_flags(regs->eflags)) {
+               trace_hardirqs_off();
+       } else {
+               trace_hardirqs_on();
+       }
+#endif
 
        /*Restore back the original saved kprobes variables and continue. */
        if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -695,6 +702,7 @@ int __kprobes setjmp_pre_handler(struct 
        memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
                        MIN_STACK_SIZE(addr));
        regs->eflags &= ~IF_MASK;
+       trace_hardirqs_off();
        regs->eip = (unsigned long)(jp->entry);
        return 1;
 }
Index: linux-2.6-2/arch/x86_64/kernel/kprobes.c
===================================================================
--- linux-2.6-2.orig/arch/x86_64/kernel/kprobes.c
+++ linux-2.6-2/arch/x86_64/kernel/kprobes.c
@@ -545,6 +545,13 @@ int __kprobes post_kprobe_handler(struct
 
        resume_execution(cur, regs, kcb);
        regs->eflags |= kcb->kprobe_saved_rflags;
+#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
+       if (raw_irqs_disabled_flags(regs->eflags)) {
+               trace_hardirqs_off();
+       } else {
+               trace_hardirqs_on();
+       }
+#endif
 
        /* Restore the original saved kprobes variables and continue. */
        if (kcb->kprobe_status == KPROBE_REENTER) {
@@ -685,6 +692,7 @@ int __kprobes setjmp_pre_handler(struct 
        memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr,
                        MIN_STACK_SIZE(addr));
        regs->eflags &= ~IF_MASK;
+       trace_hardirqs_off();
        regs->rip = (unsigned long)(jp->entry);
        return 1;
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to