Re: [PATCH v9 37/39] kselftest/arm64: Add GCS signal tests

From: Thiago Jung Bauermann
Date: Thu Jul 18 2024 - 19:04:02 EST


Mark Brown <broonie@xxxxxxxxxx> writes:

> Do some testing of the signal handling for GCS, checking that a GCS
> frame has the expected information in it and that the expected signals
> are delivered with invalid operations.
>
> Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@xxxxxxxxxx>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> ---
> tools/testing/selftests/arm64/signal/.gitignore | 1 +
> .../selftests/arm64/signal/test_signals_utils.h | 10 +++
> .../arm64/signal/testcases/gcs_exception_fault.c | 62 +++++++++++++++
> .../selftests/arm64/signal/testcases/gcs_frame.c | 88 ++++++++++++++++++++++
> .../arm64/signal/testcases/gcs_write_fault.c | 67 ++++++++++++++++
> 5 files changed, 228 insertions(+)

The gcs_write_fault test fails for me, even without THP:

$ sudo ./run_kselftest.sh -t arm64:gcs_write_fault
TAP version 13
1..1
# timeout set to 45
# selftests: arm64: gcs_write_fault
# # GCS write fault :: Normal writes to a GCS segfault
# Registered handlers for all signals.
# Detected MINSTKSIGSZ:4720
# Required Features: [ GCS ] supported
# Incompatible Features: [] absent
# Testcase initialized.
# Read value 0x0
# SIG_OK -- SP:0xFFFFCF1292D0 si_addr@:0xffffba645000 si_code:10 token@:(nil) offset:-281473808879616
# si_code != SEGV_ACCERR...test is probably broken!
# -- RX UNEXPECTED SIGNAL: 6 code -6 address 0xf76
# ==>> completed. FAIL(0)
not ok 1 selftests: arm64: gcs_write_fault # exit=1

It also generates an "INVALID GCS" line in dmesg.

--
Thiago