x86/fpu: Disable shstk if no CET_USER state
PATCH 1/1 x86/fpu: Disable shstk if no CET_USER state
Some hypervisors (including QEMU 10.1.5) may report CET_SS support in CPUID Fn7 but fail to report that CET_USER state is supported in supervisor xstate. Linux relies on XSAVES/XRSTORS to swap CET state during context switch and assumes it is supported when CET_SS is present.
As a result, if a user process is run with shadow stacks enabled and then is switched away from, the system may crash because the new process may be incorrectly run with shadow stacks enabled.
Detect this broken configuration and disable user shadow stacks unless CET_USER is supported in xstate.
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/fpu/xstate.c +11 -0
@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsigned int legacy_size) goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow +* stack state. If this isn't present, disable user shadow +* stacks. +*/ +pr_err ("x86/fpu: CET_USER not supported in xstate when CET is supported. Disabling shadow stacks.\n" ); +setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK ); + } + fpu_kernel_cfg.independent_features = fpu_kernel_cfg.max_features &XFEATURE_MASK_INDEPENDENT ;
base-commit: d998c62f267213aeb815cf654908608eb7c00db2
Signature · 1 line
2.53.0
Quoted 6 lines · David Kaplan
Some hypervisors (including QEMU 10.1.5) may report
CET_SSsupport in CPUID Fn7 but fail to report thatCET_USERstate is supported in supervisor xstate. Linux relies on XSAVES/XRSTORS to swap CET state during context switch and assumes it is supported whenCET_SSis present.
Quoted 6 lines
As a result, if a user process is run with shadow stacks enabled and then is switched away from, the system may crash because the new process may be incorrectly run with shadow stacks enabled.
Detect this broken configuration and disable user shadow stacks unless
CET_USERis supported in xstate.
It's not actually broken though, is it? Just "odd". AFAICT, neither the SDM nor the APM _requires_ CET_{U,S} to be supported in XSS if shadow stacks are suppported.
Quoted 12 lines
Signed-off-by David Kaplan <[email protected]>--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsigned int legacy_size) goto out_disable; }
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 10 lines
arch/x86/kernel/fpu/xstate.c +9
-0+if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow +* stack state. If this isn't present, disable user shadow +* stacks. +*/ +pr_err ("x86/fpu: CET_USER not supported in xstate when CET is supported. Disabling shadow stacks.\n" ); +setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );
Doesn't this apply to IBT as well? This code is also misplaced, as it needs to live after at least this code:
if (!cpu_feature_enabled(X86_FEATURE_XSAVES)) fpu_kernel_cfg.max_features &= XFEATURE_MASK_USER_SUPPORTED; else fpu_kernel_cfg.max_features &= XFEATURE_MASK_USER_SUPPORTED | XFEATURE_MASK_SUPERVISOR_SUPPORTED;
and should probably play nice with the "out_disable" path too.
All in all, setup_cet() seems like a much better fit, but unfortunately that runs before fpu__init_system() :-(
Quoted 10 lines
arch/x86/kernel/fpu/xstate.c +2
-0+ } + fpu_kernel_cfg.independent_features = fpu_kernel_cfg.max_features &XFEATURE_MASK_INDEPENDENT ;base-commit:
d998c62f267213aeb815cf654908608eb7c00db2Signature · 1 line
2.53.0
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 25 lines
-----Original Message-----
From: Sean Christopherson <[email protected]>
Sent: Friday, April 3, 2026 2:36 PM
To: Kaplan, David <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Borislav Petkov <[email protected]>; Dave Hansen <[email protected]>; [email protected]; H. Peter Anvin <[email protected]>; [email protected]
Subject: Re: [PATCH] x86/fpu: Disable shstk if noCET_USERstateCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 10 lines · David Kaplan
Some hypervisors (including QEMU 10.1.5) may report
CET_SSsupport in CPUID Fn7 but fail to report thatCET_USERstate is supported in supervisor xstate. Linux relies on XSAVES/XRSTORS to swap CET state during context switch and assumes it is supported whenCET_SSis present.As a result, if a user process is run with shadow stacks enabled and then is switched away from, the system may crash because the new process may be incorrectly run with shadow stacks enabled.
Quoted 7 lines
Quoted 2 lines
Detect this broken configuration and disable user shadow stacks unless
CET_USERis supported in xstate.It's not actually broken though, is it? Just "odd". AFAICT, neither the SDM nor the APM _requires_ CET_{U,S} to be supported in XSS if shadow stacks are
suppported.
The APM language at least isn't super clear on whether this is legal, but there are no real CPUs to my knowledge that do not enumerate XSS support for these. But this configuration is definitely broken for Linux, because it will eventually crash with random segfaults (and unfortunately this often takes minutes to manifest since very few processes actually try to run with shadow stacks apparently).
Quoted 23 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int
Quoted 11 lines
Signed-off-by David Kaplan <[email protected]>--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsigned int
legacy_size)arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size)
Quoted 11 lines
arch/x86/kernel/fpu/xstate.c +8
-0goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow +* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate when CET is
Quoted 5 lines
supported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it needs to live after at least this code:
Good point, it likely does. I can't confirm that as I don't have IBT hardware, but assuming that a guest can see CET_IBT=1 this same problem would exist.
Quoted 11 lines
if (!cpu_feature_enabled(X86_FEATURE_XSAVES))
fpu_kernel_cfg.max_features &=XFEATURE_MASK_USER_SUPPORTED;
else
fpu_kernel_cfg.max_features &=XFEATURE_MASK_USER_SUPPORTED|XFEATURE_MASK_SUPERVISOR_SUPPORTED;and should probably play nice with the "
out_disable" path too.
Ok, that makes sense. I'm not sure if the out_disable path ever gets used, but wouldn't that cause other problems if XSAVE is fully disabled? I don't see it clearing any feature bits related to other XSTATE components.
--David Kaplan
Quoted 2 lines
All in all,
setup_cet()seems like a much better fit, but unfortunately that runs beforefpu__init_system():-(
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 33 lines
-----Original Message-----
From: Kaplan, David
Sent: Friday, April 3, 2026 2:53 PM
To: 'Sean Christopherson' <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Borislav Petkov <[email protected]>; Dave Hansen <[email protected]>; [email protected]; H. Peter Anvin <[email protected]>; [email protected]
Subject: RE: [PATCH] x86/fpu: Disable shstk if noCET_USERstateQuoted 21 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int
Quoted 9 lines
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsigned int
legacy_size)Quoted 11 lines
arch/x86/kernel/fpu/xstate.c +8
-0goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow +* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate when CET is
Quoted 10 lines
Quoted 5 lines
supported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it needs to live after at least this code:
Good point, it likely does. I can't confirm that as I don't have IBT hardware, but assuming that a guest can see CET_IBT=1 this same problem would exist.
Actually, I don't think this does apply to IBT as well. Per Documentation/arch/x86/shstk.rst, only kernel IBT is currently supported by Linux. And kernel IBT does not require either CET_USER or CET_KERNEL XSS support from what I see. (CET_KERNEL is only for the shadow stack related MSRs)
--David Kaplan
Quoted 28 lines · David Kaplan
Quoted 28 lines
From: Kaplan, David
Quoted 26 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int
Quoted 9 lines
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsigned int
legacy_size)arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size)
Quoted 11 lines
arch/x86/kernel/fpu/xstate.c +8
-0goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow +* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate when CET issupported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it needs to live after at least this code:
Quoted 8 lines
Quoted 2 lines
Good point, it likely does. I can't confirm that as I don't have IBT hardware, but assuming that a guest can see CET_IBT=1 this same problem would exist.
Actually, I don't think this does apply to IBT as well. Per
Documentation/arch/x86/shstk.rst, only kernel IBT is currently supported by Linux. And kernel IBT does not require eitherCET_USERorCET_KERNELXSS support from what I see. (CET_KERNELis only for the shadow stack related MSRs)
KVM virtualizes IBT and SHSTK, for both user and kernel, and relies on the host kernel to save/restore IA32_U_CET.
Note, I think xsave_cpuid_features[] is also flawed. Per the SDM, {U,S}_CET also exist if IBT is supported:
Bit 20: CET_IBT. Supports CET indirect branch tracking features if 1. Processors that set this bit define bits 5:2 and bits 63:10 of the IA32_U_CET and IA32_S_CET MSRs.
The current code likely works because all "real" CPUs that support IBT also support SHSTK.
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 51 lines
-----Original Message-----
From: Sean Christopherson <[email protected]>
Sent: Monday, April 6, 2026 9:27 AM
To: Kaplan, David <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Borislav Petkov <[email protected]>; Dave Hansen <[email protected]>; [email protected]; H. Peter Anvin <[email protected]>; [email protected]
Subject: Re: [PATCH] x86/fpu: Disable shstk if noCET_USERstateCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 6 lines · David Kaplan
Quoted 6 lines
From: Kaplan, David
Quoted 5 lines
Review
Quoted 5 lines
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/arch/x86/kernel/fpu/xstate.cQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned
Quoted 4 lines
index
76153dfb58c9..188323442b4d100644arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsignedint
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
legacy_size)Quoted 7 lines
arch/x86/kernel/fpu/xstate.c +4
-0goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size)
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c +4
-0+* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate when CET issupported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it needs
to
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
live after at least this code:
Good point, it likely does. I can't confirm that as I don't have IBT hardware, but assuming that a guest can see CET_IBT=1 this same problem would
exist.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Actually, I don't think this does apply to IBT as well. Per
Documentation/arch/x86/shstk.rst, only kernel IBT is currently supported by Linux. And kernel IBT does not require eitherCET_USERorCET_KERNELXSS support from what I see. (CET_KERNELis only for the shadow stack related MSRs)KVM virtualizes IBT and SHSTK, for both user and kernel, and relies on the host kernel to save/restore
IA32_U_CET.
I think you're talking about a nested virt scenario is that right? So KVM in L1 virtualizes IBT/SHSTK for L2 and relies on the L1 kernel to save/restore IA32_UCET? And the concern is that if L1 doesn't support the XSS components then this is broken.
But it looks like kvm_setup_xss_caps() appears to check if host XSS includes all the CET components and will clear X86_FEATURE_SHSTK/IBT if they aren't present. So I think what you'd see is:
L0: CPUID says SHSTK/IBT supported. XSS bits supported.
L1: CPUID says SHSTK/IBT supported. XSS bits not supported
L2: CPUID doesn't say SHSTK/IBT supported.
Or did I misunderstand the scenario you're talking about?
Quoted 11 lines
Note, I think xsave_cpuid_features[] is also flawed. Per the SDM, {U,S}_CET also
exist if IBT is supported:Bit 20:
CET_IBT. Supports CET indirect branch tracking features if 1.
Processors
that set this bit define bits 5:2 and bits 63:10 of theIA32_U_CETandIA32_S_CET
MSRs.
Quoted 3 lines
The current code likely works because all "real" CPUs that support IBT also support
SHSTK.
Yeah that also looks incorrect, but benign (at least for now).
--David Kaplan
Quoted 44 lines · David Kaplan
Quoted 44 lines
From: Sean Christopherson <[email protected]>
Quoted 6 lines · David Kaplan
Quoted 6 lines
From: Kaplan, David
Quoted 5 lines
Review
Quoted 5 lines
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/arch/x86/kernel/fpu/xstate.cQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned
Quoted 4 lines
index
76153dfb58c9..188323442b4d100644arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __init fpu__init_system_xstate(unsignedint
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
legacy_size)Quoted 7 lines
arch/x86/kernel/fpu/xstate.c +4
-0goto out_disable; } +if (boot_cpu_has (X86_FEATURE_USER_SHSTK ) && + !(fpu_kernel_cfg.max_features &XFEATURE_MASK_CET_USER )) { +/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size)
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c +4
-0+* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate when CET issupported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init fpu__init_system_xstate(unsigned int legacy_size) · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it needs
to
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
live after at least this code:
Good point, it likely does. I can't confirm that as I don't have IBT hardware, but assuming that a guest can see CET_IBT=1 this same problem would
exist.
Quoted 6 lines
Actually, I don't think this does apply to IBT as well. Per
Documentation/arch/x86/shstk.rst, only kernel IBT is currently supported by Linux. And kernel IBT does not require eitherCET_USERorCET_KERNELXSS support from what I see. (CET_KERNELis only for the shadow stack related MSRs)
Quoted 4 lines
Quoted 2 lines
KVM virtualizes IBT and SHSTK, for both user and kernel, and relies on the host kernel to save/restore
IA32_U_CET.I think you're talking about a nested virt scenario is that right?
FWIW, this isn't limited to running in a VM. Booting on bare metal with e.g. noxsaves=1 would lead to the same problematic scenario.
Quoted 5 lines
So KVM in L1 virtualizes IBT/SHSTK for L2 and relies on the L1 kernel to save/restore
IA32_UCET? And the concern is that if L1 doesn't support the XSS components then this is broken.But it looks like
kvm_setup_xss_caps()appears to check if host XSS includes
Gah, -ENOCOFFEE, I forgot that KVM manually verifies that the kernel will context switch CET.
Quoted 8 lines
all the CET components and will clear X86_FEATURE_SHSTK/IBT if they aren't present. So I think what you'd see is:
L0: CPUID says SHSTK/IBT supported. XSS bits supported.
L1: CPUID says SHSTK/IBT supported. XSS bits not supported
L2: CPUID doesn't say SHSTK/IBT supported.Or did I misunderstand the scenario you're talking about?
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 67 lines
-----Original Message-----
From: Sean Christopherson <[email protected]>
Sent: Monday, April 6, 2026 10:32 AM
To: Kaplan, David <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Borislav Petkov <[email protected]>; Dave Hansen <[email protected]>; [email protected]; H. Peter Anvin <[email protected]>; [email protected]
Subject: Re: [PATCH] x86/fpu: Disable shstk if noCET_USERstateCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 7 lines · David Kaplan
Quoted 7 lines
From: Sean Christopherson <[email protected]>
Quoted 5 lines · David Kaplan
Quoted 5 lines
From: Kaplan, David
Quoted 4 lines
Quoted 4 lines
--- arch/x86/kernel/fpu/xstate.c | 11 +++++++++++ 1 file changed, 11 insertions(+)Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0
b/arch/x86/kernel/fpu/xstate.cQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c void __init
Quoted 4 lines
index
76153dfb58c9..188323442b4d100644arch/x86/kernel/fpu/xstate.c +0
-0@@ -855,6 +855,17 @@ void __initfpu__init_system_xstate(unsigned
Quoted 7 lines
Quoted 7 lines
int
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
legacy_size)Quoted 5 lines
arch/x86/kernel/fpu/xstate.c +2
-0goto out_disable; } + if (boot_cpu_has(X86_FEATURE_USER_SHSTK) && + !(fpu_kernel_cfg.max_features &
XFEATURE_MASK_CET_USER)) {Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
arch/x86/kernel/fpu/xstate.c void __init · line 861
Quoted 2 lines
arch/x86/kernel/fpu/xstate.c +2
-0+/* +* The kernel relies on XSAVES/XRSTORS to context switch shadow
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/x86/kernel/fpu/xstate.c +4
-0+* stack state. If this isn't present, disable user shadow +* stacks. +*/ + pr_err("x86/fpu: CET_USER not supported in xstate whenCET is
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
supported. Disabling shadow stacks.\n");
arch/x86/kernel/fpu/xstate.c void __init · line 866
Quoted 1 line
arch/x86/kernel/fpu/xstate.c +1
-0+setup_clear_cpu_cap (X86_FEATURE_USER_SHSTK );Doesn't this apply to IBT as well? This code is also misplaced, as it
needs
Quoted 4 lines
Quoted 4 lines
to
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
live after at least this code:
Good point, it likely does. I can't confirm that as I don't have IBT
hardware,
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
but assuming that a guest can see CET_IBT=1 this same problem would
exist.
Quoted 3 lines
Actually, I don't think this does apply to IBT as well. Per
Documentation/arch/x86/shstk.rst, only kernel IBT is currentlysupported by
Quoted 1 line
Quoted 1 line
Quoted 1 line
Linux. And kernel IBT does not require either
CET_USERorCET_KERNELXSS
Quoted 1 line
Quoted 1 line
Quoted 1 line
support from what I see. (
CET_KERNELis only for the shadow stackrelated
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
MSRs)
Quoted 9 lines
Quoted 1 line
Quoted 1 line
KVM virtualizes IBT and SHSTK, for both user and kernel, and relies on the
host
Quoted 3 lines
Quoted 1 line
kernel to save/restore
IA32_U_CET.I think you're talking about a nested virt scenario is that right?
FWIW, this isn't limited to running in a VM. Booting on bare metal with e.g. noxsaves=1 would lead to the same problematic scenario.
Btw, this does not appear to be a problem. X86_FEATURE_SHSTK is marked as dependent on X86_FEATURE_XSAVES so booting with noxsaves seems to work fine.
--David Kaplan