Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: gcs: Return -EPERM when changes are prevented by locking
@ 2026-09-10 19:00 Mark Brown
  2026-09-10 19:00 ` [PATCH 1/2] arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures Mark Brown
  2026-09-10 19:00 ` [PATCH 2/2] kselftest/arm64: Check for -EPERM not -EBUSY in the locking test Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-10 19:00 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan
  Cc: linux-arm-kernel, linux-kernel, linux-kselftest, Mark Brown,
	Bill Roberts

When we refuse to change the GCS configuraiton due to locking we
currently return -EBUSY which is an odd choice.  The only userspace I
found that relies on this value at present is the kselftest and other
architectures are using the more obvious -EPERM here let's switch.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Mark Brown (2):
      arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures
      kselftest/arm64: Check for -EPERM not -EBUSY in the locking test

 arch/arm64/include/asm/gcs.h                    | 2 +-
 tools/testing/selftests/arm64/gcs/gcs-locking.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260910-arm64-gcs-lock-eperm-06ce8f8e5250

Best regards,
--  
Mark Brown <broonie@kernel.org>



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

* [PATCH 1/2] arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures
  2026-09-10 19:00 [PATCH 0/2] arm64: gcs: Return -EPERM when changes are prevented by locking Mark Brown
@ 2026-09-10 19:00 ` Mark Brown
  2026-09-10 19:00 ` [PATCH 2/2] kselftest/arm64: Check for -EPERM not -EBUSY in the locking test Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-10 19:00 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan
  Cc: linux-arm-kernel, linux-kernel, linux-kselftest, Mark Brown,
	Bill Roberts

When we refuse to perform a GCS configuration change due to locking we
currently return -EBUSY which is an odd error code to return.  While the
selftest does currently check for this it is unlikely that we have any
practical users relying on the behaviour at this point so let's change
to return the more descriptive -EPERM instead like other architectures.

Reported-by: Bill Roberts <bill.roberts@foss.arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/include/asm/gcs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/gcs.h b/arch/arm64/include/asm/gcs.h
index 8fa0707069e8..bbc22e382cfe 100644
--- a/arch/arm64/include/asm/gcs.h
+++ b/arch/arm64/include/asm/gcs.h
@@ -76,7 +76,7 @@ static inline int gcs_check_locked(struct task_struct *task,
 	new_val &= task->thread.gcs_el0_locked;
 
 	if (cur_val != new_val)
-		return -EBUSY;
+		return -EPERM;
 
 	return 0;
 }

-- 
2.47.3



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

* [PATCH 2/2] kselftest/arm64: Check for -EPERM not -EBUSY in the locking test
  2026-09-10 19:00 [PATCH 0/2] arm64: gcs: Return -EPERM when changes are prevented by locking Mark Brown
  2026-09-10 19:00 ` [PATCH 1/2] arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures Mark Brown
@ 2026-09-10 19:00 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-10 19:00 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan
  Cc: linux-arm-kernel, linux-kernel, linux-kselftest, Mark Brown

The API has been updated to return the more permissive -EPERM rather
than -EBUSY, update the selftest to reflect this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/gcs/gcs-locking.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/arm64/gcs/gcs-locking.c b/tools/testing/selftests/arm64/gcs/gcs-locking.c
index 1e6abb136ffd..f780f0c7b8dd 100644
--- a/tools/testing/selftests/arm64/gcs/gcs-locking.c
+++ b/tools/testing/selftests/arm64/gcs/gcs-locking.c
@@ -115,7 +115,7 @@ TEST_F(valid_modes, enable_lock_disable)
 	ASSERT_EQ(ret, 0);
 
 	ret = my_syscall2(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, 0);
-	ASSERT_EQ(ret, -EBUSY);
+	ASSERT_EQ(ret, -EPERM);
 
 	_exit(0);
 }
@@ -131,7 +131,7 @@ TEST_F(valid_modes, lock_enable)
 
 	ret = my_syscall2(__NR_prctl, PR_SET_SHADOW_STACK_STATUS,
 			  variant->mode);
-	ASSERT_EQ(ret, -EBUSY);
+	ASSERT_EQ(ret, -EPERM);
 
 	ret = prctl(PR_GET_SHADOW_STACK_STATUS, &mode, 0, 0, 0);
 	ASSERT_EQ(ret, 0);

-- 
2.47.3



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

end of thread, other threads:[~2026-09-10 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 19:00 [PATCH 0/2] arm64: gcs: Return -EPERM when changes are prevented by locking Mark Brown
2026-09-10 19:00 ` [PATCH 1/2] arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures Mark Brown
2026-09-10 19:00 ` [PATCH 2/2] kselftest/arm64: Check for -EPERM not -EBUSY in the locking test Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox