]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86: Restrict KVM-induced symbol exports to KVM modules where obvious/possible
authorSean Christopherson <seanjc@google.com>
Wed, 12 Nov 2025 17:39:44 +0000 (09:39 -0800)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 12 Nov 2025 23:29:38 +0000 (15:29 -0800)
commit6276c67f2bc4aeaf350a7cf889c33c38b3330ea9
treea10fa274f08e59aa940cd26effa92d595fb483d4
parente6f2d5866c55d9ed4d61c22692848b029ccd4f6c
x86: Restrict KVM-induced symbol exports to KVM modules where obvious/possible

Extend KVM's export macro framework to provide EXPORT_SYMBOL_FOR_KVM(),
and use the helper macro to export symbols for KVM throughout x86 if and
only if KVM will build one or more modules, and only for those modules.

To avoid unnecessary exports when CONFIG_KVM=m but kvm.ko will not be
built (because no vendor modules are selected), let arch code #define
EXPORT_SYMBOL_FOR_KVM to suppress/override the exports.

Note, the set of symbols to restrict to KVM was generated by manual search
and audit; any "misses" are due to human error, not some grand plan.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Kai Huang <kai.huang@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>
Link: https://patch.msgid.link/20251112173944.1380633-5-seanjc%40google.com
32 files changed:
arch/x86/entry/entry.S
arch/x86/entry/entry_64.S
arch/x86/entry/entry_64_fred.S
arch/x86/events/amd/core.c
arch/x86/events/core.c
arch/x86/events/intel/lbr.c
arch/x86/events/intel/pt.c
arch/x86/include/asm/kvm_types.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/apic_common.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/cpu/bus_lock.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/sgx/main.c
arch/x86/kernel/cpu/sgx/virt.c
arch/x86/kernel/e820.c
arch/x86/kernel/fpu/core.c
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/hw_breakpoint.c
arch/x86/kernel/irq.c
arch/x86/kernel/kvm.c
arch/x86/kernel/nmi.c
arch/x86/kernel/process_64.c
arch/x86/kernel/reboot.c
arch/x86/kernel/tsc.c
arch/x86/lib/cache-smp.c
arch/x86/lib/msr.c
arch/x86/mm/pat/memtype.c
arch/x86/mm/tlb.c
arch/x86/virt/vmx/tdx/tdx.c
include/linux/kvm_types.h