From: Ilya Leoshkevich Date: Fri, 21 Jun 2024 11:35:01 +0000 (+0200) Subject: mm: slub: let KMSAN access metadata X-Git-Tag: v6.11-rc1~85^2~190 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e9a8550f320db944e4cf036d93c5debf0e574a7;p=thirdparty%2Flinux.git mm: slub: let KMSAN access metadata 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. Link: https://lkml.kernel.org/r/20240621113706.315500-18-iii@linux.ibm.com Signed-off-by: Ilya Leoshkevich Acked-by: Vlastimil Babka Reviewed-by: Alexander Potapenko Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Christoph Lameter Cc: David Rientjes Cc: Dmitry Vyukov Cc: Heiko Carstens Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Joonsoo Kim Cc: Cc: Marco Elver Cc: Mark Rutland Cc: Masami Hiramatsu (Google) Cc: Pekka Enberg Cc: Roman Gushchin Cc: Steven Rostedt (Google) Cc: Sven Schnelle Cc: Vasily Gorbik Signed-off-by: Andrew Morton --- diff --git a/mm/slub.c b/mm/slub.c index dbe8a6303937a..10e396e1d495e 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -829,10 +829,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(); }