From: Bill Roberts <bill.roberts@arm.com>
To: rick.p.edgecombe@intel.com, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: Bill Roberts <bill.roberts@arm.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] x86/shstk: shadow stack enabling write return code change
Date: Mon, 15 Jun 2026 15:00:02 -0500 [thread overview]
Message-ID: <20260615200002.259275-1-bill.roberts@arm.com> (raw)
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
next reply other threads:[~2026-06-15 20:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 20:00 Bill Roberts [this message]
2026-07-07 18:17 ` Edgecombe, Rick P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260615200002.259275-1-bill.roberts@arm.com \
--to=bill.roberts@arm.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®