The patch titled Subject: kasan: test: clean up ksize_uaf has been added to the -mm tree. Its filename is kasan-test-clean-up-ksize_uaf.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/kasan-test-clean-up-ksize_uaf.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/kasan-test-clean-up-ksize_uaf.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Konovalov <andreyknvl@xxxxxxxxx> Subject: kasan: test: clean up ksize_uaf Some KASAN tests use global variables to store function returns values so that the compiler doesn't optimize away these functions. ksize_uaf() doesn't call any functions, so it doesn't need to use kasan_int_result. Use volatile accesses instead, to be consistent with other similar tests. Link: https://lkml.kernel.org/r/a1fc34faca4650f4a6e4dfb3f8d8d82c82eb953a.1628779805.git.andreyknvl@xxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxx> Reviewed-by: Marco Elver <elver@xxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/test_kasan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/lib/test_kasan.c~kasan-test-clean-up-ksize_uaf +++ a/lib/test_kasan.c @@ -737,8 +737,8 @@ static void ksize_uaf(struct kunit *test kfree(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ksize(ptr)); - KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = *ptr); - KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = *(ptr + size)); + KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[0]); + KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); } static void kasan_stack_oob(struct kunit *test) _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxx are kasan-test-rework-kmalloc_oob_right.patch kasan-test-avoid-writing-invalid-memory.patch kasan-test-avoid-corrupting-memory-via-memset.patch kasan-test-disable-kmalloc_memmove_invalid_size-for-hw_tags.patch kasan-test-only-do-kmalloc_uaf_memset-for-generic-mode.patch kasan-test-clean-up-ksize_uaf.patch kasan-test-avoid-corrupting-memory-in-copy_user_test.patch kasan-test-avoid-corrupting-memory-in-kasan_rcu_uaf.patch