selftests: vDSO: Fix header search list for vgetrandom-chacha.S
Subsystems (2)
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
@@ -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
Quoted 14 lines · Thomas Huth
On aarch64,
vgetrandom-chacha.Sincludes the assembler file fromarch/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/includeof 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 - whenvgetrandom-chacha.Snow tries to include a header from/usr/includethe compilation fails since those headers still require__ASSEMBLY__to fence away the C code)
Quoted 5 lines
Signed-off-by Thomas Huth <[email protected]>---
See this link for the build failure:
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
Quoted 19 lines · Arnd Bergmann
Quoted 18 lines · Thomas Huth
On aarch64,
vgetrandom-chacha.Sincludes the assembler file fromarch/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/includeof 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 - whenvgetrandom-chacha.Snow tries to include a header from/usr/includethe compilation fails since those headers still require__ASSEMBLY__to fence away the C code)Signed-off-by Thomas Huth <[email protected]>---
See this link for the build failure:
Quoted 7 lines
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