public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] gcc-plugins: Change all version strings match kernel
       [not found] ` <20220523143054.GA3164771@roeck-us.net>
@ 2022-05-23 19:54   ` Kees Cook
  2022-05-25 22:42     ` Anders Roxell
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2022-05-23 19:54 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Alexander Popov, linux-hardening, linux-kernel, Masahiro Yamada,
	linux-kbuild

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@vger.kernel.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> 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 ?

Here's a prior report I hadn't been able to repro:
https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com

But now I can: I see it with a -j1 build. This fixes it for me:

diff --git a/Makefile b/Makefile
index 91c91fcf3c24..c04420d5aa3d 100644
--- a/Makefile
+++ b/Makefile
@@ -1175,7 +1175,7 @@ include/config/kernel.release: FORCE
 # Carefully list dependencies so we do not try to build scripts twice
 # in parallel
 PHONY += scripts
-scripts: scripts_basic scripts_dtc
+scripts: include/generated/utsrelease.h scripts_basic scripts_dtc
 	$(Q)$(MAKE) $(build)=$(@)
 
 # Things we need to do before we recursively start building the kernel
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index 6f0aecad5d67..c29334669a16 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -64,5 +64,5 @@ $(foreach m, $(notdir $(plugin-multi)), $(eval $(obj)/$m: $(addprefix $(obj)/, $
 quiet_cmd_plugin_cxx_o_c = HOSTCXX $@
       cmd_plugin_cxx_o_c = $(HOSTCXX) $(plugin_cxxflags) -c -o $@ $<
 
-$(plugin-objs): $(obj)/%.o: $(src)/%.c FORCE
+$(plugin-objs): $(obj)/%.o: $(src)/%.c $(objdir)/include/generated/utsrelease.h FORCE
 	$(call if_changed_dep,plugin_cxx_o_c)

Both "include/generated/utsrelease.h" and "scripts" were same-level
deps, so they were racing. 

-- 
Kees Cook

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gcc-plugins: Change all version strings match kernel
  2022-05-23 19:54   ` [PATCH] gcc-plugins: Change all version strings match kernel Kees Cook
@ 2022-05-25 22:42     ` Anders Roxell
  0 siblings, 0 replies; 2+ messages in thread
From: Anders Roxell @ 2022-05-25 22:42 UTC (permalink / raw)
  To: Kees Cook
  Cc: Guenter Roeck, Alexander Popov, linux-hardening, linux-kernel,
	Masahiro Yamada, linux-kbuild

On 2022-05-23 12:54, Kees Cook wrote:
> 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@vger.kernel.org
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > 
> > 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 ?
> 
> Here's a prior report I hadn't been able to repro:
> https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com
> 
> But now I can: I see it with a -j1 build. This fixes it for me:

I could see this issue when I built an arm64 allmodconfig mainline [1]
kernel, on sha
7e062cda7d90 ("Merge tag 'net-next-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next")

To reproduce what I built tuxmake [2] can be used:
$ tuxmake --runtime podman --target-arch arm64 --toolchain gcc-11 --kconfig http://ix.io/3YBi kernel

> 
> diff --git a/Makefile b/Makefile
> index 91c91fcf3c24..c04420d5aa3d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1175,7 +1175,7 @@ include/config/kernel.release: FORCE
>  # Carefully list dependencies so we do not try to build scripts twice
>  # in parallel
>  PHONY += scripts
> -scripts: scripts_basic scripts_dtc
> +scripts: include/generated/utsrelease.h scripts_basic scripts_dtc
>  	$(Q)$(MAKE) $(build)=$(@)
>  
>  # Things we need to do before we recursively start building the kernel
> diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
> index 6f0aecad5d67..c29334669a16 100644
> --- a/scripts/gcc-plugins/Makefile
> +++ b/scripts/gcc-plugins/Makefile
> @@ -64,5 +64,5 @@ $(foreach m, $(notdir $(plugin-multi)), $(eval $(obj)/$m: $(addprefix $(obj)/, $
>  quiet_cmd_plugin_cxx_o_c = HOSTCXX $@
>        cmd_plugin_cxx_o_c = $(HOSTCXX) $(plugin_cxxflags) -c -o $@ $<
>  
> -$(plugin-objs): $(obj)/%.o: $(src)/%.c FORCE
> +$(plugin-objs): $(obj)/%.o: $(src)/%.c $(objdir)/include/generated/utsrelease.h FORCE
>  	$(call if_changed_dep,plugin_cxx_o_c)
> 
> Both "include/generated/utsrelease.h" and "scripts" were same-level
> deps, so they were racing. 

This patch patch solved the build error.

Cheers,
Anders
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
[2] https://tuxmake.org/install-pypi/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-25 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220510235412.3627034-1-keescook@chromium.org>
     [not found] ` <20220523143054.GA3164771@roeck-us.net>
2022-05-23 19:54   ` [PATCH] gcc-plugins: Change all version strings match kernel Kees Cook
2022-05-25 22:42     ` Anders Roxell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox