Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kprobes: unify kprobes_exceptions_nofify() prototypes

Most architectures that support kprobes declare this function in their
own asm/kprobes.h header and provide an override, but some are missing
the prototype, which causes a warning for the __weak stub implementation:

kernel/kprobes.c:1865:12: error: no previous prototype for 'kprobe_exceptions_notify' [-Werror=missing-prototypes]
1865 | int __weak kprobe_exceptions_notify(struct notifier_block *self,

Move the prototype into linux/kprobes.h so it is visible to all
the definitions.

Link: https://lore.kernel.org/all/20231108125843.3806765-4-arnd@kernel.org/

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

authored by

Arnd Bergmann and committed by
Masami Hiramatsu (Google)
abc28463 3afe7337

+4 -19
-3
arch/arc/include/asm/kprobes.h
··· 32 32 33 33 void arch_remove_kprobe(struct kprobe *p); 34 34 35 - int kprobe_exceptions_notify(struct notifier_block *self, 36 - unsigned long val, void *data); 37 - 38 35 struct prev_kprobe { 39 36 struct kprobe *kp; 40 37 unsigned long status;
-2
arch/arm/include/asm/kprobes.h
··· 40 40 41 41 void arch_remove_kprobe(struct kprobe *); 42 42 int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); 43 - int kprobe_exceptions_notify(struct notifier_block *self, 44 - unsigned long val, void *data); 45 43 46 44 /* optinsn template addresses */ 47 45 extern __visible kprobe_opcode_t optprobe_template_entry[];
-2
arch/arm64/include/asm/kprobes.h
··· 37 37 38 38 void arch_remove_kprobe(struct kprobe *); 39 39 int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); 40 - int kprobe_exceptions_notify(struct notifier_block *self, 41 - unsigned long val, void *data); 42 40 void __kretprobe_trampoline(void); 43 41 void __kprobes *trampoline_probe_handler(struct pt_regs *regs); 44 42
-2
arch/mips/include/asm/kprobes.h
··· 71 71 struct prev_kprobe prev_kprobe; 72 72 }; 73 73 74 - extern int kprobe_exceptions_notify(struct notifier_block *self, 75 - unsigned long val, void *data); 76 74 77 75 #endif /* CONFIG_KPROBES */ 78 76 #endif /* _ASM_KPROBES_H */
-2
arch/powerpc/include/asm/kprobes.h
··· 84 84 kprobe_opcode_t *insn; 85 85 }; 86 86 87 - extern int kprobe_exceptions_notify(struct notifier_block *self, 88 - unsigned long val, void *data); 89 87 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 90 88 extern int kprobe_handler(struct pt_regs *regs); 91 89 extern int kprobe_post_handler(struct pt_regs *regs);
-2
arch/s390/include/asm/kprobes.h
··· 73 73 void arch_remove_kprobe(struct kprobe *p); 74 74 75 75 int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 76 - int kprobe_exceptions_notify(struct notifier_block *self, 77 - unsigned long val, void *data); 78 76 79 77 #define flush_insn_slot(p) do { } while (0) 80 78
-2
arch/sh/include/asm/kprobes.h
··· 46 46 }; 47 47 48 48 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 49 - extern int kprobe_exceptions_notify(struct notifier_block *self, 50 - unsigned long val, void *data); 51 49 extern int kprobe_handle_illslot(unsigned long pc); 52 50 #else 53 51
-2
arch/sparc/include/asm/kprobes.h
··· 47 47 struct prev_kprobe prev_kprobe; 48 48 }; 49 49 50 - int kprobe_exceptions_notify(struct notifier_block *self, 51 - unsigned long val, void *data); 52 50 int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 53 51 asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, 54 52 struct pt_regs *regs);
-2
arch/x86/include/asm/kprobes.h
··· 113 113 }; 114 114 115 115 extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 116 - extern int kprobe_exceptions_notify(struct notifier_block *self, 117 - unsigned long val, void *data); 118 116 extern int kprobe_int3_handler(struct pt_regs *regs); 119 117 120 118 #else
+4
include/linux/kprobes.h
··· 445 445 446 446 int arch_kprobe_get_kallsym(unsigned int *symnum, unsigned long *value, 447 447 char *type, char *sym); 448 + 449 + int kprobe_exceptions_notify(struct notifier_block *self, 450 + unsigned long val, void *data); 451 + 448 452 #else /* !CONFIG_KPROBES: */ 449 453 450 454 static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)