Message ID | 20220130211838.8382-36-rick.p.edgecombe@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Shadow stacks for userspace | expand |
On Sun, Jan 30, 2022 at 01:18:38PM -0800, Rick Edgecombe wrote: > Shadow stack is supported on newer AMD processors, but the kernel > implementation has not been tested on them. Prevent basic issues from > showing up for normal users by disabling shadow stack on all CPUs except > Intel until it has been tested. At which point the limitation should be > removed. Hi Rick, I have been testing Yu-Cheng's patchsets on AMD hardware and I am working on testing this version now. How are you testing this new series? I can partially test by calling the prctl enable for shadow stack directly from a program, but I'm not sure how useful that's going to be without the glibc support. Do you have a public repo with the necessary glibc changes to enable shadow stack early? Thanks, John
On Thu, Feb 3, 2022 at 1:58 PM John Allen <john.allen@amd.com> wrote: > > On Sun, Jan 30, 2022 at 01:18:38PM -0800, Rick Edgecombe wrote: > > Shadow stack is supported on newer AMD processors, but the kernel > > implementation has not been tested on them. Prevent basic issues from > > showing up for normal users by disabling shadow stack on all CPUs except > > Intel until it has been tested. At which point the limitation should be > > removed. > > Hi Rick, > > I have been testing Yu-Cheng's patchsets on AMD hardware and I am > working on testing this version now. How are you testing this new > series? I can partially test by calling the prctl enable for shadow > stack directly from a program, but I'm not sure how useful that's going > to be without the glibc support. Do you have a public repo with the > necessary glibc changes to enable shadow stack early? > The glibc CET branch is at https://gitlab.com/x86-glibc/glibc/-/commits/users/hjl/cet/master
On Thu, Feb 03, 2022 at 02:23:43PM -0800, H.J. Lu wrote: > On Thu, Feb 3, 2022 at 1:58 PM John Allen <john.allen@amd.com> wrote: > > > > On Sun, Jan 30, 2022 at 01:18:38PM -0800, Rick Edgecombe wrote: > > > Shadow stack is supported on newer AMD processors, but the kernel > > > implementation has not been tested on them. Prevent basic issues from > > > showing up for normal users by disabling shadow stack on all CPUs except > > > Intel until it has been tested. At which point the limitation should be > > > removed. > > > > Hi Rick, > > > > I have been testing Yu-Cheng's patchsets on AMD hardware and I am > > working on testing this version now. How are you testing this new > > series? I can partially test by calling the prctl enable for shadow > > stack directly from a program, but I'm not sure how useful that's going > > to be without the glibc support. Do you have a public repo with the > > necessary glibc changes to enable shadow stack early? > > > > The glibc CET branch is at > > https://gitlab.com/x86-glibc/glibc/-/commits/users/hjl/cet/master Thanks, I ran some smoke tests with the updated glibc and it's looking good so far. Additionally, I ran the new kselftest and it passed. Thanks, John > > -- > H.J.
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 9ee339f5b8ca..7fbfe707a1db 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -517,6 +517,14 @@ __setup("nopku", setup_disable_pku); static __always_inline void setup_cet(struct cpuinfo_x86 *c) { + /* + * Shadow stack is supported on AMD processors, but has not been + * tested. Only support it on Intel processors until this is done. + * At which point, this vendor check should be removed. + */ + if (c->x86_vendor != X86_VENDOR_INTEL) + setup_clear_cpu_cap(X86_FEATURE_SHSTK); + if (!cpu_feature_enabled(X86_FEATURE_SHSTK)) return;
Shadow stack is supported on newer AMD processors, but the kernel implementation has not been tested on them. Prevent basic issues from showing up for normal users by disabling shadow stack on all CPUs except Intel until it has been tested. At which point the limitation should be removed. Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> --- v1: - New patch. arch/x86/kernel/cpu/common.c | 8 ++++++++ 1 file changed, 8 insertions(+)