Re: -Wmacro-redefined in include/linux/fortify-string.h

From: Kees Cook
Date: Wed Oct 19 2022 - 13:31:03 EST


On Wed, Oct 19, 2022 at 09:48:27AM -0700, Alexander Potapenko wrote:
> On Wed, Oct 19, 2022 at 8:37 AM Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
> >
> > Hi all,
> >
> > I am seeing the following set of warnings when building an x86_64
> > configuration that has CONFIG_FORTIFY_SOURCE=y and CONFIG_KMSAN=y:
>
> I was also looking into this issue recently, because people start
> running into it: https://github.com/google/kmsan/issues/89
>
> I have a solution that redefines __underlying_memXXX to __msan_memXXX
> under __SANITIZE_MEMORY__ in fortify-string.h and skips `#define
> memXXX __msan_memXXX` in string_64.h, making KMSAN kinda work with
> FORTIFY_SOURCE.

Oh good!

> Dunno if that's necessary though: KMSAN is a debugging tool anyway,
> and supporting it in fortify-string.h sounds excessive.

I'd much prefer letting them still work together.

--
Kees Cook