All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] parisc/kprobes: always include asm-generic/kprobes.h
@ 2024-02-11 23:09 Max Kellermann
  2024-02-16 13:29 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Max Kellermann @ 2024-02-11 23:09 UTC (permalink / raw)
  To: svens, James.Bottomley, deller, mcgrof, linux-parisc,
	linux-trace-kernel, linux-kernel
  Cc: 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).

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.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 arch/parisc/include/asm/kprobes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/parisc/include/asm/kprobes.h b/arch/parisc/include/asm/kprobes.h
index 0a175ac87698..0f42f5c8e3b6 100644
--- a/arch/parisc/include/asm/kprobes.h
+++ b/arch/parisc/include/asm/kprobes.h
@@ -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>
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] parisc/kprobes: always include asm-generic/kprobes.h
  2024-02-11 23:09 [PATCH] parisc/kprobes: always include asm-generic/kprobes.h Max Kellermann
@ 2024-02-16 13:29 ` Helge Deller
  0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2024-02-16 13:29 UTC (permalink / raw)
  To: Max Kellermann, svens, James.Bottomley, mcgrof, linux-parisc,
	linux-trace-kernel, linux-kernel

On 2/12/24 00:09, Max Kellermann wrote:
> 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.
>
> Signed-off-by: Max Kellermann <max.kellermann@ionos.com>

applied to parisc git tree.

Thanks!
Helge


> ---
>   arch/parisc/include/asm/kprobes.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/parisc/include/asm/kprobes.h b/arch/parisc/include/asm/kprobes.h
> index 0a175ac87698..0f42f5c8e3b6 100644
> --- a/arch/parisc/include/asm/kprobes.h
> +++ b/arch/parisc/include/asm/kprobes.h
> @@ -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>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-16 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-11 23:09 [PATCH] parisc/kprobes: always include asm-generic/kprobes.h Max Kellermann
2024-02-16 13:29 ` Helge Deller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.