[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190506143052.648187716@linuxfoundation.org>
Date: Mon, 6 May 2019 16:32:49 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Andrey Konovalov <andreyknvl@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Nick Terrell <terrelln@...com>, Chris Mason <clm@...com>,
Yury Norov <ynorov@...iumnetworks.com>,
Al Viro <viro@...iv.linux.org.uk>,
"Luis R . Rodriguez" <mcgrof@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
Jeff Layton <jlayton@...hat.com>,
"Jason A . Donenfeld" <Jason@...c4.com>,
Kostya Serebryany <kcc@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [PATCH 4.9 18/62] kasan: prevent compiler from optimizing away memset in tests
From: Andrey Konovalov <andreyknvl@...gle.com>
commit 69ca372c100fba99c78ef826a1795aa86e4f01a8 upstream.
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@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
Acked-by: Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc: Alexander Potapenko <glider@...gle.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Nick Terrell <terrelln@...com>
Cc: Chris Mason <clm@...com>
Cc: Yury Norov <ynorov@...iumnetworks.com>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: "Luis R . Rodriguez" <mcgrof@...nel.org>
Cc: Palmer Dabbelt <palmer@...belt.com>
Cc: "Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Jeff Layton <jlayton@...hat.com>
Cc: "Jason A . Donenfeld" <Jason@...c4.com>
Cc: Kostya Serebryany <kcc@...gle.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
lib/Makefile | 1 +
1 file changed, 1 insertion(+)
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_TEST_BPF) += test_bpf.o
obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
obj-$(CONFIG_TEST_HASH) += test_hash.o
obj-$(CONFIG_TEST_KASAN) += test_kasan.o
+CFLAGS_test_kasan.o += -fno-builtin
obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
obj-$(CONFIG_TEST_LKM) += test_module.o
obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o
Powered by blists - more mailing lists