Skip to contentSkip to conversation

selftests: vDSO: Fix header search list for vgetrandom-chacha.S

PATCH In review Thomas Huth 2 participants 3 messages Oct 30 – Nov 2

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

PATCH 1/1 selftests: vDSO: Fix header search list for vgetrandom-chacha.S

On aarch64, vgetrandom-chacha.S includes the assembler file from arch/arm64/kernel/vdso/vgetrandom-chacha.S, and that includes <asm/assembler.h> which in turn includes lots of system header files. For this, we should make sure that the kernel headers of the *current* kernel are in the search path of the compiler, otherwise we end up including headers from /usr/include of the current distro instead, and this is calling for trouble! Thus use $(KHDR_INCLUDES) here to make sure that we are using the right header files. (This issue has been found in a patch series that replaces __ASSEMBLY__ with __ASSEMBLER__ in the various kernel headers and finally stops defining __ASSEMBLY__ in the kernel makefiles - when vgetrandom-chacha.S now tries to include a header from /usr/include the compilation fails since those headers still require __ASSEMBLY__ to fence away the C code)

---
See this link for the build failure:
https://lore.kernel.org/oe-kbuild-all/[email protected]/

 tools/testing/selftests/vDSO/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/vDSO/Makefile +2 -1
index a61047bdcd576..1af346ac87081 100644
@@ -37,7 +37,8 @@ $(OUTPUT)/vdso_test_getrandom: CFLAGS += -isystem $(top_srcdir)/tools/include \
                                          -isystem $(top_srcdir)/include/uapi
 
 $(OUTPUT)/vdso_test_chacha: vgetrandom-chacha.S
-$(OUTPUT)/vdso_test_chacha: CFLAGS += -idirafter $(top_srcdir)/tools/include \
+$(OUTPUT)/vdso_test_chacha: CFLAGS += $(KHDR_INCLUDES) \
+                                      -idirafter $(top_srcdir)/tools/include \
                                       -idirafter $(top_srcdir)/tools/include/generated \
                                       -idirafter $(top_srcdir)/arch/$(SRCARCH)/include \
                                       -idirafter $(top_srcdir)/include \
Signature · 1 line
2.56.0
Tested-by on v1 1/1
#1 lore raw
Quoted 14 lines · Thomas Huth

On aarch64, vgetrandom-chacha.S includes the assembler file from arch/arm64/kernel/vdso/vgetrandom-chacha.S, and that includes <asm/assembler.h> which in turn includes lots of system header files. For this, we should make sure that the kernel headers of the *current* kernel are in the search path of the compiler, otherwise we end up including headers from /usr/include of the current distro instead, and this is calling for trouble! Thus use $(KHDR_INCLUDES) here to make sure that we are using the right header files. (This issue has been found in a patch series that replaces __ASSEMBLY__ with __ASSEMBLER__ in the various kernel headers and finally stops defining __ASSEMBLY__ in the kernel makefiles - when vgetrandom-chacha.S now tries to include a header from /usr/include the compilation fails since those headers still require __ASSEMBLY__ to fence away the C code)

Quoted 5 lines

---
See this link for the build failure:

https://lore.kernel.org/oe-kbuild-all/[email protected]/

If you like, I can add this to the asm-generic tree to avoid the regression from your series, or Shuah can pick this up the normal way as a bugfix for kselftest.

Arnd

#2 lore raw
Quoted 19 lines · Arnd Bergmann
Quoted 18 lines · Thomas Huth

On aarch64, vgetrandom-chacha.S includes the assembler file from arch/arm64/kernel/vdso/vgetrandom-chacha.S, and that includes <asm/assembler.h> which in turn includes lots of system header files. For this, we should make sure that the kernel headers of the *current* kernel are in the search path of the compiler, otherwise we end up including headers from /usr/include of the current distro instead, and this is calling for trouble! Thus use $(KHDR_INCLUDES) here to make sure that we are using the right header files. (This issue has been found in a patch series that replaces __ASSEMBLY__ with __ASSEMBLER__ in the various kernel headers and finally stops defining __ASSEMBLY__ in the kernel makefiles - when vgetrandom-chacha.S now tries to include a header from /usr/include the compilation fails since those headers still require __ASSEMBLY__ to fence away the C code)

---
See this link for the build failure:

Quoted 7 lines
Quoted 1 line

https://lore.kernel.org/oe-kbuild-all/[email protected]/

If you like, I can add this to the asm-generic tree to avoid the regression from your series, or Shuah can pick this up the normal way as a bugfix for kselftest.

It's maybe better to stick the patch close to my other patches to avoid that other people run into problems when bisecting later, so unless Shuah objects I'd prefer if you could pick it up, Arnd!

Thanks,
Thomas