]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kasan/test: only do kmalloc_double_kzfree for generic mode
authorWang Wensheng <wsw9603@163.com>
Sun, 24 May 2026 03:10:53 +0000 (11:10 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jun 2026 21:45:02 +0000 (14:45 -0700)
commit7c2ebe0fe06e84a5a1fcbc358111735080bdb141
tree85af5285435b3474fe28c0f44ac25a59e3b8cb41
parent7e6cc35f5283eab81a14231a64ecd640b690c48c
kasan/test: only do kmalloc_double_kzfree for generic mode

kmalloc_double_kzfree() would corrupt kernel memory when the just freed
memory were allocated by another thread before the second call to
kfree_sensitive() and the new allocation tag happened to match the old
one.

This could not happen in GENERIC mode as it uses quarantine.

Link: https://lore.kernel.org/20260524031053.381776-1-wsw9603@163.com
Signed-off-by: Wang Wensheng <wsw9603@163.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kasan/kasan_test_c.c