mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/shstk: shadow stack enabling write return code change
@ 2026-06-15 20:00 Bill Roberts
  2026-07-07 18:17 ` Edgecombe, Rick P
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Roberts @ 2026-06-15 20:00 UTC (permalink / raw)
  To: rick.p.edgecombe, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: Bill Roberts, linux-kernel

When enabling write to a shadow stack that is not enabled, it will
return EPERM. However, that error code doesn't fit the condition and it
should be EINVAL, as that state change cannot be fulfilled due to an
invalid argument not a permissions issue.

Investigating userspace call sites, they do not rely on this specific
error message, nor could userspace effectively utilize this specific
return error code to indicate a difference in "I cannot enable
write because of invalid permissions" versus "I cannot enable write
because the shadow stack is disabled".

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
---
 arch/x86/kernel/shstk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
index 0ca64900192f..eb690ba90180 100644
--- a/arch/x86/kernel/shstk.c
+++ b/arch/x86/kernel/shstk.c
@@ -490,7 +490,7 @@ static int wrss_control(bool enable)
 	 * when disabling.
 	 */
 	if (!features_enabled(ARCH_SHSTK_SHSTK))
-		return -EPERM;
+		return -EINVAL;
 
 	/* Already enabled/disabled? */
 	if (features_enabled(ARCH_SHSTK_WRSS) == enable)
-- 
2.54.0


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

end of thread, other threads:[~2026-07-07 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 20:00 [PATCH] x86/shstk: shadow stack enabling write return code change Bill Roberts
2026-07-07 18:17 ` Edgecombe, Rick P

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

all inboxes | Powered by JetHome®