Skip to contentSkip to conversation

include/linux/kprobes.h: always offer show_registers() prototype

PATCH In review Adrian Bunk 3 participants 4 messages Apr 26, 2007 – Apr 28, 2007 kprobes

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include/linux/kprobes.h: always offer show_registers() prototype

Allow gcc to perform show_registers() type checking also with CONFIG_KPROBES=n.

---

This patch has been sent on:
- 27 Mar 2007

 include/linux/kprobes.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/kprobes.h renamed from include/linux/kprobes.h.old +3 -1
@@ -163,7 +163,6 @@
 extern void arch_arm_kprobe(struct kprobe *p);
 extern void arch_disarm_kprobe(struct kprobe *p);
 extern int arch_init_kprobes(void);
-extern void show_registers(struct pt_regs *regs);
 extern kprobe_opcode_t *get_insn_slot(void);
 extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
@@ -241,4 +240,7 @@
 {
 }
 #endif				/* CONFIG_KPROBES */
+
+void show_registers(struct pt_regs *regs);
+
 #endif				/* _LINUX_KPROBES_H */
#1 lore raw
Quoted 2 lines · Adrian Bunk

Allow gcc to perform show_registers() type checking also with CONFIG_KPROBES=n.

Is kprobes.h the correct place to allow for this change? Perhaps, with Christoph's patch http://marc.info/?l=linux-kernel&m=117432009501114&w=2
consolidating the die_notifier code, this could be moved to include/linux/kdebug.h instead?

Ananth

Quoted 29 lines

---

This patch has been sent on:
- 27 Mar 2007

 include/linux/kprobes.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/kprobes.h renamed from include/linux/kprobes.h.old +3 -1
@@ -163,7 +163,6 @@
 extern void arch_arm_kprobe(struct kprobe *p);
 extern void arch_disarm_kprobe(struct kprobe *p);
 extern int arch_init_kprobes(void);
-extern void show_registers(struct pt_regs *regs);
 extern kprobe_opcode_t *get_insn_slot(void);
 extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
 extern void kprobes_inc_nmissed_count(struct kprobe *p);
@@ -241,4 +240,7 @@
 {
 }
 #endif				/* CONFIG_KPROBES */
+
+void show_registers(struct pt_regs *regs);
+
 #endif				/* _LINUX_KPROBES_H */
#2 lore raw
Quoted 9 lines · On Fri, 27 Apr 2007 10:40:57 +0530 Ananth N Mavinakayanahalli…
Quoted 2 lines · Adrian Bunk

Allow gcc to perform show_registers() type checking also with CONFIG_KPROBES=n.

Is kprobes.h the correct place to allow for this change? Perhaps, with Christoph's patch http://marc.info/?l=linux-kernel&m=117432009501114&w=2
consolidating the die_notifier code, this could be moved to include/linux/kdebug.h instead?

Yes, I think something is definitely wrong here. If the code is presently calling show_registers() with no prototype in scope, it should be emitting warnings?

Also, yes, kprobes.h is an inappropriate place for this declaration. It should be in include/asm-foo/, I guess.

But if we do that, there's an excellent chance of a compile explosion, because we also have implementations of show_registers() in drivers/net/wireless/ipw2100.c, drivers/usb/gadget/net2280.c, drivers/usb/host/ehci-dbg.c, drivers/usb/host/ohci-dbg.c and who knows where else.

So what I'd suggest is that we rename show_registers() to something saner, then put the declaration into some arch header file then include that header in kprobes.

#3 lore raw
Quoted 13 lines · Andrew Morton
Quoted 9 lines · On Fri, 27 Apr 2007 10:40:57 +0530 Ananth N Mavinakayanahalli…
Quoted 2 lines · Adrian Bunk

Allow gcc to perform show_registers() type checking also with CONFIG_KPROBES=n.

Is kprobes.h the correct place to allow for this change? Perhaps, with Christoph's patch http://marc.info/?l=linux-kernel&m=117432009501114&w=2
consolidating the die_notifier code, this could be moved to include/linux/kdebug.h instead?

Quoted 3 lines

Yes, I think something is definitely wrong here. If the code is presently calling show_registers() with no prototype in scope, it should be emitting warnings?

No, it's not a caller but the function itself that is present wiith CONFIG_KPROBES=n, giving me warnings with -Wmissing-prototypes.

Quoted 2 lines

Also, yes, kprobes.h is an inappropriate place for this declaration. It should be in include/asm-foo/, I guess.

Currently, we have partially both...

And include/linux/ sounds like a better place it the prototype should be the same on all architectures.

Quoted 9 lines

But if we do that, there's an excellent chance of a compile explosion, because we also have implementations of show_registers() in drivers/net/wireless/ipw2100.c, drivers/usb/gadget/net2280.c, drivers/usb/host/ehci-dbg.c, drivers/usb/host/ohci-dbg.c and who knows where else.

So what I'd suggest is that we rename show_registers() to something saner, then put the declaration into some arch header file then include that header in kprobes.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed