On Mon, Mar 30, 2026 at 10:30:25PM -0700, Andrew Morton wrote: > 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.
No problem, actually I wasn't able to reproduce it, the patch just worked out based on your description. We can kick out it from patchset unless someone confirm it is needed. -- Regards, Li Wang

