Skip to contentSkip to conversation

parisc/kprobes: always include asm-generic/kprobes.h

PATCH Applied Max Kellermann 2 participants 2 messages Feb 11, 2024 – Feb 16, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parisc/kprobes: always include asm-generic/kprobes.h

The NOKPROBE_SYMBOL macro (and others) were moved to asm-generic/kprobes.h in 2017 by commit 7d134b2ce639 ("kprobes: move kprobe declarations to asm-generic/kprobes.h"), and this new header was included by asm/kprobes.h unconditionally on all architectures.

When kprobe support was added to parisc in 2017 by commit 8858ac8e9e9b1 ("parisc: Implement kprobes"), that header was only included when CONFIG_KPROBES was enabled.

This can lead to build failures when NOKPROBE_SYMBOL is used, but CONFIG_KPROBES is disabled. This mistake however was never actually noticed because linux/kprobes.h also includes asm-generic/kprobes.h (though I do not understand why that is, because it also includes asm/kprobes.h).

To prevent eventual build failures, I suggest to always include asm-generic/kprobes.h on parisc, just like all the other architectures do. This way, including asm/kprobes.h suffices, and nobody (outside of arch/) ever needs to explicitly include asm-generic/kprobes.h.

---
 arch/parisc/include/asm/kprobes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/include/asm/kprobes.h +2 -1
index 0a175ac87698..0f42f5c8e3b6 100644
@@ -10,9 +10,10 @@
 #ifndef _PARISC_KPROBES_H
 #define _PARISC_KPROBES_H
 
+#include <asm-generic/kprobes.h>
+
 #ifdef CONFIG_KPROBES
 
-#include <asm-generic/kprobes.h>
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/notifier.h>
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 15 lines · Max Kellermann

The NOKPROBE_SYMBOL macro (and others) were moved to asm-generic/kprobes.h in 2017 by commit 7d134b2ce639 ("kprobes: move kprobe declarations to asm-generic/kprobes.h"), and this new header was included by asm/kprobes.h unconditionally on all architectures.

When kprobe support was added to parisc in 2017 by commit 8858ac8e9e9b1 ("parisc: Implement kprobes"), that header was only included when CONFIG_KPROBES was enabled.

This can lead to build failures when NOKPROBE_SYMBOL is used, but CONFIG_KPROBES is disabled. This mistake however was never actually noticed because linux/kprobes.h also includes asm-generic/kprobes.h (though I do not understand why that is, because it also includes asm/kprobes.h).

Quoted 6 lines

To prevent eventual build failures, I suggest to always include asm-generic/kprobes.h on parisc, just like all the other architectures do. This way, including asm/kprobes.h suffices, and nobody (outside of arch/) ever needs to explicitly include asm-generic/kprobes.h.

applied to parisc git tree.

Thanks!
Helge

Quoted 20 lines
---
  arch/parisc/include/asm/kprobes.h | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/parisc/include/asm/kprobes.h +2 -1
index 0a175ac87698..0f42f5c8e3b6 100644
@@ -10,9 +10,10 @@
  #ifndef _PARISC_KPROBES_H
  #define _PARISC_KPROBES_H
 
+#include <asm-generic/kprobes.h>
+
  #ifdef CONFIG_KPROBES
 
-#include <asm-generic/kprobes.h>
  #include <linux/types.h>
  #include <linux/ptrace.h>
  #include <linux/notifier.h>