diff mbox series

[v3,14/34] mm: slub: Let KMSAN access metadata

Message ID 20231213233605.661251-15-iii@linux.ibm.com (mailing list archive)
State Handled Elsewhere
Headers show
Series kmsan: Enable on s390 | expand

Commit Message

Ilya Leoshkevich Dec. 13, 2023, 11:24 p.m. UTC
Building the kernel with CONFIG_SLUB_DEBUG and CONFIG_KMSAN causes
KMSAN to complain about touching redzones in kfree().

Fix by extending the existing KASAN-related metadata_access_enable()
and metadata_access_disable() functions to KMSAN.

Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 mm/slub.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index b111bc315e3f..2d29d368894c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -700,10 +700,12 @@  static int disable_higher_order_debug;
 static inline void metadata_access_enable(void)
 {
 	kasan_disable_current();
+	kmsan_disable_current();
 }
 
 static inline void metadata_access_disable(void)
 {
+	kmsan_enable_current();
 	kasan_enable_current();
 }