Skip to content

selftests: vDSO: parse_vdso: Make compatible with nolibc

Thomas Weißschuh linux-kselftest linux-mm lkml llvm 2 versions – Applied

Status from this message: The following commit has been merged into the timers/vdso branch of tip:

Get series with b4
b4 am [email protected] change-id 20241017-parse_vdso-nolibc-e069baa7ff48

Versions newest first

  1. v2 Latest16 patches 26 repliesApplied
  2. v116 patches 15 repliesSuperseded

Changes in v2 from the cover letter

- Provide a limits.h header in nolibc
- Pick up Reviewed-by tags from Kees
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/16MAINTAINERS: Add vDSO selftestsMAINTAINERS+1 -01 reply
2/16elf, uapi: Add definition for STN_UNDEFinclude/uapi/linux/elf.h+2 -01 reply
3/16elf, uapi: Add definition for DT_GNU_HASHinclude/uapi/linux/elf.h+1 -01 reply
4/16elf, uapi: Add definitions for VER_FLG_BASE and VER_FLG_WEAKinclude/uapi/linux/elf.h+3 -01 reply
5/16elf, uapi: Add type ElfXX_Versyminclude/uapi/linux/elf.h+2 -01 reply
6/16elf, uapi: Add types ElfXX_Verdef and ElfXX_Verauxinclude/uapi/linux/elf.h+30 -01 reply
7/16tools/include: Add uapi/linux/elf.htools/include/uapi/linux/elf.h+524 -01 reply
8/16selftests: Add headers targettools/testing/selftests/lib.mk+4 -11 reply
9/16tools/nolibc: add limits.h shim headertools/include/nolibc/Makefile tools/include/nolibc/limits.h+8 -02 replies
10/16selftests: vDSO: vdso_standalone_test_x86: Use vdso_init_form_sysinfo_ehdrtools/testing/selftests/vDSO/vdso_standalone_test_x86.c+26 -11 reply
11/16selftests: vDSO: parse_vdso: Drop vdso_init_from_auxv()tools/testing/selftests/vDSO/parse_vdso.c tools/testing/selftests/vDSO/parse_vdso.h+0 -151 reply
12/16selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headerstools/testing/selftests/vDSO/Makefile tools/testing/selftests/vDSO/parse_vdso.c+5 -16 replies
13/16selftests: vDSO: parse_vdso: Test __SIZEOF_LONG__ instead of ULONG_MAXtools/testing/selftests/vDSO/parse_vdso.c+1 -11 reply
14/16selftests: vDSO: vdso_test_gettimeofday: Clean up includestools/testing/selftests/vDSO/vdso_test_gettimeofday.c+0 -21 reply
15/16selftests: vDSO: vdso_test_gettimeofday: Make compatible with nolibctools/testing/selftests/vDSO/vdso_test_gettimeofday.c+2 -01 reply
16/16selftests: vDSO: vdso_standalone_test_x86: Switch to nolibctools/testing/selftests/vDSO/Makefile tools/testing/selftests/vDSO/vdso_standalone_test_x86.c+7 -1694 replies

Reviews trailers per patch

All 16 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKees CookShuah KhanVincenzo FrascinoWilly TarreauJason Gunthorpe
SeriesA-b
1/16R-b
2/16R-b R-b
3/16R-b R-b
4/16R-b R-b
5/16R-b R-b
6/16R-b R-b
7/16R-b
8/16R-b
9/16R-b A-b T-b
10/16R-b
11/16R-b
12/16A-b R-b
13/16R-b
14/16R-b
15/16R-b
16/16R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/16] selftests: vDSO: parse_vdso: Make compatible with nolibc

For testing the functionality of the vDSO, it is necessary to build userspace programs for multiple different architectures.
It is additional work to acquire matching userspace cross-compilers with full C libraries and then building root images out of those.
The kernel tree already contains nolibc, a small, header-only C library. By using it, it is possible to build userspace programs without any additional dependencies.
For example the kernel.org crosstools or multi-target clang can be used to build test programs for a multitude of architectures.
While nolibc is very limited, it is enough for many selftests. With some minor adjustments it is possible to make parse_vdso.c compatible with nolibc.
As an example, vdso_standalone_test_x86 is now built from the same C code as the regular vdso_test_gettimeofday, while still being completely standalone.
Also drop the dependency of parse_vdso.c on the elf.h header from libc and only use the one from the kernel's UAPI.

While this series is useful on its own now, it will also integrate with the kunit UAPI framework currently under development:
https://lore.kernel.org/lkml/[email protected]/

---
Changes in v2:
- Provide a limits.h header in nolibc
- Pick up Reviewed-by tags from Kees
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Weißschuh (16):
MAINTAINERS: Add vDSO selftests
elf, uapi: Add definition for STN_UNDEF
elf, uapi: Add definition for DT_GNU_HASH
elf, uapi: Add definitions for VER_FLG_BASE and VER_FLG_WEAK elf, uapi: Add type ElfXX_Versym
elf, uapi: Add types ElfXX_Verdef and ElfXX_Veraux tools/include: Add uapi/linux/elf.h
selftests: Add headers target
tools/nolibc: add limits.h shim header
selftests: vDSO: vdso_standalone_test_x86: Use vdso_init_form_sysinfo_ehdr
selftests: vDSO: parse_vdso: Drop vdso_init_from_auxv()
selftests: vDSO: parse_vdso: Use UAPI headers instead of libc headers
selftests: vDSO: parse_vdso: Test __SIZEOF_LONG__ instead of ULONG_MAX
selftests: vDSO: vdso_test_gettimeofday: Clean up includes
selftests: vDSO: vdso_test_gettimeofday: Make compatible with nolibc
selftests: vDSO: vdso_standalone_test_x86: Switch to nolibc

 MAINTAINERS                                        |   1 +
 include/uapi/linux/elf.h                           |  38 ++
 tools/include/nolibc/Makefile                      |   1 +
 tools/include/nolibc/limits.h                      |   7 +
 tools/include/uapi/linux/elf.h                     | 524 +++++++++++++++++++++
 tools/testing/selftests/lib.mk                     |   5 +-
 tools/testing/selftests/vDSO/Makefile              |  11 +-
 tools/testing/selftests/vDSO/parse_vdso.c          |  19 +-
 tools/testing/selftests/vDSO/parse_vdso.h          |   1 -
 .../selftests/vDSO/vdso_standalone_test_x86.c      | 143 +-----
 .../selftests/vDSO/vdso_test_gettimeofday.c        |   4 +-
 11 files changed, 590 insertions(+), 164 deletions(-)

---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20241017-parse_vdso-nolibc-e069baa7ff48

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>