Re: [PATCH v3 16/16] objtool: Validate kCFI calls

From: Xin Li
Date: Fri Jul 25 2025 - 20:34:49 EST


On 7/25/2025 12:56 PM, Sean Christopherson wrote:

BTW, there is a declaration for vmx_do_interrupt_irqoff() in
arch/x86/kvm/vmx/vmx.c, so we'd better also do:

--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6945,7 +6945,9 @@ void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64
*eoi_exit_bitmap)
vmcs_write64(EOI_EXIT_BITMAP3, eoi_exit_bitmap[3]);
}

+#ifndef CONFIG_X86_FRED
void vmx_do_interrupt_irqoff(unsigned long entry);
+#endif
No, we want to keep the declaration. Unconditionally decaring the symbol allows
KVM to use IS_ENABLED():

if (IS_ENABLED(CONFIG_X86_FRED))
fred_entry_from_kvm(EVENT_TYPE_EXTINT, vector);

Hiding the declaration would require that to be a "proper" #ifdef, which would
be a net negative for readability. The extra declaration won't hurt anything for
CONFIG_X86_FRED=n, as "bad" usage will still fail at link time.

I did hit a compilation error, so yes, we have to keep it.