From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id 072E96B0010 for ; Thu, 1 Mar 2018 12:15:52 -0500 (EST) Received: by mail-wr0-f198.google.com with SMTP id o23so4623998wrc.9 for ; Thu, 01 Mar 2018 09:15:51 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p14sor1591086wmh.14.2018.03.01.09.15.50 for (Google Transport Security); Thu, 01 Mar 2018 09:15:50 -0800 (PST) From: Andrey Konovalov Subject: [PATCH 2/2] kasan: disallow compiler to optimize away memset in tests Date: Thu, 1 Mar 2018 18:15:43 +0100 Message-Id: <105ec9a308b2abedb1a0d1fdced0c22d765e4732.1519924383.git.andreyknvl@google.com> In-Reply-To: References: In-Reply-To: References: Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrew Morton , Geert Uytterhoeven , Nick Terrell , Chris Mason , Yury Norov , Al Viro , "Luis R . Rodriguez" , Palmer Dabbelt , "Paul E . McKenney" , Jeff Layton , "Jason A . Donenfeld" , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Kostya Serebryany , Andrey Konovalov 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, we don't want this optimization to happen. The solution is to add -fno-builtin flag to test_kasan.ko Signed-off-by: Andrey Konovalov --- lib/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Makefile b/lib/Makefile index a90d4fcd748f..9c940c4c0593 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o 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 -- 2.16.2.395.g2e18187dfd-goog -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org