linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] kselftest/arm64/gcs: Cleanups for basic-gcs.c
@ 2025-08-21 15:13 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
  0 siblings, 2 replies; 5+ 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

Two small cleanups.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (2):
      kselftest/arm64/gcs: Correctly check return value when disabling GCS
      kselftest/arm64/gcs: Use nolibc's getauxval()

 tools/testing/selftests/arm64/gcs/basic-gcs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250821-nolibc-gcs-fixes-11cf7585bb74

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [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
  1 sibling, 1 reply; 5+ 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 related	[flat|nested] 5+ 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
  1 sibling, 1 reply; 5+ 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 related	[flat|nested] 5+ 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; 5+ 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] 5+ 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; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2025-08-21 17:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 17:08   ` Mark Brown
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).