[PATCH v3 0/4] kselftest/arm64: Add coverage for the interaction of vfork() and GCS

Mark Brown posted 4 patches 3 months ago
tools/include/nolibc/arch-sparc.h             | 16 +++++++
tools/include/nolibc/sys.h                    | 59 ++++++++++++++++++-------
tools/testing/selftests/arm64/gcs/basic-gcs.c | 63 +++++++++++++++++++++++++++
tools/testing/selftests/nolibc/nolibc-test.c  | 23 ++++++++--
4 files changed, 142 insertions(+), 19 deletions(-)
[PATCH v3 0/4] kselftest/arm64: Add coverage for the interaction of vfork() and GCS
Posted by Mark Brown 3 months ago
I had cause to look at the vfork() support for GCS and realised that we
don't have any direct test coverage, this series does so by adding
vfork() to nolibc and then using that in basic-gcs to provide some
simple vfork() coverage.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Changes in v3:
- Stylistic nits in the GCS vfork() test.
- SPARC has a non-standard vfork() ABI which needs handling.
- Link to v2: https://lore.kernel.org/r/20250610-arm64-gcs-vfork-exit-v2-0-929443dfcf82@kernel.org

Changes in v2:
- Add replacement of ifdef with if defined() in nolibc since the code
  doesn't reflect the coding style.
- Remove check for arch specific vfork().
- Link to v1: https://lore.kernel.org/r/20250609-arm64-gcs-vfork-exit-v1-0-baad0f085747@kernel.org

---
Mark Brown (4):
      tools/nolibc: Replace ifdef with if defined() in sys.h
      tools/nolibc: Provide vfork()
      kselftest/arm64: Add a test for vfork() with GCS
      selftests/nolibc: Add coverage of vfork()

 tools/include/nolibc/arch-sparc.h             | 16 +++++++
 tools/include/nolibc/sys.h                    | 59 ++++++++++++++++++-------
 tools/testing/selftests/arm64/gcs/basic-gcs.c | 63 +++++++++++++++++++++++++++
 tools/testing/selftests/nolibc/nolibc-test.c  | 23 ++++++++--
 4 files changed, 142 insertions(+), 19 deletions(-)
---
base-commit: 86731a2a651e58953fc949573895f2fa6d456841
change-id: 20250528-arm64-gcs-vfork-exit-4a7daf7652ee

Best regards,
--  
Mark Brown <broonie@kernel.org>
Re: [PATCH v3 0/4] kselftest/arm64: Add coverage for the interaction of vfork() and GCS
Posted by Thomas Weißschuh 3 months ago
On 2025-07-03 17:00:14+0100, Mark Brown wrote:
> I had cause to look at the vfork() support for GCS and realised that we
> don't have any direct test coverage, this series does so by adding
> vfork() to nolibc and then using that in basic-gcs to provide some
> simple vfork() coverage.

Thanks. I applied the patches, but moved the arm64 selftest patch to be
the last one.

FYI nolibc now has a proper prctl() implementation you might want to use.
Also your vfork() selftest uncovered a bug in the brandnew SuperH support.

> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> Changes in v3:
> - Stylistic nits in the GCS vfork() test.
> - SPARC has a non-standard vfork() ABI which needs handling.
> - Link to v2: https://lore.kernel.org/r/20250610-arm64-gcs-vfork-exit-v2-0-929443dfcf82@kernel.org
> 
> Changes in v2:
> - Add replacement of ifdef with if defined() in nolibc since the code
>   doesn't reflect the coding style.
> - Remove check for arch specific vfork().
> - Link to v1: https://lore.kernel.org/r/20250609-arm64-gcs-vfork-exit-v1-0-baad0f085747@kernel.org
> 
> ---
> Mark Brown (4):
>       tools/nolibc: Replace ifdef with if defined() in sys.h
>       tools/nolibc: Provide vfork()
>       kselftest/arm64: Add a test for vfork() with GCS
>       selftests/nolibc: Add coverage of vfork()
> 
>  tools/include/nolibc/arch-sparc.h             | 16 +++++++
>  tools/include/nolibc/sys.h                    | 59 ++++++++++++++++++-------
>  tools/testing/selftests/arm64/gcs/basic-gcs.c | 63 +++++++++++++++++++++++++++
>  tools/testing/selftests/nolibc/nolibc-test.c  | 23 ++++++++--
>  4 files changed, 142 insertions(+), 19 deletions(-)
> ---
> base-commit: 86731a2a651e58953fc949573895f2fa6d456841
> change-id: 20250528-arm64-gcs-vfork-exit-4a7daf7652ee
> 
> Best regards,
> --  
> Mark Brown <broonie@kernel.org>
>
Re: [PATCH v3 0/4] kselftest/arm64: Add coverage for the interaction of vfork() and GCS
Posted by Mark Brown 3 months ago
On Fri, Jul 04, 2025 at 01:27:28PM +0200, Thomas Weißschuh wrote:

> FYI nolibc now has a proper prctl() implementation you might want to use.

That's open coded because we absolutely cannot tolerate the prctl() to
enable GCS being anything other than inlined, returning from an actual
function call would crash.  Probably for nolibc that'd mostly work out
but it seems better to be very clear about the inlining.

> Also your vfork() selftest uncovered a bug in the brandnew SuperH support.

Ah, doing good work already!