[PATCH mm] kasan, powerpc: Don't rename memintrinsics if compiler adds prefixes

Michael Ellerman mpe at ellerman.id.au
Tue Feb 28 22:58:03 AEDT 2023


Marco Elver <elver at google.com> writes:
> On Mon, 27 Feb 2023 at 23:16, Andrew Morton <akpm at linux-foundation.org> wrote:
>>
>> On Mon, 27 Feb 2023 10:47:27 +0100 Marco Elver <elver at google.com> wrote:
>>
>> > With appropriate compiler support [1], KASAN builds use __asan prefixed
>> > meminstrinsics, and KASAN no longer overrides memcpy/memset/memmove.
>> >
>> > If compiler support is detected (CC_HAS_KASAN_MEMINTRINSIC_PREFIX),
>> > define memintrinsics normally (do not prefix '__').
>> >
>> > On powerpc, KASAN is the only user of __mem functions, which are used to
>> > define instrumented memintrinsics. Alias the normal versions for KASAN
>> > to use in its implementation.
>> >
>> > Link: https://lore.kernel.org/all/20230224085942.1791837-1-elver@google.com/ [1]
>> > Link: https://lore.kernel.org/oe-kbuild-all/202302271348.U5lvmo0S-lkp@intel.com/
>> > Reported-by: kernel test robot <lkp at intel.com>
>> > Signed-off-by: Marco Elver <elver at google.com>
>>
>> Seems this is a fix against "kasan: treat meminstrinsic as builtins in
>> uninstrumented files", so I'll plan to fold this patch into that patch.
>
> Yes, that looks right.
>
> If a powerpc maintainer could take a quick look as well would be good.

The patch looks OK to me. It builds for various configs and I did a few
test boots with KASAN enabled, everything seems normal.

Acked-by: Michael Ellerman <mpe at ellerman.id.au> (powerpc)


> The maze of memcpy/memmove/memset definitions and redefinitions isn't
> the simplest - I hope in a few years we can delete all the old code
> (before CC_HAS_KASAN_MEMINTRINSIC_PREFIX), and let the compilers just
> "do the right thing".

Yeah that would be nice.

cheers


More information about the Linuxppc-dev mailing list