[PATCH] lockdep: annotate kprobes irq fiddling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux