mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality.patch removed from -mm tree
The patch titled
Subject: mm/slub, kunit: add a KUnit test for SLUB debugging functionality
has been removed from the -mm tree. Its filename was
mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Oliver Glitta <[email protected]>
Subject: mm/slub, kunit: add a KUnit test for SLUB debugging functionality
SLUB has resiliency_test() function which is hidden behind #ifdef SLUB_RESILIENCY_TEST that is not part of Kconfig, so nobody runs it. KUnit should be a proper replacement for it.
Try changing byte in redzone after allocation and changing pointer to next free node, first byte, 50th byte and redzone byte. Check if validation finds errors.
There are several differences from the original resiliency test: Tests create own caches with known state instead of corrupting shared kmalloc caches.
The corruption of freepointer uses correct offset, the original resiliency test got broken with freepointer changes.
Scratch changing random byte test, because it does not have meaning in this form where we need deterministic results.
Add new option CONFIG_SLUB_KUNIT_TEST in Kconfig. Tests next_pointer, first_word and clobber_50th_byte do not run with KASAN option on. Because the test deliberately modifies non-allocated objects.
Use kunit_resource to count errors in cache and silence bug reports. Count error whenever slab_bug() or slab_fix() is called or when the count of pages is wrong.
---
lib/Kconfig.debug | 12 +++ lib/Makefile | 1 lib/slub_kunit.c | 152 ++++++++++++++++++++++++++++++++++++++++++++ mm/kasan/common.c | 3 mm/slab.h | 1 mm/slub.c | 46 ++++++++++++- 6 files changed, 212 insertions(+), 3 deletions(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality +12 -0
@@ -2429,6 +2429,18 @@ config BITS_TEST If unsure, say N. +config SLUB_KUNIT_TEST + tristate "KUnit test for SLUB cache error detection" if !KUNIT_ALL_TESTS + depends on SLUB_DEBUG && KUNIT + default KUNIT_ALL_TESTS + help + This builds SLUB allocator unit test. + Tests SLUB cache debugging functionality. + For more information on KUnit and unit tests in general please refer + to the KUnit documentation in Documentation/dev-tools/kunit/. + + If unsure, say N. + config TEST_UDELAY tristate "udelay test driver" help
lib/Makefile renamed from lib/Makefile~mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality +1 -0
@@ -354,5 +354,6 @@ obj-$(CONFIG_LIST_KUNIT_TEST) += list-te obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o obj-$(CONFIG_BITS_TEST) += test_bits.o obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o +obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o
lib/slub_kunit.c new file +152 -0
152 lines not on this page · raw message
mm/kasan/common.c renamed from mm/kasan/common.c~mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality +3 -0
@@ -51,11 +51,14 @@ void kasan_enable_current(void) { current->kasan_depth++; } +EXPORT_SYMBOL (kasan_enable_current);void kasan_disable_current (void ) { current->kasan_depth--; } +EXPORT_SYMBOL (kasan_disable_current); +#endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ void __kasan_unpoison_range (const void *address,size_t size)
mm/slab.h renamed from mm/slab.h~mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality +1 -0
@@ -215,6 +215,7 @@ DECLARE_STATIC_KEY_TRUE(slub_debug_enablDECLARE_STATIC_KEY_FALSE (slub_debug_enabled);#endif extern void print_tracking (struct kmem_cache *s,void *object); +long validate_slab_cache (struct kmem_cache *s);#else static inline void print_tracking (struct kmem_cache *s,void *object) {
mm/slub.c renamed from mm/slub.c~mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality +43 -3
116 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
mm-slub-use-stackdepot-to-save-stack-trace-in-objects.patch