Re: [PATCH v2] string: use __builtin_memcpy() in strlcpy/strlcat

From: Alexander Potapenko
Date: Wed May 31 2023 - 03:59:39 EST


On Wed, May 31, 2023 at 1:10 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> On Tue, 30 May 2023 10:39:11 +0200, Alexander Potapenko wrote:
> > lib/string.c is built with -ffreestanding, which prevents the compiler
> > from replacing certain functions with calls to their library versions.
> >
> > On the other hand, this also prevents Clang and GCC from instrumenting
> > calls to memcpy() when building with KASAN, KCSAN or KMSAN:
> > - KASAN normally replaces memcpy() with __asan_memcpy() with the
> > additional cc-param,asan-kernel-mem-intrinsic-prefix=1;
> > - KCSAN and KMSAN replace memcpy() with __tsan_memcpy() and
> > __msan_memcpy() by default.
> >
> > [...]
>
> Applied to for-next/hardening, thanks!
>
> [1/1] string: use __builtin_memcpy() in strlcpy/strlcat
> https://git.kernel.org/kees/c/cfe93c8c9a7a

Note that Andrew also picked it to mm-unstable