Re: [PATCH 1/4] x86: kmsan: Don't rename memintrinsics in uninstrumented files

From: Alexander Potapenko
Date: Thu Mar 02 2023 - 10:17:55 EST


On Thu, Mar 2, 2023 at 4:13 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Thu, 2 Mar 2023 at 15:28, Alexander Potapenko <glider@xxxxxxxxxx> wrote:
> >
> > On Thu, Mar 2, 2023 at 12:14 PM Marco Elver <elver@xxxxxxxxxx> wrote:
> > >
> > > On Wed, 1 Mar 2023 at 15:39, Alexander Potapenko <glider@xxxxxxxxxx> wrote:
> > > >
> > > > KMSAN should be overriding calls to memset/memcpy/memmove and their
> > >
> > > You mean that the compiler will override calls?
> > > All supported compilers that have fsanitize=kernel-memory replace
> > > memintrinsics with __msan_mem*() calls, right?
> >
> > Right. Changed to:
> >
> > KMSAN already replaces calls to to memset/memcpy/memmove and their
> > __builtin_ versions with __msan_memset/__msan_memcpy/__msan_memmove in
> > instrumented files, so there is no need to override them.
>
> But it's not KMSAN - KMSAN is the combined end result of runtime and
> compiler - in this case we need to be specific and point out it's the
> compiler that's doing it. There is no code in the Linux kernel that
> does this replacement.

Agreed. I'll replace with "clang -fsanitize=kernel-memory"