Skip to content

Commit 51ef2a4

Browse files
H. Peter Anvin (Intel)bp3tk0v
authored andcommitted
x86/fred: Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled
Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled, otherwise the existing IDT code is chosen. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Signed-off-by: Xin Li <xin3.li@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Shan Kang <shan.kang@intel.com> Link: https://lore.kernel.org/r/20231205105030.8698-29-xin3.li@intel.com
1 parent 8f4a29b commit 51ef2a4

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

arch/x86/entry/entry_64.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,13 @@ SYM_CODE_START(ret_from_fork_asm)
247247
* and unwind should work normally.
248248
*/
249249
UNWIND_HINT_REGS
250+
251+
#ifdef CONFIG_X86_FRED
252+
ALTERNATIVE "jmp swapgs_restore_regs_and_return_to_usermode", \
253+
"jmp asm_fred_exit_user", X86_FEATURE_FRED
254+
#else
250255
jmp swapgs_restore_regs_and_return_to_usermode
256+
#endif
251257
SYM_CODE_END(ret_from_fork_asm)
252258
.popsection
253259

arch/x86/entry/entry_64_fred.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
SYM_CODE_START_NOALIGN(asm_fred_entrypoint_user)
3333
FRED_ENTER
3434
call fred_entry_from_user
35+
SYM_INNER_LABEL(asm_fred_exit_user, SYM_L_GLOBAL)
3536
FRED_EXIT
3637
ERETU
3738
SYM_CODE_END(asm_fred_entrypoint_user)

0 commit comments

Comments
 (0)