Re: [PATCH v10 38/40] kselftest/arm64: Add a GCS stress test

Thiago Jung Bauermann
2024-08-08T06:23:54Z

Mark Brown <broonie@kernel.org> writes:

> On Wed, Aug 07, 2024 at 07:39:54PM -0300, Thiago Jung Bauermann wrote:
>
>> # # Thread-4870: Failed to enable GCS
>
> which is printed if a basic PR_SET_SHADOW_STACK_STATUS fails immediately
> the program starts executing:
>
> function _start
> // Run with GCS
> mov x0, PR_SET_SHADOW_STACK_STATUS
> mov x1, PR_SHADOW_STACK_ENABLE
> mov x2, xzr
> mov x3, xzr
> mov x4, xzr
> mov x5, xzr
> mov x8, #__NR_prctl
> svc #0
> cbz x0, 1f
> puts "Failed to enable GCS\n"
> b abort
>
> the defines for which all seem up to date (and unlikely to fail in
> system or config specific fashions). What happens if you try to execute
> the gcs-stress-thread binary directly, does strace show anything
> interesting? If you instrument arch_set_shadow_stack_status() in the
> kernel does it show anything?

Thank you for the pointer. It turned out that I accidentally ran the
selftests binaries from the v9 version instead of the v10 version, and
the gcs-stress-thread binary failed because it was using the old value
for PR_SET_SHADOW_STACK_STATUS.

Using the v10 version of the selftests the gcs-stress test passes. Sorry
for the false alarm.

Tested-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>

--
Thiago