Skip to content

Commit bcf0e2f

Browse files
jgross1gregkh
authored andcommitted
x86/xen: remove hypercall page
commit 7fa0da5 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 bcca7e0 commit bcf0e2f

File tree

6 files changed

+1
-47
lines changed

6 files changed

+1
-47
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/kernel/callthunks.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ static bool skip_addr(void *dest)
145145
if (dest >= (void *)relocate_kernel &&
146146
dest < (void*)relocate_kernel + KEXEC_CONTROL_CODE_MAX_SIZE)
147147
return true;
148-
#endif
149-
#ifdef CONFIG_XEN
150-
if (dest >= (void *)hypercall_page &&
151-
dest < (void*)hypercall_page + PAGE_SIZE)
152-
return true;
153148
#endif
154149
return false;
155150
}

arch/x86/xen/enlighten.c

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

30-
EXPORT_SYMBOL_GPL(hypercall_page);
31-
3230
DEFINE_STATIC_CALL(xen_hypercall, xen_hypercall_hvm);
3331
EXPORT_STATIC_CALL_TRAMP(xen_hypercall);
3432

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
@@ -28,17 +28,10 @@ EXPORT_SYMBOL_GPL(xen_pvh);
2828

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

38-
msr = cpuid_ebx(xen_cpuid_base() + 2);
39-
pfn = __pa(hypercall_page);
40-
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
41-
4235
if (xen_initial_domain())
4336
x86_init.oem.arch_setup = xen_add_preferred_consoles;
4437
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)
@@ -198,7 +176,6 @@ SYM_FUNC_END(xen_hypercall_intel)
198176
#else
199177
# define FEATURES_DOM0 0
200178
#endif
201-
ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
202179
ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES,
203180
.long FEATURES_PV | FEATURES_PVH | FEATURES_DOM0)
204181
ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")

0 commit comments

Comments
 (0)