* Re: [PATCH] gcc-plugins: Require utsrelease.h before scripts target
@ 2022-05-23 20:07 Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-05-23 20:07 UTC (permalink / raw)
To: Kees Cook
Cc: kernel test robot, Masahiro Yamada, linux-kbuild, Michal Marek,
Nick Desaulniers, linux-kernel, linux-hardening
On Mon, May 23, 2022 at 01:02:22PM -0700, Kees Cook wrote:
> The "utsrelease.h" target was in parallel with the "scripts" target,
> which meant -j1 or unlucky parallel builds from a distclean state would
> fail to build the GCC plugins.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Link: https://lore.kernel.org/lkml/YouX6g1T7w3FDeM8@cmpxchg.org
> Fixes: 61f60bac8c05 ("gcc-plugins: Change all version strings match kernel")
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: linux-kbuild@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
I was able to reproduce the problem with the following change
in Makefile.
include/generated/utsrelease.h: include/config/kernel.release FORCE
+ sleep 2
$(call filechk,utsrelease.h)
With this patch, the problem is gone.
Tested-by: Guenter Roeck <linux@roeck-us.net>
Guenter
> ---
> Makefile | 2 +-
> scripts/gcc-plugins/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> 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)
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gcc-plugins: Require utsrelease.h before scripts target
2022-05-24 8:20 ` Masahiro Yamada
@ 2022-05-24 14:03 ` Masahiro Yamada
0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2022-05-24 14:03 UTC (permalink / raw)
To: Kees Cook
Cc: Guenter Roeck, kernel test robot, Linux Kbuild mailing list,
Michal Marek, Nick Desaulniers, Linux Kernel Mailing List,
linux-hardening
Hi Kees
On Tue, May 24, 2022 at 5:20 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Tue, May 24, 2022 at 5:02 AM Kees Cook <keescook@chromium.org> wrote:
> >
> > The "utsrelease.h" target was in parallel with the "scripts" target,
> > which meant -j1 or unlucky parallel builds from a distclean state would
> > fail to build the GCC plugins.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Link: https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com
> > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > Link: https://lore.kernel.org/lkml/YouX6g1T7w3FDeM8@cmpxchg.org
> > Fixes: 61f60bac8c05 ("gcc-plugins: Change all version strings match kernel")
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Masahiro Yamada <masahiroy@kernel.org>
> > Cc: linux-kbuild@vger.kernel.org
> > Signed-off-by: Kees Cook <keescook@chromium.org>
This will work but I do not want to complex the build order.
I'd like to suggest to use KERNELVERSION.
Please consider this as an alternative.
https://lore.kernel.org/lkml/20220524135541.1453693-1-masahiroy@kernel.org/T/#u
> > ---
> > Makefile | 2 +-
> > scripts/gcc-plugins/Makefile | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > 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
>
>
> This change is unneeded.
>
> The header dependencies are automatically generated
> by the -MMD option.
>
> plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
>
>
>
>
>
>
> > $(call if_changed_dep,plugin_cxx_o_c)
> > --
> > 2.32.0
> >
>
>
> --
> Best Regards
> Masahiro Yamada
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gcc-plugins: Require utsrelease.h before scripts target
2022-05-23 20:02 Kees Cook
@ 2022-05-24 8:20 ` Masahiro Yamada
2022-05-24 14:03 ` Masahiro Yamada
0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2022-05-24 8:20 UTC (permalink / raw)
To: Kees Cook
Cc: Guenter Roeck, kernel test robot, Linux Kbuild mailing list,
Michal Marek, Nick Desaulniers, Linux Kernel Mailing List,
linux-hardening
On Tue, May 24, 2022 at 5:02 AM Kees Cook <keescook@chromium.org> wrote:
>
> The "utsrelease.h" target was in parallel with the "scripts" target,
> which meant -j1 or unlucky parallel builds from a distclean state would
> fail to build the GCC plugins.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Link: https://lore.kernel.org/lkml/YouX6g1T7w3FDeM8@cmpxchg.org
> Fixes: 61f60bac8c05 ("gcc-plugins: Change all version strings match kernel")
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: linux-kbuild@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Makefile | 2 +-
> scripts/gcc-plugins/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> 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
This change is unneeded.
The header dependencies are automatically generated
by the -MMD option.
plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
> $(call if_changed_dep,plugin_cxx_o_c)
> --
> 2.32.0
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] gcc-plugins: Require utsrelease.h before scripts target
@ 2022-05-23 20:02 Kees Cook
2022-05-24 8:20 ` Masahiro Yamada
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2022-05-23 20:02 UTC (permalink / raw)
To: Guenter Roeck
Cc: Kees Cook, kernel test robot, Masahiro Yamada, linux-kbuild,
Michal Marek, Nick Desaulniers, linux-kernel, linux-hardening
The "utsrelease.h" target was in parallel with the "scripts" target,
which meant -j1 or unlucky parallel builds from a distclean state would
fail to build the GCC plugins.
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-mm/202205230239.EZxeZ3Fv-lkp@intel.com
Reported-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/lkml/YouX6g1T7w3FDeM8@cmpxchg.org
Fixes: 61f60bac8c05 ("gcc-plugins: Change all version strings match kernel")
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Makefile | 2 +-
scripts/gcc-plugins/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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)
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-24 14:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 20:07 [PATCH] gcc-plugins: Require utsrelease.h before scripts target Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2022-05-23 20:02 Kees Cook
2022-05-24 8:20 ` Masahiro Yamada
2022-05-24 14:03 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).