* [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers
@ 2026-09-02 16:13 Vlad Poenaru
2026-09-03 6:45 ` Nathan Chancellor
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Vlad Poenaru @ 2026-09-02 16:13 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier
Cc: linux-kbuild, linux-kernel, regressions, Thomas Weißschuh
Commit 2d69b891e646 ("kbuild: Support generated asm-headers in
subdirectories") switched the stale-wrapper sweep in
scripts/Makefile.asm-headers from $(wildcard $(obj)/*.h) to a find(1)
invocation, so that generated headers in subdirectories are considered.
The two do not match the same set of files. Make's $(wildcard) uses glob
semantics, where a leading '.' has to be matched explicitly, whereas
find's -name uses fnmatch() without FNM_PERIOD, so '*.h' matches
dotfiles as well. filechk writes its output to $(dir $@).tmp_$(notdir $@)
before renaming it into place, so such a scratch file, if it happens to
exist in $(obj) when the sub-make is parsed, is now picked up in
old-headers. It appears in neither generic-y, generated-y nor syscall-y,
is therefore classified as unwanted, and cmd_remove deletes it.
On x86 this races with archprepare, which lists both asm-generic and
arch/x86/include/generated/asm/cpufeaturemasks.h as prerequisites. Under
-j they run concurrently against the same directory, and the build fails
intermittently:
mv: cannot stat 'arch/x86/include/generated/asm/.tmp_cpufeaturemasks.h': No such file or directory
make[1]: *** [arch/x86/Makefile:269: arch/x86/include/generated/asm/cpufeaturemasks.h] Error 1
The same commit also converted the generic wrapper rule to filechk, so
those wrappers now create .tmp_*.h in $(obj) too and can race among
themselves.
Restore the previous behaviour by excluding dotfiles from the sweep.
Subdirectories, which is what the find(1) conversion was for, keep being
descended into. While at it, quote the -name argument: it is currently
expanded by the shell against the build directory before find sees it.
Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
---
#regzbot introduced: 2d69b891e646
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index b38931314ad7c..f1c3d287c14b0 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -48,7 +48,7 @@ syscall-y := $(addprefix $(obj)/, $(syscall-y))
generated-y := $(addprefix $(obj)/, $(generated-y))
# Remove stale wrappers when the corresponding files are removed from generic-y
-old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
+old-headers := $(shell test -d $(obj) && find $(obj) -name '*.h' ! -name '.*')
unwanted := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
filechk_wrap = echo "\#include <asm-generic/$*.h>"
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers
2026-09-02 16:13 [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers Vlad Poenaru
@ 2026-09-03 6:45 ` Nathan Chancellor
2026-09-04 17:47 ` Nicolas Schier
2026-09-03 7:09 ` Thomas Weißschuh
2026-09-04 18:19 ` Nicolas Schier
2 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2026-09-03 6:45 UTC (permalink / raw)
To: Vlad Poenaru
Cc: Nicolas Schier, linux-kbuild, linux-kernel, regressions,
Thomas Weißschuh
On Wed, Sep 02, 2026 at 09:13:47AM -0700, Vlad Poenaru wrote:
> Commit 2d69b891e646 ("kbuild: Support generated asm-headers in
> subdirectories") switched the stale-wrapper sweep in
> scripts/Makefile.asm-headers from $(wildcard $(obj)/*.h) to a find(1)
> invocation, so that generated headers in subdirectories are considered.
>
> The two do not match the same set of files. Make's $(wildcard) uses glob
> semantics, where a leading '.' has to be matched explicitly, whereas
> find's -name uses fnmatch() without FNM_PERIOD, so '*.h' matches
> dotfiles as well. filechk writes its output to $(dir $@).tmp_$(notdir $@)
> before renaming it into place, so such a scratch file, if it happens to
> exist in $(obj) when the sub-make is parsed, is now picked up in
> old-headers. It appears in neither generic-y, generated-y nor syscall-y,
> is therefore classified as unwanted, and cmd_remove deletes it.
>
> On x86 this races with archprepare, which lists both asm-generic and
> arch/x86/include/generated/asm/cpufeaturemasks.h as prerequisites. Under
> -j they run concurrently against the same directory, and the build fails
> intermittently:
>
> mv: cannot stat 'arch/x86/include/generated/asm/.tmp_cpufeaturemasks.h': No such file or directory
> make[1]: *** [arch/x86/Makefile:269: arch/x86/include/generated/asm/cpufeaturemasks.h] Error 1
>
> The same commit also converted the generic wrapper rule to filechk, so
> those wrappers now create .tmp_*.h in $(obj) too and can race among
> themselves.
>
> Restore the previous behaviour by excluding dotfiles from the sweep.
> Subdirectories, which is what the find(1) conversion was for, keep being
> descended into. While at it, quote the -name argument: it is currently
> expanded by the shell against the build directory before find sees it.
>
> Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
> Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
Oof :( that's unfortunate, thanks a lot for tracking this down!
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Nicolas, I assume you will pick this up for 7.3.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers
2026-09-02 16:13 [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers Vlad Poenaru
2026-09-03 6:45 ` Nathan Chancellor
@ 2026-09-03 7:09 ` Thomas Weißschuh
2026-09-04 18:19 ` Nicolas Schier
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-09-03 7:09 UTC (permalink / raw)
To: Vlad Poenaru
Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
regressions
On Wed, Sep 02, 2026 at 09:13:47AM -0700, Vlad Poenaru wrote:
> Commit 2d69b891e646 ("kbuild: Support generated asm-headers in
> subdirectories") switched the stale-wrapper sweep in
> scripts/Makefile.asm-headers from $(wildcard $(obj)/*.h) to a find(1)
> invocation, so that generated headers in subdirectories are considered.
>
> The two do not match the same set of files. Make's $(wildcard) uses glob
> semantics, where a leading '.' has to be matched explicitly, whereas
> find's -name uses fnmatch() without FNM_PERIOD, so '*.h' matches
> dotfiles as well. filechk writes its output to $(dir $@).tmp_$(notdir $@)
> before renaming it into place, so such a scratch file, if it happens to
> exist in $(obj) when the sub-make is parsed, is now picked up in
> old-headers. It appears in neither generic-y, generated-y nor syscall-y,
> is therefore classified as unwanted, and cmd_remove deletes it.
>
> On x86 this races with archprepare, which lists both asm-generic and
> arch/x86/include/generated/asm/cpufeaturemasks.h as prerequisites. Under
> -j they run concurrently against the same directory, and the build fails
> intermittently:
>
> mv: cannot stat 'arch/x86/include/generated/asm/.tmp_cpufeaturemasks.h': No such file or directory
> make[1]: *** [arch/x86/Makefile:269: arch/x86/include/generated/asm/cpufeaturemasks.h] Error 1
>
> The same commit also converted the generic wrapper rule to filechk, so
> those wrappers now create .tmp_*.h in $(obj) too and can race among
> themselves.
>
> Restore the previous behaviour by excluding dotfiles from the sweep.
> Subdirectories, which is what the find(1) conversion was for, keep being
> descended into. While at it, quote the -name argument: it is currently
> expanded by the shell against the build directory before find sees it.
>
> Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
> Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
Thanks, and sorry for the breakage!
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
(...)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers
2026-09-03 6:45 ` Nathan Chancellor
@ 2026-09-04 17:47 ` Nicolas Schier
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-09-04 17:47 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Vlad Poenaru, linux-kbuild, linux-kernel, regressions,
Thomas Weißschuh
On Wed, Sep 02, 2026 at 11:45:44PM -0700, Nathan Chancellor wrote:
> On Wed, Sep 02, 2026 at 09:13:47AM -0700, Vlad Poenaru wrote:
> > Commit 2d69b891e646 ("kbuild: Support generated asm-headers in
> > subdirectories") switched the stale-wrapper sweep in
> > scripts/Makefile.asm-headers from $(wildcard $(obj)/*.h) to a find(1)
> > invocation, so that generated headers in subdirectories are considered.
> >
> > The two do not match the same set of files. Make's $(wildcard) uses glob
> > semantics, where a leading '.' has to be matched explicitly, whereas
> > find's -name uses fnmatch() without FNM_PERIOD, so '*.h' matches
> > dotfiles as well. filechk writes its output to $(dir $@).tmp_$(notdir $@)
> > before renaming it into place, so such a scratch file, if it happens to
> > exist in $(obj) when the sub-make is parsed, is now picked up in
> > old-headers. It appears in neither generic-y, generated-y nor syscall-y,
> > is therefore classified as unwanted, and cmd_remove deletes it.
> >
> > On x86 this races with archprepare, which lists both asm-generic and
> > arch/x86/include/generated/asm/cpufeaturemasks.h as prerequisites. Under
> > -j they run concurrently against the same directory, and the build fails
> > intermittently:
> >
> > mv: cannot stat 'arch/x86/include/generated/asm/.tmp_cpufeaturemasks.h': No such file or directory
> > make[1]: *** [arch/x86/Makefile:269: arch/x86/include/generated/asm/cpufeaturemasks.h] Error 1
> >
> > The same commit also converted the generic wrapper rule to filechk, so
> > those wrappers now create .tmp_*.h in $(obj) too and can race among
> > themselves.
> >
> > Restore the previous behaviour by excluding dotfiles from the sweep.
> > Subdirectories, which is what the find(1) conversion was for, keep being
> > descended into. While at it, quote the -name argument: it is currently
> > expanded by the shell against the build directory before find sees it.
> >
> > Fixes: 2d69b891e646 ("kbuild: Support generated asm-headers in subdirectories")
> > Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
>
> Oof :( that's unfortunate, thanks a lot for tracking this down!
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> Nicolas, I assume you will pick this up for 7.3.
Sure, sorry for the delay.
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
--
Nicolas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers
2026-09-02 16:13 [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers Vlad Poenaru
2026-09-03 6:45 ` Nathan Chancellor
2026-09-03 7:09 ` Thomas Weißschuh
@ 2026-09-04 18:19 ` Nicolas Schier
2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-09-04 18:19 UTC (permalink / raw)
To: Nathan Chancellor, Vlad Poenaru
Cc: linux-kbuild, linux-kernel, regressions, Thomas Weißschuh
On Wed, 02 Sep 2026 09:13:47 -0700, Vlad Poenaru wrote:
> kbuild: don't delete in-flight filechk temporaries in asm-headers
Applied to kbuild/linux.git (kbuild-fixes-unstable), thanks!
[1/1] kbuild: don't delete in-flight filechk temporaries in asm-headers
https://git.kernel.org/kbuild/c/94f7bba7
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped,
reverted or modified (e.g. trailers).
Patches applied to the kbuild-fixes-unstable branch are accepted pending
wider testing in linux-next and any post-commit review; they will
generally be moved to the kbuild-fixes branch within about a week if
no issues are found.
Best regards,
--
Nicolas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-04 18:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-02 16:13 [PATCH] kbuild: don't delete in-flight filechk temporaries in asm-headers Vlad Poenaru
2026-09-03 6:45 ` Nathan Chancellor
2026-09-04 17:47 ` Nicolas Schier
2026-09-03 7:09 ` Thomas Weißschuh
2026-09-04 18:19 ` Nicolas Schier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®