lkml.org 
[lkml]   [2023]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v11 30/37] x86/fred: Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED is enabled
    Date
    From: "H. Peter Anvin (Intel)" <hpa@zytor.com>

    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>
    Tested-by: Shan Kang <shan.kang@intel.com>
    Signed-off-by: Xin Li <xin3.li@intel.com>
    ---
    arch/x86/entry/entry_64.S | 6 ++++++
    arch/x86/entry/entry_64_fred.S | 1 +
    2 files changed, 7 insertions(+)

    diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
    index 179e08d34eb6..f7db3a12ccb1 100644
    --- a/arch/x86/entry/entry_64.S
    +++ b/arch/x86/entry/entry_64.S
    @@ -309,7 +309,13 @@ SYM_CODE_START(ret_from_fork_asm)
    * and unwind should work normally.
    */
    UNWIND_HINT_REGS
    +
    +#ifdef CONFIG_X86_FRED
    + ALTERNATIVE "jmp swapgs_restore_regs_and_return_to_usermode", \
    + "jmp asm_fred_exit_user", X86_FEATURE_FRED
    +#else
    jmp swapgs_restore_regs_and_return_to_usermode
    +#endif
    SYM_CODE_END(ret_from_fork_asm)
    .popsection

    diff --git a/arch/x86/entry/entry_64_fred.S b/arch/x86/entry/entry_64_fred.S
    index 37a1dd5e8ace..5781c3411b44 100644
    --- a/arch/x86/entry/entry_64_fred.S
    +++ b/arch/x86/entry/entry_64_fred.S
    @@ -32,6 +32,7 @@
    SYM_CODE_START_NOALIGN(asm_fred_entrypoint_user)
    FRED_ENTER
    call fred_entry_from_user
    +SYM_INNER_LABEL(asm_fred_exit_user, SYM_L_GLOBAL)
    FRED_EXIT
    ERETU
    SYM_CODE_END(asm_fred_entrypoint_user)
    --
    2.34.1
    \
     
     \ /
      Last update: 2023-09-23 12:14    [W:4.915 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site