Skip to content

x86: Restrict KVM-induced symbol exports to KVM

Sean Christopherson kvm linux-coco linux-perf-users linux-sgx lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86/bugs: Drop unnecessary export of "x86_spec_ctrl_base"arch/x86/kernel/cpu/bugs.c+0 -10 replies
2/4x86/mtrr: Drop unnecessary export of "mtrr_state"arch/x86/kernel/cpu/mtrr/generic.c+0 -10 replies
3/4x86/mm: Drop unnecessary export of "ptdump_walk_pgd_level_debugfs"arch/x86/mm/dump_pagetables.c+0 -10 replies
4/4x86: Restrict KVM-induced symbol exports to KVM modules where obvious/possiblearch/x86/entry/entry.S arch/x86/entry/entry_64.S arch/x86/entry/entry_64_fred.S +29 more+144 -1040 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKai HuangPeter Zijlstra (Intel)
SeriesA-b
1/4
2/4
3/4
4/4A-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] x86: Restrict KVM-induced symbol exports to KVM

Leverage and extend KVM's macro shenanigans to export symbols for KVM if and only if kvm{,-amd,intel}.ko is being built as a module, and only for the KVM modules that are being built.

Note, this approach isn't 100% precise, as exports that are only strictly necessary for one of KVM's modules will get exported for all KVM modules. But I don't see any value in being super precise as it's not like kvm.ko is any more trustworthy tha kvm-{amd,intel}.ko (and it's easy to circumvent "for module" exports by abusing module names (in out-of-tree code)). And maintaining precise exports would likely be a nightmare (as would writing the macros to get the exports right).

Patches 1-3 drop superfluous exports that I found while digging around for KVM-only exports.

Sean Christopherson (4):
x86/bugs: Drop unnecessary export of "x86_spec_ctrl_base" x86/mtrr: Drop unnecessary export of "mtrr_state" x86/mm: Drop unnecessary export of "ptdump_walk_pgd_level_debugfs"
x86: Restrict KVM-induced symbol exports to KVM modules where
obvious/possible

 arch/x86/entry/entry.S             |  7 ++-
 arch/x86/entry/entry_64.S          |  3 +-
 arch/x86/entry/entry_64_fred.S     |  3 +-
 arch/x86/events/amd/core.c         |  5 ++-
 arch/x86/events/core.c             |  7 +--
 arch/x86/events/intel/lbr.c        |  3 +-
 arch/x86/events/intel/pt.c         |  7 +--
 arch/x86/include/asm/kvm_types.h   |  5 +++
 arch/x86/kernel/apic/apic.c        |  3 +-
 arch/x86/kernel/apic/apic_common.c |  3 +-
 arch/x86/kernel/cpu/amd.c          |  4 +-
 arch/x86/kernel/cpu/bugs.c         | 18 ++++----
 arch/x86/kernel/cpu/bus_lock.c     |  3 +-
 arch/x86/kernel/cpu/common.c       |  7 +--
 arch/x86/kernel/cpu/mtrr/generic.c |  1 -
 arch/x86/kernel/cpu/sgx/main.c     |  3 +-
 arch/x86/kernel/cpu/sgx/virt.c     |  5 ++-
 arch/x86/kernel/e820.c             |  3 +-
 arch/x86/kernel/fpu/core.c         | 21 ++++-----
 arch/x86/kernel/fpu/xstate.c       |  7 +--
 arch/x86/kernel/hw_breakpoint.c    |  3 +-
 arch/x86/kernel/irq.c              |  3 +-
 arch/x86/kernel/kvm.c              |  5 ++-
 arch/x86/kernel/nmi.c              |  5 +--
 arch/x86/kernel/process_64.c       |  5 +--
 arch/x86/kernel/reboot.c           |  5 ++-
 arch/x86/kernel/tsc.c              |  1 +
 arch/x86/lib/cache-smp.c           |  9 ++--
 arch/x86/lib/msr.c                 |  5 ++-
 arch/x86/mm/dump_pagetables.c      |  1 -
 arch/x86/mm/pat/memtype.c          |  3 +-
 arch/x86/mm/tlb.c                  |  5 ++-
 arch/x86/virt/vmx/tdx/tdx.c        | 69 +++++++++++++++---------------
 include/linux/kvm_types.h          | 14 ++++++
 34 files changed, 144 insertions(+), 107 deletions(-)

base-commit: 19e2126bba55df9de15d9100b922df1dad6d39a4

Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog