From: Andrey Konovalov <andreyknvl@google.com>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Nick Terrell <terrelln@fb.com>, Chris Mason <clm@fb.com>,
Yury Norov <ynorov@caviumnetworks.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"Luis R . Rodriguez" <mcgrof@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Jeff Layton <jlayton@redhat.com>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
linux-mm@kvack.org
Cc: Kostya Serebryany <kcc@google.com>,
Andrey Konovalov <andreyknvl@google.com>
Subject: [PATCH 2/2] kasan: disallow compiler to optimize away memset in tests
Date: Thu, 1 Mar 2018 18:15:43 +0100 [thread overview]
Message-ID: <105ec9a308b2abedb1a0d1fdced0c22d765e4732.1519924383.git.andreyknvl@google.com> (raw)
In-Reply-To: <cover.1519924383.git.andreyknvl@google.com>
In-Reply-To: <cover.1519924383.git.andreyknvl@google.com>
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 <andreyknvl@google.com>
---
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-03-01 17:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 17:15 [PATCH 0/2] kasan: a couple of test fixes Andrey Konovalov
2018-03-01 17:15 ` [PATCH 1/2] kasan: fix invalid-free test crashing the kernel Andrey Konovalov
2018-03-01 17:28 ` Andrey Konovalov
2018-03-02 12:11 ` Andrey Ryabinin
2018-03-01 17:15 ` Andrey Konovalov [this message]
2018-03-02 12:11 ` [PATCH 2/2] kasan: disallow compiler to optimize away memset in tests Andrey Ryabinin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=105ec9a308b2abedb1a0d1fdced0c22d765e4732.1519924383.git.andreyknvl@google.com \
--to=andreyknvl@google.com \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=clm@fb.com \
--cc=dvyukov@google.com \
--cc=geert@linux-m68k.org \
--cc=glider@google.com \
--cc=jlayton@redhat.com \
--cc=kasan-dev@googlegroups.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=terrelln@fb.com \
--cc=viro@zeniv.linux.org.uk \
--cc=ynorov@caviumnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox