diff mbox series

[v2,12/16] selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers

Message ID 20250226-parse_vdso-nolibc-v2-12-28e14e031ed8@linutronix.de (mailing list archive)
State New
Headers show
Series selftests: vDSO: parse_vdso: Make compatible with nolibc | expand

Commit Message

Thomas Weißschuh Feb. 26, 2025, 11:44 a.m. UTC
To allow the usage of parse_vdso.c together with a limited libc like
nolibc, use the kernels own elf.h and auxvec.h headers.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 tools/testing/selftests/vDSO/Makefile     | 3 +++
 tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Vincenzo Frascino Feb. 28, 2025, 12:29 p.m. UTC | #1
On 26/02/2025 11:44, Thomas Weißschuh wrote:
> To allow the usage of parse_vdso.c together with a limited libc like
> nolibc, use the kernels own elf.h and auxvec.h headers.
> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> ---
>  tools/testing/selftests/vDSO/Makefile     | 3 +++
>  tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
> index 1cf14a8da43803249f72fe1b09689c8834806986..bc8ca186fb877dc11740c37f1e07e45e84c2ae92 100644
> --- a/tools/testing/selftests/vDSO/Makefile
> +++ b/tools/testing/selftests/vDSO/Makefile
> @@ -19,6 +19,9 @@ LDLIBS += -lgcc_s
>  endif
>  
>  include ../lib.mk
> +
> +CFLAGS += $(TOOLS_INCLUDES)
> +
>  $(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
>  $(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
>  $(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
> diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
> index 3638fe605e80ca41b29d43c6ac452964eef35d56..200c534cc70e2c2381fce3be5c0ebe4cb5675e84 100644
> --- a/tools/testing/selftests/vDSO/parse_vdso.c
> +++ b/tools/testing/selftests/vDSO/parse_vdso.c
> @@ -19,7 +19,8 @@
>  #include <stdint.h>
>  #include <string.h>
>  #include <limits.h>
> -#include <elf.h>
> +#include <linux/auxvec.h>
> +#include <linux/elf.h>
>  
>  #include "parse_vdso.h"
>  
>
Mark Brown March 20, 2025, 1:23 p.m. UTC | #2
On Wed, Feb 26, 2025 at 12:44:51PM +0100, Thomas Weißschuh wrote:
> To allow the usage of parse_vdso.c together with a limited libc like
> nolibc, use the kernels own elf.h and auxvec.h headers.

The vDSO selftests currently fail build for at least arm64 in -next:

  CC       vdso_test_gettimeofday
  CC       vdso_test_getcpu
  CC       vdso_test_abi
  CC       vdso_test_clock_getres
  CC       vdso_test_correctness
  CC       vdso_test_getrandom
  CC       vdso_test_chacha
/build/stage/linux/tools/include/uapi/linux/types.h: Assembler messages:
/build/stage/linux/tools/include/uapi/linux/types.h:9: Error: unknown mnemonic `typedef' -- `typedef __u16 __le16'
/build/stage/linux/tools/include/uapi/linux/types.h:10: Error: unknown mnemonic `typedef' -- `typedef __u16 __be16'
/build/stage/linux/tools/include/uapi/linux/types.h:11: Error: unknown mnemonic `typedef' -- `typedef __u32 __le32'
/build/stage/linux/tools/include/uapi/linux/types.h:12: Error: unknown mnemonic `typedef' -- `typedef __u32 __be32'
/build/stage/linux/tools/include/uapi/linux/types.h:13: Error: unknown mnemonic `typedef' -- `typedef __u64 __le64'
/build/stage/linux/tools/include/uapi/linux/types.h:14: Error: unknown mnemonic `typedef' -- `typedef __u64 __be64'
/build/stage/linux/tools/include/uapi/linux/types.h:16: Error: unknown mnemonic `typedef' -- `typedef __u16 __sum16'
/build/stage/linux/tools/include/uapi/linux/types.h:17: Error: unknown mnemonic `typedef' -- `typedef __u32 __wsum'

a bisect points at this patch, it looks like that's due to the switch to
use TOOLS_INCLUDES but I didn't dig into the specifics.
Mark Brown March 26, 2025, 1:02 p.m. UTC | #3
On Thu, Mar 20, 2025 at 01:23:47PM +0000, Mark Brown wrote:
> On Wed, Feb 26, 2025 at 12:44:51PM +0100, Thomas Weißschuh wrote:
> > To allow the usage of parse_vdso.c together with a limited libc like
> > nolibc, use the kernels own elf.h and auxvec.h headers.

> The vDSO selftests currently fail build for at least arm64 in -next:

...

> a bisect points at this patch, it looks like that's due to the switch to
> use TOOLS_INCLUDES but I didn't dig into the specifics.

This bug is now in mainline.  A fix was posted by Thomas the day after
the original report:

   https://lore.kernel.org/r/20250321-uapi-consistency-v1-1-439070118dc0@linutronix.de

but it has apparently slipped through the cracks.
Shuah Khan March 28, 2025, 11:08 p.m. UTC | #4
On 3/26/25 07:02, Mark Brown wrote:
> On Thu, Mar 20, 2025 at 01:23:47PM +0000, Mark Brown wrote:
>> On Wed, Feb 26, 2025 at 12:44:51PM +0100, Thomas Weißschuh wrote:
>>> To allow the usage of parse_vdso.c together with a limited libc like
>>> nolibc, use the kernels own elf.h and auxvec.h headers.
> 
>> The vDSO selftests currently fail build for at least arm64 in -next:
> 
> ...
> 
>> a bisect points at this patch, it looks like that's due to the switch to
>> use TOOLS_INCLUDES but I didn't dig into the specifics.
> 
> This bug is now in mainline.  A fix was posted by Thomas the day after
> the original report:
> 
>     https://lore.kernel.org/r/20250321-uapi-consistency-v1-1-439070118dc0@linutronix.de
> 
> but it has apparently slipped through the cracks.

If this is going through tip

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

Otherwise, I can send this up

thanks,
-- Shuah
Mark Brown March 31, 2025, 11:56 a.m. UTC | #5
On Fri, Mar 28, 2025 at 05:08:26PM -0600, Shuah Khan wrote:
> On 3/26/25 07:02, Mark Brown wrote:

> > This bug is now in mainline.  A fix was posted by Thomas the day after
> > the original report:

> >     https://lore.kernel.org/r/20250321-uapi-consistency-v1-1-439070118dc0@linutronix.de

> > but it has apparently slipped through the cracks.

> If this is going through tip

> Acked-by: Shuah Khan <skhan@linuxfoundation.org>

> Otherwise, I can send this up

Given that this hasn't had a response from tip for several weeks it's
probably as well for you to pick it up - I was considering sending it
directly to Linus myself.
diff mbox series

Patch

diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index 1cf14a8da43803249f72fe1b09689c8834806986..bc8ca186fb877dc11740c37f1e07e45e84c2ae92 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -19,6 +19,9 @@  LDLIBS += -lgcc_s
 endif
 
 include ../lib.mk
+
+CFLAGS += $(TOOLS_INCLUDES)
+
 $(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
 $(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
 $(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 3638fe605e80ca41b29d43c6ac452964eef35d56..200c534cc70e2c2381fce3be5c0ebe4cb5675e84 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -19,7 +19,8 @@ 
 #include <stdint.h>
 #include <string.h>
 #include <limits.h>
-#include <elf.h>
+#include <linux/auxvec.h>
+#include <linux/elf.h>
 
 #include "parse_vdso.h"