* [PATCH 1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS
2025-08-21 15:13 [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c Thomas Weißschuh
@ 2025-08-21 15:13 ` Thomas Weißschuh
2025-08-21 17:08 ` Mark Brown
2025-08-21 15:13 ` [PATCH 2/2] kselftest/arm64/gcs: Use nolibc's getauxval() Thomas Weißschuh
2025-09-08 15:55 ` [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c Will Deacon
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2025-08-21 15:13 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Shuah Khan, Thiago Jung Bauermann,
Mark Brown
Cc: linux-arm-kernel, linux-kselftest, linux-kernel, Thomas Weißschuh
The return value was not assigned to 'ret', so the check afterwards
does not do anything.
Fixes: 3d37d4307e0f ("kselftest/arm64: Add very basic GCS test program")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/testing/selftests/arm64/gcs/basic-gcs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/gcs/basic-gcs.c b/tools/testing/selftests/arm64/gcs/basic-gcs.c
index 54f9c888249d74451e1432280a395156ce72e56c..100d2a983155f7347a19b2b8b88f9494dc6a51d5 100644
--- a/tools/testing/selftests/arm64/gcs/basic-gcs.c
+++ b/tools/testing/selftests/arm64/gcs/basic-gcs.c
@@ -410,7 +410,7 @@ int main(void)
}
/* One last test: disable GCS, we can do this one time */
- my_syscall5(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, 0, 0, 0, 0);
+ ret = my_syscall5(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, 0, 0, 0, 0);
if (ret != 0)
ksft_print_msg("Failed to disable GCS: %d\n", ret);
--
2.50.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS
2025-08-21 15:13 ` [PATCH 1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS Thomas Weißschuh
@ 2025-08-21 17:08 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-21 17:08 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Catalin Marinas, Will Deacon, Shuah Khan, Thiago Jung Bauermann,
linux-arm-kernel, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
On Thu, Aug 21, 2025 at 05:13:02PM +0200, Thomas Weißschuh wrote:
> The return value was not assigned to 'ret', so the check afterwards
> does not do anything.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] kselftest/arm64/gcs: Use nolibc's getauxval()
2025-08-21 15:13 [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c Thomas Weißschuh
2025-08-21 15:13 ` [PATCH 1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS Thomas Weißschuh
@ 2025-08-21 15:13 ` Thomas Weißschuh
2025-08-21 17:24 ` Mark Brown
2025-09-08 15:55 ` [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c Will Deacon
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2025-08-21 15:13 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Shuah Khan, Thiago Jung Bauermann,
Mark Brown
Cc: linux-arm-kernel, linux-kselftest, linux-kernel, Thomas Weißschuh
Nolibc now does have getauxval(), use it.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/testing/selftests/arm64/gcs/basic-gcs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/arm64/gcs/basic-gcs.c b/tools/testing/selftests/arm64/gcs/basic-gcs.c
index 100d2a983155f7347a19b2b8b88f9494dc6a51d5..250977abc3988685abf68666d35b7a8547f74f4e 100644
--- a/tools/testing/selftests/arm64/gcs/basic-gcs.c
+++ b/tools/testing/selftests/arm64/gcs/basic-gcs.c
@@ -10,6 +10,7 @@
#include <sys/mman.h>
#include <asm/mman.h>
+#include <asm/hwcap.h>
#include <linux/sched.h>
#include "kselftest.h"
@@ -386,14 +387,13 @@ int main(void)
ksft_print_header();
- /*
- * We don't have getauxval() with nolibc so treat a failure to
- * read GCS state as a lack of support and skip.
- */
+ if (!(getauxval(AT_HWCAP) & HWCAP_GCS))
+ ksft_exit_skip("SKIP GCS not supported\n");
+
ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
&gcs_mode, 0, 0, 0);
if (ret != 0)
- ksft_exit_skip("Failed to read GCS state: %d\n", ret);
+ ksft_exit_fail_msg("Failed to read GCS state: %d\n", ret);
if (!(gcs_mode & PR_SHADOW_STACK_ENABLE)) {
gcs_mode = PR_SHADOW_STACK_ENABLE;
--
2.50.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] kselftest/arm64/gcs: Use nolibc's getauxval()
2025-08-21 15:13 ` [PATCH 2/2] kselftest/arm64/gcs: Use nolibc's getauxval() Thomas Weißschuh
@ 2025-08-21 17:24 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-21 17:24 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Catalin Marinas, Will Deacon, Shuah Khan, Thiago Jung Bauermann,
linux-arm-kernel, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 160 bytes --]
On Thu, Aug 21, 2025 at 05:13:03PM +0200, Thomas Weißschuh wrote:
> Nolibc now does have getauxval(), use it.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c
2025-08-21 15:13 [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c Thomas Weißschuh
2025-08-21 15:13 ` [PATCH 1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS Thomas Weißschuh
2025-08-21 15:13 ` [PATCH 2/2] kselftest/arm64/gcs: Use nolibc's getauxval() Thomas Weißschuh
@ 2025-09-08 15:55 ` Will Deacon
2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2025-09-08 15:55 UTC (permalink / raw)
To: Catalin Marinas, Shuah Khan, Thiago Jung Bauermann, Mark Brown,
Thomas Weißschuh
Cc: kernel-team, Will Deacon, linux-arm-kernel, linux-kselftest,
linux-kernel
On Thu, 21 Aug 2025 17:13:01 +0200, Thomas Weißschuh wrote:
> Two small cleanups.
>
>
Applied to arm64 (for-next/selftests), thanks!
[1/2] kselftest/arm64/gcs: Correctly check return value when disabling GCS
https://git.kernel.org/arm64/c/740cdafd0d99
[2/2] kselftest/arm64/gcs: Use nolibc's getauxval()
https://git.kernel.org/arm64/c/a985fe638344
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 6+ messages in thread