Skip to content

Commit 8aeb879

Browse files
author
Peter Zijlstra
committed
x86/kvm/vmx: Fix x86_64 CFI build
It was missed that idt_do_interrupt_irqoff() gets compiled on x84_64; this is a problem for CFI builds because it includes an unadorned indirect call. It is however completely dead code. Rework things to not emit this function at all. Fixes: 0701c9e ("x86/kvm/vmx: Move IRQ/NMI dispatch from KVM into x86 core") Reported-by: Nathan Chancellor <nathan@kernel.org> Reported-by: Calvin Owens <calvin@wbinvd.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20260526090631.GA4149641@noisy.programming.kicks-ass.net
1 parent a17dc12 commit 8aeb879

3 files changed

Lines changed: 5 additions & 11 deletions

File tree

arch/x86/entry/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ noinstr void x86_entry_from_kvm(unsigned int event_type, unsigned int vector)
5555
* The FRED NMI context is significantly different and will not work
5656
* right (specifically FRED fixed the NMI recursion issue).
5757
*/
58-
idt_entry_from_kvm(vector);
58+
idt_do_nmi_irqoff();
5959
}
6060
EXPORT_SYMBOL_FOR_KVM(x86_entry_from_kvm);
6161
#endif

arch/x86/entry/entry.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ EXPORT_SYMBOL(__ref_stack_chk_guard);
109109
RET
110110
.endm
111111

112+
#ifndef CONFIG_X86_64
112113
.pushsection .text, "ax"
113114
SYM_FUNC_START(idt_do_interrupt_irqoff)
114115
IDT_DO_EVENT_IRQOFF CALL_NOSPEC _ASM_ARG1
115116
SYM_FUNC_END(idt_do_interrupt_irqoff)
116117
.popsection
118+
#endif
117119

118120
.pushsection .noinstr.text, "ax"
119121
SYM_FUNC_START(idt_do_nmi_irqoff)

arch/x86/kernel/idt.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,10 @@ void __init idt_setup_early_pf(void)
268268
}
269269
#endif
270270

271-
#if IS_ENABLED(CONFIG_KVM_INTEL)
272-
noinstr void idt_entry_from_kvm(unsigned int vector)
271+
#if IS_ENABLED(CONFIG_KVM_INTEL) && !defined(CONFIG_X86_64)
272+
void idt_entry_from_kvm(unsigned int vector)
273273
{
274-
if (vector == NMI_VECTOR)
275-
return idt_do_nmi_irqoff();
276-
277-
/*
278-
* Only the NMI path requires noinstr.
279-
*/
280-
instrumentation_begin();
281274
idt_do_interrupt_irqoff(gate_offset(idt_table + vector));
282-
instrumentation_end();
283275
}
284276
#endif
285277

0 commit comments

Comments
 (0)