Messages in this thread | | | Date | Wed, 30 Mar 2022 16:45:22 +0200 | From | Marco Elver <> | Subject | Re: clang memcpy calls |
| |
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
| |