From: Bill Roberts <bill.roberts@arm.com>
To: Dave Hansen <dave.hansen@intel.com>,
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: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86/shstk: shadow stack enabling write return code change
Date: Wed, 8 Jul 2026 15:56:03 -0500 [thread overview]
Message-ID: <0d639fcc-4bb1-46a5-825d-beb803b8f3e7@arm.com> (raw)
In-Reply-To: <f9223651-a51d-471d-805d-e9a2ee9c6b51@intel.com>
On 7/8/26 11:46 AM, Dave Hansen wrote:
> On 7/7/26 11:45, Bill Roberts wrote:
>> 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".
> Hi Bill,
>
> Thanks for the patch. One bit of context I'd appreciate: why do you
> care? Were you just auditing the code and something seemed wrong? Were
> you doing some ARM code and noticed a mismatch?
>
> What motivated the change?
Hi Dave, long time no see. So the motivation for the patches is around
adding LSM controls on disabling or making the shadow stack writable.
So, as part of that work, which will be forthcoming very soon, is
supporting the prctl interface for x86 shadow stack controls, so that
the LSMs are arch agnostic. This also provides a common userspace
shadow stack API for all archs currently supporting this feature (x86,
arm64, riscv).
This would also let things, like glibc, have a common UAPI.
It's important to note that this work I describe, leaves the arch_prctl
interface
intact, and it will need an lsm hook for controls via arch_prctl. This
way both
paths behave the same way.
Now for this patch. I noticed this issue when I was doing negative testing
from userspace via prctl and the return value didn't match what was in
the pcrtl man page.
Thanks,
Bill
next prev parent reply other threads:[~2026-07-08 20:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 18:45 Bill Roberts
2026-07-07 18:56 ` Edgecombe, Rick P
2026-07-08 16:46 ` Dave Hansen
2026-07-08 20:56 ` Bill Roberts [this message]
2026-07-08 21:00 ` Dave Hansen
2026-07-14 20:22 ` Bill Roberts
2026-07-14 20:27 ` Dave Hansen
2026-09-09 18:50 ` Bill Roberts
2026-09-09 18:59 ` Edgecombe, Rick P
2026-09-02 21:11 ` [tip: x86/cpu] x86/shstk: Shadow " tip-bot2 for Bill Roberts
2026-09-15 2:06 ` Borislav Petkov
2026-09-15 2:10 ` [tip: x86/cpu] x86/shstk: Return the correct error value when user shadow stacks are disabled tip-bot2 for Bill Roberts
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=0d639fcc-4bb1-46a5-825d-beb803b8f3e7@arm.com \
--to=bill.roberts@arm.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--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®