summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2026-06-18 16:29:43 +0200
committerKees Cook <kees@kernel.org>2026-09-21 21:26:10 -0700
commit3555409e524a0279845f91273ba714998658c163 (patch)
treedf76cbebd0b2f211469f9aa709c25c64bd6b0d3d /include/linux
parentfaebcf725c5a7b278cecc8eac2e4f4f46bfa050b (diff)
downloadlinux-next-3555409e524a0279845f91273ba714998658c163.tar.gz
linux-next-3555409e524a0279845f91273ba714998658c163.zip
KMSAN: fix memset() when using fortify-source, again
Both kmsan and fortify-source replace the memset function. When both are enabled at the same time, the kmsan version gets used, which triggers a warning about fortify-source being nonfunctional: warning: unsafe memset() usage lacked '__write_overflow' symbol in /home/arnd/arm-soc/lib/test_fortify/write_overflow-memset.c warning: unsafe memset() usage lacked '__write_overflow_field' symbol in /home/arnd/arm-soc/lib/test_fortify/write_overflow_field-memset.c Commit 78a498c3a227 already tried to address this, but this seems to only have worked for memcpy() and memmove() but not memset(), which is still lacking the macro definition when KMSAN is enabled. Remove the incorrect #ifndef check around the memset() macro. Fixes: ff901d80fff6 ("x86: kmsan: use __msan_ string functions where possible.") Fixes: 78a498c3a227 ("x86: fortify: kmsan: fix KMSAN fortify builds") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260618142951.1739694-1-arnd@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fortify-string.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index cf841dc71fef..7e7c369e0a6c 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -458,10 +458,8 @@ __FORTIFY_INLINE bool fortify_memset_chk(__kernel_size_t size,
* __struct_size() vs __member_size() must be captured here to avoid
* evaluating argument side-effects further into the macro layers.
*/
-#ifndef CONFIG_KMSAN
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
__struct_size(p), __member_size(p))
-#endif
/*
* To make sure the compiler can enforce protection against buffer overflows,