arch/x86/kernel/shstk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The following commit has been merged into the x86/cpu branch of tip:
Commit-ID: f4cadf2d1ee3a24f259495309b76f98af467004b
Gitweb: https://git.kernel.org/tip/f4cadf2d1ee3a24f259495309b76f98af467004b
Author: Bill Roberts <bill.roberts@arm.com>
AuthorDate: Tue, 07 Jul 2026 13:45:42 -05:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Wed, 02 Sep 2026 14:06:27 -07:00
x86/shstk: Shadow stack enabling write return code change
The WRSS instruction (the special instruction that writes to shadow stacks)
cannot be used in userspace unless IA32_U_CET.SH_STK_EN=1 (user shadow
stack is enabled). So the kernel *should* return -EINVAL to userspace if
it tries to enable it when shadow stack is disabled. However, currently,
it will return -EPERM. But, that error code doesn't fit the condition as
the failure is due to an invalid state change request not a permission
issue.
Investigating userspace call sites, like glibc and criu (checkpoint code),
they do not rely on this specific error message, nor could a 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>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260707184542.1721085-1-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 0ca6490..eb690ba 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)
On Wed, Sep 02, 2026 at 09:11:03PM -0000, tip-bot2 for Bill Roberts wrote:
> The following commit has been merged into the x86/cpu branch of tip:
>
> Commit-ID: f4cadf2d1ee3a24f259495309b76f98af467004b
> Gitweb: https://git.kernel.org/tip/f4cadf2d1ee3a24f259495309b76f98af467004b
> Author: Bill Roberts <bill.roberts@arm.com>
> AuthorDate: Tue, 07 Jul 2026 13:45:42 -05:00
> Committer: Dave Hansen <dave.hansen@linux.intel.com>
> CommitterDate: Wed, 02 Sep 2026 14:06:27 -07:00
>
> x86/shstk: Shadow stack enabling write return code change
https://docs.kernel.org/process/maintainer-tip.html#patch-subject
"The condensed patch description in the subject line ... should be written in
imperative tone."
And that title doesn't really say what this fixes.
Lemme fix it up.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
© 2016 - 2026 Red Hat, Inc.