x86/traps: Alter switch_stack_and_jump() for FRED mode

FRED and IDT differ by a Supervisor Token on the base of the shadow stack.
This means that switch_stack_and_jump() needs to discard one extra word when
FRED is active.

Fix a typo in the parameter name, which should be shstk_base.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
(cherry picked from commit 40fbf97177)
This commit is contained in:
Andrew Cooper committed 2026-03-17 12:13:50 +00:00
1 parent 92307f30b0
commit b7572954da
1 file changed
+4 -2
+4 -2
View File
@@ -154,7 +154,9 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
"rdsspd %[ssp];" \
"cmp $1, %[ssp];" \
"je .L_shstk_done.%=;" /* CET not active? Skip. */ \
"mov $%c[skstk_base], %[val];" \
ALTERNATIVE("mov $%c[shstk_base], %[val];", \
"mov $%c[shstk_base] + 8, %[val];", \
X86_FEATURE_XEN_FRED) \
"and $%c[stack_mask], %[ssp];" \
"sub %[ssp], %[val];" \
"shr $3, %[val];" \
@@ -188,7 +190,7 @@ unsigned long get_stack_dump_bottom (unsigned long sp);
[ssp] "=&r" (tmp) \
: [stk] "r" (guest_cpu_user_regs()), \
[fun] constr (fn), \
[skstk_base] "i" \
[shstk_base] "i" \
((PRIMARY_SHSTK_SLOT + 1) * PAGE_SIZE - 8), \
[stack_mask] "i" (STACK_SIZE - 1), \
_ASM_BUGFRAME_INFO(BUGFRAME_bug, __LINE__, \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.