]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/xen: remove hypercall page
authorJuergen Gross <jgross@suse.com>
Thu, 17 Oct 2024 13:27:31 +0000 (15:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:08:58 +0000 (18:08 +0100)
commit 7fa0da5373685e7ed249af3fa317ab1e1ba8b0a6 upstream.

The hypercall page is no longer needed. It can be removed, as from the
Xen perspective it is optional.

But, from Linux's perspective, it removes naked RET instructions that
escape the speculative protections that Call Depth Tracking and/or
Untrain Ret are trying to achieve.

This is part of XSA-466 / CVE-2024-53241.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/xen/hypercall.h
arch/x86/xen/enlighten.c
arch/x86/xen/enlighten_hvm.c
arch/x86/xen/enlighten_pvh.c
arch/x86/xen/xen-head.S

index f165d9bfcc142d94388d84e8e5acb526d965d0ae..9b4eddd5833aec0ebfe3dbbcb46342cb85875e63 100644 (file)
@@ -88,8 +88,6 @@ struct xen_dm_op_buf;
  * there aren't more than 5 arguments...)
  */
 
-extern struct { char _entry[32]; } hypercall_page[];
-
 void xen_hypercall_func(void);
 DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func);
 
index 6006c42876ea3949d18a0320596dbaa5a1468923..31f4a4dd8c62af0455122358c4866b6497fcf178 100644 (file)
@@ -26,8 +26,6 @@
 #include "smp.h"
 #include "pmu.h"
 
-EXPORT_SYMBOL_GPL(hypercall_page);
-
 DEFINE_STATIC_CALL(xen_hypercall, xen_hypercall_hvm);
 EXPORT_STATIC_CALL_TRAMP(xen_hypercall);
 
index 3ed6db6e805c20bf1c43da977416e92e7b5bd517..3a453207f3c7f5fa879869c59cf69b4c257a17ef 100644 (file)
@@ -108,15 +108,8 @@ static void __init init_hvm_pv_info(void)
        /* PVH set up hypercall page in xen_prepare_pvh(). */
        if (xen_pvh_domain())
                pv_info.name = "Xen PVH";
-       else {
-               u64 pfn;
-               uint32_t msr;
-
+       else
                pv_info.name = "Xen HVM";
-               msr = cpuid_ebx(base + 2);
-               pfn = __pa(hypercall_page);
-               wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
-       }
 
        xen_setup_features();
 
index ada3868c02c231d0f10863cabf71a076f003acb5..00ee9399fd0c325ab29a52583e57e3cc7a9aa20d 100644 (file)
@@ -27,17 +27,10 @@ EXPORT_SYMBOL_GPL(xen_pvh);
 
 void __init xen_pvh_init(struct boot_params *boot_params)
 {
-       u32 msr;
-       u64 pfn;
-
        xen_pvh = 1;
        xen_domain_type = XEN_HVM_DOMAIN;
        xen_start_flags = pvh_start_info.flags;
 
-       msr = cpuid_ebx(xen_cpuid_base() + 2);
-       pfn = __pa(hypercall_page);
-       wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
-
        if (xen_initial_domain())
                x86_init.oem.arch_setup = xen_add_preferred_consoles;
        x86_init.oem.banner = xen_banner;
index 3635065d7560b460f36a16535b504b1cfaa50c00..1cf94caa7600c29d0b875459f485d9fd419b73a1 100644 (file)
 #include <xen/interface/xen-mca.h>
 #include <asm/xen/interface.h>
 
-.pushsection .noinstr.text, "ax"
-       .balign PAGE_SIZE
-SYM_CODE_START(hypercall_page)
-       .rept (PAGE_SIZE / 32)
-               UNWIND_HINT_FUNC
-               ANNOTATE_NOENDBR
-               ANNOTATE_UNRET_SAFE
-               ret
-               /*
-                * Xen will write the hypercall page, and sort out ENDBR.
-                */
-               .skip 31, 0xcc
-       .endr
-
-#define HYPERCALL(n) \
-       .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
-       .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
-#include <asm/xen-hypercalls.h>
-#undef HYPERCALL
-SYM_CODE_END(hypercall_page)
-.popsection
-
 #ifdef CONFIG_XEN_PV
        __INIT
 SYM_CODE_START(startup_xen)
@@ -176,7 +154,6 @@ SYM_FUNC_END(xen_hypercall_intel)
 #ifdef CONFIG_XEN_PV
        ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          _ASM_PTR startup_xen)
 #endif
-       ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
        ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,
                .ascii "!writable_page_tables|pae_pgdir_above_4gb")
        ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES,