Skip to contentSkip to conversation

kmsan-compiler_types-declare-__no_sanitize_or_inline.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message May 6, 2024 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kmsan: compiler_types: declare __no_sanitize_or_inline
has been removed from the -mm tree. Its filename was
kmsan-compiler_types-declare-__no_sanitize_or_inline.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Alexander Potapenko <[email protected]>
Subject: kmsan: compiler_types: declare __no_sanitize_or_inline
Date: Fri, 26 Apr 2024 11:16:22 +0200

It turned out that KMSAN instruments READ_ONCE_NOCHECK(), resulting in false positive reports, because __no_sanitize_or_inline enforced inlining.

Properly declare __no_sanitize_or_inline under __SANITIZE_MEMORY__, so that it does not __always_inline the annotated function.

---

 include/linux/compiler_types.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
include/linux/compiler_types.h renamed from include/linux/compiler_types.h~kmsan-compiler_types-declare-__no_sanitize_or_inline +11 -0
@@ -278,6 +278,17 @@ struct ftrace_likely_data {
 # define __no_kcsan
 #endif
 
+#ifdef __SANITIZE_MEMORY__
+/*
+ * Similarly to KASAN and KCSAN, KMSAN loses function attributes of inlined
+ * functions, therefore disabling KMSAN checks also requires disabling inlining.
+ *
+ * __no_sanitize_or_inline effectively prevents KMSAN from reporting errors
+ * within the function and marks all its outputs as initialized.
+ */
+# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused
+#endif
+
 #ifndef __no_sanitize_or_inline
 #define __no_sanitize_or_inline __always_inline
 #endif

_

Patches currently in -mm which might be from [email protected] are