Skip to content

Commit 4c24703

Browse files
jgross1gregkh
authored andcommitted
x86/xen: remove hypercall page
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 <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Andrew Cooper <[email protected]> Reviewed-by: Jan Beulich <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1a2471a commit 4c24703

File tree

5 files changed

+1
-42
lines changed

5 files changed

+1
-42
lines changed

arch/x86/include/asm/xen/hypercall.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ struct xen_dm_op_buf;
8888
* there aren't more than 5 arguments...)
8989
*/
9090

91-
extern struct { char _entry[32]; } hypercall_page[];
92-
9391
void xen_hypercall_func(void);
9492
DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func);
9593

arch/x86/xen/enlighten.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include "smp.h"
2727
#include "pmu.h"
2828

29-
EXPORT_SYMBOL_GPL(hypercall_page);
30-
3129
DEFINE_STATIC_CALL(xen_hypercall, xen_hypercall_hvm);
3230
EXPORT_STATIC_CALL_TRAMP(xen_hypercall);
3331

arch/x86/xen/enlighten_hvm.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,8 @@ static void __init init_hvm_pv_info(void)
108108
/* PVH set up hypercall page in xen_prepare_pvh(). */
109109
if (xen_pvh_domain())
110110
pv_info.name = "Xen PVH";
111-
else {
112-
u64 pfn;
113-
uint32_t msr;
114-
111+
else
115112
pv_info.name = "Xen HVM";
116-
msr = cpuid_ebx(base + 2);
117-
pfn = __pa(hypercall_page);
118-
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
119-
}
120113

121114
xen_setup_features();
122115

arch/x86/xen/enlighten_pvh.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,10 @@ EXPORT_SYMBOL_GPL(xen_pvh);
2727

2828
void __init xen_pvh_init(struct boot_params *boot_params)
2929
{
30-
u32 msr;
31-
u64 pfn;
32-
3330
xen_pvh = 1;
3431
xen_domain_type = XEN_HVM_DOMAIN;
3532
xen_start_flags = pvh_start_info.flags;
3633

37-
msr = cpuid_ebx(xen_cpuid_base() + 2);
38-
pfn = __pa(hypercall_page);
39-
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
40-
4134
if (xen_initial_domain())
4235
x86_init.oem.arch_setup = xen_add_preferred_consoles;
4336
x86_init.oem.banner = xen_banner;

arch/x86/xen/xen-head.S

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,6 @@
2222
#include <xen/interface/xen-mca.h>
2323
#include <asm/xen/interface.h>
2424

25-
.pushsection .noinstr.text, "ax"
26-
.balign PAGE_SIZE
27-
SYM_CODE_START(hypercall_page)
28-
.rept (PAGE_SIZE / 32)
29-
UNWIND_HINT_FUNC
30-
ANNOTATE_NOENDBR
31-
ANNOTATE_UNRET_SAFE
32-
ret
33-
/*
34-
* Xen will write the hypercall page, and sort out ENDBR.
35-
*/
36-
.skip 31, 0xcc
37-
.endr
38-
39-
#define HYPERCALL(n) \
40-
.equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
41-
.type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32
42-
#include <asm/xen-hypercalls.h>
43-
#undef HYPERCALL
44-
SYM_CODE_END(hypercall_page)
45-
.popsection
46-
4725
#ifdef CONFIG_XEN_PV
4826
__INIT
4927
SYM_CODE_START(startup_xen)
@@ -176,7 +154,6 @@ SYM_FUNC_END(xen_hypercall_intel)
176154
#ifdef CONFIG_XEN_PV
177155
ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen)
178156
#endif
179-
ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
180157
ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,
181158
.ascii "!writable_page_tables|pae_pgdir_above_4gb")
182159
ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES,

0 commit comments

Comments
 (0)