mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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 Commit78a498c3a2already 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:ff901d80ff("x86: kmsan: use __msan_ string functions where possible.") Fixes:78a498c3a2("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>
This commit is contained in:
parent
faebcf725c
commit
3555409e52
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user