diff options
author | H. Peter Anvin (Intel) <[email protected]> | 2023-12-05 02:50:08 -0800 |
---|---|---|
committer | Borislav Petkov (AMD) <[email protected]> | 2024-01-31 22:01:51 +0100 |
commit | df8838737b3612eea024fce5ffce0b23dafe5058 (patch) | |
tree | c978ba608f696fda9746ff38b2d3845eb7180a2a /arch/x86/kernel/espfix_64.c | |
parent | 09794f68936a017e5632774c3e4450bebbcca2cb (diff) |
x86/fred: No ESPFIX needed when FRED is enabled
Because FRED always restores the full value of %rsp, ESPFIX is
no longer needed when it's enabled.
Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Tested-by: Shan Kang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'arch/x86/kernel/espfix_64.c')
-rw-r--r-- | arch/x86/kernel/espfix_64.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index 16f9814c9be0..6726e0473d0b 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c @@ -106,6 +106,10 @@ void __init init_espfix_bsp(void) pgd_t *pgd; p4d_t *p4d; + /* FRED systems always restore the full value of %rsp */ + if (cpu_feature_enabled(X86_FEATURE_FRED)) + return; + /* Install the espfix pud into the kernel page directory */ pgd = &init_top_pgt[pgd_index(ESPFIX_BASE_ADDR)]; p4d = p4d_alloc(&init_mm, pgd, ESPFIX_BASE_ADDR); @@ -129,6 +133,10 @@ void init_espfix_ap(int cpu) void *stack_page; pteval_t ptemask; + /* FRED systems always restore the full value of %rsp */ + if (cpu_feature_enabled(X86_FEATURE_FRED)) + return; + /* We only have to do this once... */ if (likely(per_cpu(espfix_stack, cpu))) return; /* Already initialized */ |