* [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux
@ 2025-05-28 11:30 Ahmad Fatoum
2025-05-28 11:30 ` [PATCH 2/2] compiler: check for __SANITIZE_ADDRESS__ instead of CONFIG_KASAN Ahmad Fatoum
2025-05-28 20:10 ` [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-05-28 11:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The __no_kasan_or_inline attribute is already defined in <linux/compiler.h>.
Drop it from the header here and do the replacement in its own commit.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/linux/compiler_types.h | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 87ab117aca13..cd618e7dece1 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -378,26 +378,6 @@ struct ftrace_likely_data {
*/
#define noinline_for_stack noinline
-/*
- * Sanitizer helper attributes: Because using __always_inline and
- * __no_sanitize_* conflict, provide helper attributes that will either expand
- * to __no_sanitize_* in compilation units where instrumentation is enabled
- * (__SANITIZE_*__), or __always_inline in compilation units without
- * instrumentation (__SANITIZE_*__ undefined).
- */
-#ifdef __SANITIZE_ADDRESS__
-/*
- * We can't declare function 'inline' because __no_sanitize_address conflicts
- * with inlining. Attempt to inline it may cause a build failure.
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
- * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
- */
-# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
-# define __no_sanitize_or_inline __no_kasan_or_inline
-#else
-# define __no_kasan_or_inline __always_inline
-#endif
-
#ifndef __no_sanitize_or_inline
#define __no_sanitize_or_inline __always_inline
#endif
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] compiler: check for __SANITIZE_ADDRESS__ instead of CONFIG_KASAN
2025-05-28 11:30 [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Ahmad Fatoum
@ 2025-05-28 11:30 ` Ahmad Fatoum
2025-05-28 20:10 ` [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-05-28 11:30 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The current Linux definition for __no_kasan_or_inline adds a notrace
attribute and checks __SANITIZE_ADDRESS__ instead of CONFIG_KASAN.
Checking __SANITIZE_ADDRESS__ is better because it also applies to
CONFIG_ASAN, so import the Linux version into <linux/compiler_types.h>,
which is the same location it's defined at in Linux.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/linux/compiler.h | 12 ------------
include/linux/compiler_types.h | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index e7dc9ba0a590..4953121711ba 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -168,18 +168,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#include <linux/types.h>
-#ifdef CONFIG_KASAN
-/*
- * We can't declare function 'inline' because __no_sanitize_address confilcts
- * with inlining. Attempt to inline it may cause a build failure.
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
- * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
- */
-# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
-#else
-# define __no_kasan_or_inline __always_inline
-#endif
-
#endif /* __KERNEL__ */
/**
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index cd618e7dece1..87ab117aca13 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -378,6 +378,26 @@ struct ftrace_likely_data {
*/
#define noinline_for_stack noinline
+/*
+ * Sanitizer helper attributes: Because using __always_inline and
+ * __no_sanitize_* conflict, provide helper attributes that will either expand
+ * to __no_sanitize_* in compilation units where instrumentation is enabled
+ * (__SANITIZE_*__), or __always_inline in compilation units without
+ * instrumentation (__SANITIZE_*__ undefined).
+ */
+#ifdef __SANITIZE_ADDRESS__
+/*
+ * We can't declare function 'inline' because __no_sanitize_address conflicts
+ * with inlining. Attempt to inline it may cause a build failure.
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
+ * '__maybe_unused' allows us to avoid defined-but-not-used warnings.
+ */
+# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
+# define __no_sanitize_or_inline __no_kasan_or_inline
+#else
+# define __no_kasan_or_inline __always_inline
+#endif
+
#ifndef __no_sanitize_or_inline
#define __no_sanitize_or_inline __always_inline
#endif
--
2.39.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux
2025-05-28 11:30 [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Ahmad Fatoum
2025-05-28 11:30 ` [PATCH 2/2] compiler: check for __SANITIZE_ADDRESS__ instead of CONFIG_KASAN Ahmad Fatoum
@ 2025-05-28 20:10 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-05-28 20:10 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 28 May 2025 13:30:49 +0200, Ahmad Fatoum wrote:
> The __no_kasan_or_inline attribute is already defined in <linux/compiler.h>.
> Drop it from the header here and do the replacement in its own commit.
>
>
Applied, thanks!
[1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux
https://git.pengutronix.de/cgit/barebox/commit/?id=c6b626c4eed6 (link may not be stable)
[2/2] compiler: check for __SANITIZE_ADDRESS__ instead of CONFIG_KASAN
https://git.pengutronix.de/cgit/barebox/commit/?id=0d321ab1a307 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-28 20:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-28 11:30 [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Ahmad Fatoum
2025-05-28 11:30 ` [PATCH 2/2] compiler: check for __SANITIZE_ADDRESS__ instead of CONFIG_KASAN Ahmad Fatoum
2025-05-28 20:10 ` [PATCH 1/2] fixup! arch: sync READ_ONCE/WRITE_ONCE with Linux Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox