linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: glider@google.com
To: dvyukov@google.com, andreyknvl@google.com,
	aryabinin@virtuozzo.com,  akpm@linux-foundation.org
Cc: sergey.senozhatsky@gmail.com, arnd@arndb.de, linux-mm@kvack.org,
	 vegard.nossum@oracle.com, elver@google.com,
	 Alexander Potapenko <glider@google.com>
Subject: [PATCH 2/3] stackdepot: build with -fno-builtin
Date: Thu, 20 Feb 2020 15:19:15 +0100	[thread overview]
Message-ID: <20200220141916.55455-2-glider@google.com> (raw)
In-Reply-To: <20200220141916.55455-1-glider@google.com>

Clang may replace stackdepot_memcmp() with a call to instrumented bcmp(),
which is exactly what we wanted to avoid creating stackdepot_memcmp().
Building the file with -fno-builtin prevents such optimizations.

This patch has been previously mailed as part of KMSAN RFC patch series.

Signed-off-by: Alexander Potapenko <glider@google.com>
To: Alexander Potapenko <glider@google.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: linux-mm@kvack.org
---
 lib/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/Makefile b/lib/Makefile
index 23ca78d43d247..390e90d2ee88b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -220,6 +220,10 @@ obj-$(CONFIG_MEMREGION) += memregion.o
 obj-$(CONFIG_STMP_DEVICE) += stmp_device.o
 obj-$(CONFIG_IRQ_POLL) += irq_poll.o
 
+# stackdepot.c should not be instrumented or call instrumented functions.
+# Prevent the compiler from calling builtins like memcmp() or bcmp() from this
+# file.
+CFLAGS_stackdepot.o += -fno-builtin
 obj-$(CONFIG_STACKDEPOT) += stackdepot.o
 KASAN_SANITIZE_stackdepot.o := n
 KCOV_INSTRUMENT_stackdepot.o := n
-- 
2.25.0.265.gbab2e86ba0-goog



  reply	other threads:[~2020-02-20 14:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 14:19 [PATCH 1/3] stackdepot: check depot_index before accessing the stack slab glider
2020-02-20 14:19 ` glider [this message]
2020-02-20 14:19 ` [PATCH 3/3] kasan: stackdepot: move filter_irq_stacks() to stackdepot.c glider
2020-02-25 20:24   ` kbuild test robot
2020-02-26  9:53     ` Alexander Potapenko
2020-02-27  3:16       ` Greentime Hu
2020-03-07 13:37         ` Alexander Potapenko

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=20200220141916.55455-2-glider@google.com \
    --to=glider@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=linux-mm@kvack.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vegard.nossum@oracle.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;
as well as URLs for NNTP newsgroup(s).