Re: [PATCH] gcc-plugins: Change all version strings match kernel

From: Kees Cook
Date: Mon May 23 2022 - 15:38:50 EST


On Mon, May 23, 2022 at 07:30:54AM -0700, Guenter Roeck wrote:
> On Tue, May 10, 2022 at 04:54:12PM -0700, Kees Cook wrote:
> > It's not meaningful for the GCC plugins to track their versions separately
> > from the rest of the kernel. Switch all versions to the kernel version.
> >
> > Fix mismatched indenting while we're at it.
> >
> > Cc: linux-hardening@xxxxxxxxxxxxxxx
> > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
>
> I see random build failures with this patch in linux-next.
>
> Error log:
> cc1plus: fatal error: ./include/generated/utsrelease.h: No such file or directory
>
> The problem doesn't happen all the time. Is there some missing dependency ?

I've seen 0-day reports on this too and but I haven't been able to reproduce
it. AFAICT, utsrelease.h should be generated before the gcc plugins are
built, but clearly something is wrong.

> > plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
> > -include $(srctree)/include/linux/compiler-version.h \
> > + -include $(objtree)/include/generated/utsrelease.h \

I wonder if include/generated/utsrelease.h needs to be explicitly added
as a build dep to the plugin logic?

--
Kees Cook