From: Marco Elver <elver@google.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
Segher Boessenkool <segher@kernel.crashing.org>,
Peter Zijlstra <peterz@infradead.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Borislav Petkov <bp@alien8.de>,
Nathan Chancellor <nathan@kernel.org>, x86-ml <x86@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
llvm@lists.linux.dev, Josh Poimboeuf <jpoimboe@redhat.com>,
linux-toolchains@vger.kernel.org
Subject: Re: clang memcpy calls
Date: Wed, 30 Mar 2022 16:45:22 +0200 [thread overview]
Message-ID: <YkRtAuFniiLYdbxG@elver.google.com> (raw)
In-Reply-To: <YkG7zqwFRtmUKVFc@lakrids>
On Mon, Mar 28, 2022 at 02:44PM +0100, Mark Rutland wrote:
[...]
> From my PoV, distinguishing instrumentable/uninstrumentable calls at
> compile time would be ideal. That, or placing the instrumentation into
> the caller (omitting it when instrumentation is disabled for that
> caller), and expecting the out-of-line forms are never instrumented. I
> appreciate that latter option may not be workable due to potential size
> bloat, though.
That's what user space ASan with Clang already does:
https://godbolt.org/z/ro1Y8E59e
, where it prefixes mem*() calls with __asan_. Only
-fsanitize=kernel-address has (unfortunately) been taught to omit the
prefix. I don't have any info on the history of this, but given the
issues that have surfaced in this thread, it's clearly the wrong thing.
We'll be adding an option to undo this behaviour:
https://reviews.llvm.org/D122724
It's unfortunate yet another option is required, but it's the only way
to retain compatibility with older kernels that don't yet understand
__asan_mem*() functions.
For the kernel GCC then should also:
1. omit the prefix for `-fsanitize=kernel-address` (current behaviour)
2. add the prefix for `-fsanitize=kernel-address --param asan-kernel-mem-intrinsic-prefix`
But because the ASan user space runtime already understands the
__asan-prefixed versions, I imagine GCC can also do to align with Clang:
3. add the prefix for normal `-fsanitize=address`
Thanks,
-- Marco
next prev parent reply other threads:[~2022-03-30 14:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 11:19 Borislav Petkov
2022-03-24 15:29 ` Mark Rutland
2022-03-24 18:43 ` Nick Desaulniers
2022-03-24 22:54 ` David Laight
2022-03-25 12:15 ` Mark Rutland
2022-03-25 14:13 ` Peter Zijlstra
2022-03-25 15:12 ` Segher Boessenkool
2022-03-28 9:52 ` Mark Rutland
2022-03-28 10:20 ` Jakub Jelinek
2022-03-28 11:54 ` Peter Zijlstra
2022-03-28 12:55 ` Mark Rutland
2022-03-28 13:12 ` Jakub Jelinek
2022-03-28 13:44 ` Mark Rutland
2022-03-30 14:45 ` Marco Elver [this message]
2022-03-28 14:22 ` Segher Boessenkool
2022-03-28 14:58 ` Mark Rutland
2022-03-28 15:59 ` Segher Boessenkool
2022-03-28 16:16 ` Peter Zijlstra
2022-03-28 16:58 ` Segher Boessenkool
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=YkRtAuFniiLYdbxG@elver.google.com \
--to=elver@google.com \
--cc=bp@alien8.de \
--cc=jakub@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=segher@kernel.crashing.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®