]> git.baikalelectronics.ru Git - kernel.git/commit
kasan: test: prevent cache merging in kmem_cache_double_destroy
authorAndrey Konovalov <andreyknvl@google.com>
Sat, 26 Feb 2022 03:10:59 +0000 (19:10 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 26 Feb 2022 17:51:17 +0000 (09:51 -0800)
commit4382e62fc30e65f1e31376778146a4596b67e7c6
treeb46aea479f5a389f686059f67c223e8861036374
parent4edce70ba93a4ea72071e6e94908c73b67270105
kasan: test: prevent cache merging in kmem_cache_double_destroy

With HW_TAGS KASAN and kasan.stacktrace=off, the cache created in the
kmem_cache_double_destroy() test might get merged with an existing one.
Thus, the first kmem_cache_destroy() call won't actually destroy it but
will only decrease the refcount.  This causes the test to fail.

Provide an empty constructor for the created cache to prevent the cache
from getting merged.

Link: https://lkml.kernel.org/r/b597bd434c49591d8af00ee3993a42c609dc9a59.1644346040.git.andreyknvl@google.com
Fixes: 19cba4f8abdc ("kasan: test: add test case for double-kmem_cache_destroy()")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/test_kasan.c