On Tue, 31 Mar 2026 12:01:55 +0800 Li Wang <[email protected]> wrote:
> When running selftests from the kernel top-level (e.g. make kselftest-all),
> sub-makes might still inherit the caller's PWD from the environment.
>
> Some selftests use $(PWD) in recursive kbuild invocations, which can
> then incorrectly resolve to the kernel top directory instead of the
> current test directory.
>
> In that case, kbuild may generate an external-module wrapper Makefile in
> the wrong location, potentially clobbering the top-level Makefile and
> causing recursive include failures ("Too many open files").
>
> Export PWD := $(CURDIR) in selftests/lib.mk so $(PWD) always matches the
> actual current selftest directory.
>
> Reported-by: Andrew Morton <[email protected]>
> Signed-off-by: Li Wang <[email protected]>
I couldn't clearly figure out what I was doing to cause kbuild to
destroy my top-level Makefile. It happened three times and it wasn't
fun so I Stopped Doing That.
I tried a bunch of things *without* this patch and of course, Makefile
is still intact. So I cannot confirm or deny, sorry.
I've switched my script so I'll henceforth be running -j100, shall keep
an eye on things.
I have no comment on [4/4] - it addresses something I haven't seen.
I'll assume this patchset will be handled via the kbuild tree.