Skip to contentSkip to conversation

next-20251020: selftests: helpers.h:10:10: fatal error: kselftest.h: No such file or directory

PATCH Applied Naresh Kamboju 6 participants 6 messages Oct 21, 2025 – Jan 17

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

The selftests x86_64 builds failed due to following build warnings / errors on the Linux next-20251020 and next-20251021 tags with gcc-14 and clang-21.

First seen on next-20251020
Good: next-20251020
Bad: next-20251017

Regression Analysis:
- New regression? yes
- Reproducibility? yes

### Build errors
x86_64-linux-gnu-gcc -m64 -o kselftest/x86/single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall -isystem usr/include -no-pie -DCAN_BUILD_64 single_step_syscall.c -lrt -ldl
In file included from single_step_syscall.c:34:
helpers.h:10:10: fatal error: kselftest.h: No such file or directory
10 | #include "kselftest.h"

      |          ^~~~~~~~~~~~~

compilation terminated.
make[4]: *** [Makefile:86: kselftest/x86/single_step_syscall_64] Error 1

### Suspected patch
git log --oneline next-20251017..next-20251020 --
tools/testing/selftests/x86/
4d89827dfb274 selftests: complete kselftest include centralization

Build regressions: next-20251020: selftests: helpers.h:10:10: fatal
error: kselftest.h: No such file or directory

### Steps to reproduce
- tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-14 \
--kconfig https://storage.tuxsuite.com/public/linaro/lkft/builds/34JgN0fZ9uXj6HVnjvjqzIhgWbQ/config
\
debugkernel cpupower headers kernel kselftest modules

