The patch titled Subject: kasan: prevent compiler from optimizing away memset in tests has been added to the -mm tree. Its filename is kasan-disallow-compiler-to-optimize-away-memset-in-tests.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kasan-disallow-compiler-to-optimize-away-memset-in-tests.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kasan-disallow-compiler-to-optimize-away-memset-in-tests.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/SubmitChecklist 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@xxxxxxxxxx> Subject: kasan: prevent compiler from optimizing away memset in tests A compiler can optimize away memset calls by replacing them with mov instructions. There are KASAN tests that specifically test that KASAN correctly handles memset calls so we don't want this optimization to happen. The solution is to add -fno-builtin flag to test_kasan.ko Link: http://lkml.kernel.org/r/105ec9a308b2abedb1a0d1fdced0c22d765e4732.1519924383.git.andreyknvl@xxxxxxxxxx Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Nick Terrell <terrelln@xxxxxx> Cc: Chris Mason <clm@xxxxxx> Cc: Yury Norov <ynorov@xxxxxxxxxxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: "Luis R . Rodriguez" <mcgrof@xxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> Cc: "Paul E . McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> Cc: Jeff Layton <jlayton@xxxxxxxxxx> Cc: "Jason A . Donenfeld" <Jason@xxxxxxxxx> Cc: Kostya Serebryany <kcc@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/Makefile | 1 + 1 file changed, 1 insertion(+) diff -puN lib/Makefile~kasan-disallow-compiler-to-optimize-away-memset-in-tests lib/Makefile --- a/lib/Makefile~kasan-disallow-compiler-to-optimize-away-memset-in-tests +++ a/lib/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_TEST_FIRMWARE) += test_firm obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o obj-$(CONFIG_TEST_HASH) += test_hash.o test_siphash.o obj-$(CONFIG_TEST_KASAN) += test_kasan.o +CFLAGS_test_kasan.o += -fno-builtin obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o obj-$(CONFIG_TEST_LKM) += test_module.o _ Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are kasan-slub-fix-handling-of-kasan_slab_free-hook.patch kasan-fix-invalid-free-test-crashing-the-kernel.patch kasan-disallow-compiler-to-optimize-away-memset-in-tests.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html