## Source
* Kernel version: 6.18.0-rc2
* Git tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git
* Git describe: next-20251021 and next-20251020
* Git commit: fe45352cd106ae41b5ad3f0066c2e54dbb2dfd70
* Architectures: x86_64
* Toolchains: gcc-14 and clang-21
* Kconfigs: defconfig+selftests/*/configs

## Build
* Build log: https://storage.tuxsuite.com/public/linaro/lkft/builds/34JgN0fZ9uXj6HVnjvjqzIhgWbQ/build.log
* Build details:
https://regressions.linaro.org/lkft/linux-next-master/next-20251020/kselftest-x86/x86_avx_64/
* Build link: https://storage.tuxsuite.com/public/linaro/lkft/builds/34JgN0fZ9uXj6HVnjvjqzIhgWbQ/
* Kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/34JgN0fZ9uXj6HVnjvjqzIhgWbQ/config

--
Linaro LKFT
https://lkft.linaro.org

#1 lore raw

PATCH 1/1 selftests/x86: Add selftests include path for kselftest.h after centralization

The previous change centralizing kselftest.h include path in lib.mk caused x86 selftests to fail, as x86 Makefile overwrites CFLAGS using ":=", dropping the include path added in lib.mk. Therefore, helpers.h could not find kselftest.h during compilation.

Fix this by adding the tools/testing/sefltest to CFLAGS in x86 Makefile.

---
 tools/testing/selftests/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/x86/Makefile +1 -0
index 83148875a12c..434065215d12 100644
@@ -36,6 +36,7 @@ BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
 BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
 
 CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
+CFLAGS += -I $(top_srcdir)/tools/testing/selftests/
 
 # call32_from_64 in thunks.S uses absolute addresses.
 ifeq ($(CAN_BUILD_WITH_NOPIE),1)
Signature · 1 line
2.43.0
Tested-by on v1 1/1
#2 lore raw

Re: [PATCH] selftests/x86: Add selftests include path for kselftest.h after centralization

Quoted 6 lines · Bala-Vignesh-Reddy

The previous change centralizing kselftest.h include path in lib.mk caused x86 selftests to fail, as x86 Makefile overwrites CFLAGS using ":=", dropping the include path added in lib.mk. Therefore, helpers.h could not find kselftest.h during compilation.

Quoted 7 lines

Fix this by adding the tools/testing/sefltest to CFLAGS in x86 Makefile.

Yes, works.

Cheers,
Anders

Quoted 19 lines
---
 tools/testing/selftests/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/x86/Makefile +1 -1
index 83148875a12c..434065215d12 100644
@@ -36,6 +36,7 @@ BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
 BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
 
 CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
+CFLAGS += -I $(top_srcdir)/tools/testing/selftests/
 
 # call32_from_64 in thunks.S uses absolute addresses.
 ifeq ($(CAN_BUILD_WITH_NOPIE),1)
--

2.43.0

Tested-by on v1 1/1
#3 lore raw

Re: [PATCH] selftests/x86: Add selftests include path for kselftest.h after centralization

In reply to Bala-Vignesh-Reddy
Quoted 5 lines · Bala-Vignesh-Reddy

The previous change centralizing kselftest.h include path in lib.mk caused x86 selftests to fail, as x86 Makefile overwrites CFLAGS using ":=", dropping the include path added in lib.mk. Therefore, helpers.h could not find kselftest.h during compilation.

Quoted 7 lines

Fix this by adding the tools/testing/sefltest to CFLAGS in x86 Makefile.

Thanks, this fixes the issue I reported here:

https://lore.kernel.org/lkml/[email protected]/

Shuah, does this go via the kselftests tree? If not, Boris can you take it via x86?

maintainer
#4 lore raw

Re: [PATCH] selftests/x86: Add selftests include path for kselftest.h after centralization

In reply to Bala-Vignesh-Reddy
Quoted 8 lines · Bala-Vignesh-Reddy

The previous change centralizing kselftest.h include path in lib.mk caused x86 selftests to fail, as x86 Makefile overwrites CFLAGS using ":=", dropping the include path added in lib.mk. Therefore, helpers.h could not find kselftest.h during compilation.

Fix this by adding the tools/testing/sefltest to CFLAGS in x86 Makefile.

Fixes 4d89827dfb27 ("selftests: complete kselftest include centralization")

This should be:

e6fbd1759c9e ("selftests: complete kselftest include centralization")

@akpm: I see you took the above commit - I'll take this fix through tip.

Quoted 14 lines
---
 tools/testing/selftests/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/x86/Makefile +0 -0
index 83148875a12c..434065215d12 100644

tools/testing/selftests/x86/Makefile BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32)) · line 42

Quoted 7 lines
tools/testing/selftests/x86/Makefile +1 -0
@@ -36,6 +36,7 @@ BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
 BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
 
 CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
+CFLAGS += -I $(top_srcdir)/tools/testing/selftests/
 
 # call32_from_64 in thunks.S uses absolute addresses.
 ifeq ($(CAN_BUILD_WITH_NOPIE),1)

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#5 lore raw

[tip: x86/urgent] selftests/x86: Add selftests include path for kselftest.h after centralization

In reply to Bala-Vignesh-Reddy
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     d9b40d7262a227442bf402ea0708dc94f438bb52
Gitweb:        https://git.kernel.org/tip/d9b40d7262a227442bf402ea0708dc94f438bb52
Author:        Bala-Vignesh-Reddy <[email protected]>
AuthorDate:    Wed, 22 Oct 2025 11:59:48 +05:30
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Sat, 17 Jan 2026 12:22:27 +01:00

selftests/x86: Add selftests include path for kselftest.h after centralization

The previous change centralizing kselftest.h include path in lib.mk caused x86 selftests to fail, as x86 Makefile overwrites CFLAGS using ":=", dropping the include path added in lib.mk. Therefore, helpers.h could not find kselftest.h during compilation.

Fix this by adding the tools/testing/sefltest to CFLAGS in x86 Makefile.

[ bp: Correct commit ID in Fixes: ]

---
 tools/testing/selftests/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/x86/Makefile +1 -0
index 8314887..4340652 100644
@@ -36,6 +36,7 @@ BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
 BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
 
 CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
+CFLAGS += -I $(top_srcdir)/tools/testing/selftests/
 
 # call32_from_64 in thunks.S uses absolute addresses.
 ifeq ($(CAN_BUILD_WITH_NOPIE),1)