diff options
| author | Steffen Eiden <seiden@linux.ibm.com> | 2026-09-28 15:07:06 +0200 |
|---|---|---|
| committer | Christian Borntraeger <borntraeger@linux.ibm.com> | 2026-10-02 10:40:01 +0200 |
| commit | 00aa2c8a02b8f5214f41f50b67bf43d9380471a0 (patch) | |
| tree | 13828565e4b9f76555b22d79ffc3e600fd316d70 | |
| parent | 5c3ea6d3e836debc1f7f5518a5ec0c7e058fb04a (diff) | |
KVM: Restrict kvm_get_kvm/kvm_put_kvm export to internal KVM modules
Switch kvm_get_kvm, kvm_get_kvm_safe, and kvm_put_kvm from
EXPORT_SYMBOL_GPL to EXPORT_SYMBOL_FOR_KVM_INTERNAL. These symbols are
now only used within KVM itself. No external module needs them now that
VFIO uses file-based reference counting. Remove the corresponding
exemptions from the x86 KVM Makefile exports check.
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
| -rw-r--r-- | arch/x86/kvm/Makefile | 5 | ||||
| -rw-r--r-- | virt/kvm/kvm_main.c | 6 |
2 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile index e6d395ede9e2..c6bf463f5032 100644 --- a/arch/x86/kvm/Makefile +++ b/arch/x86/kvm/Makefile @@ -61,10 +61,7 @@ exports_grep_trailer := --include='*.[ch]' -nrw $(srctree)/virt/kvm $(srctree)/a -e kvm_page_track_unregister_notifier \ -e kvm_write_track_add_gfn \ -e kvm_write_track_remove_gfn \ - -e kvm_file_to_kvm_fn \ - -e kvm_get_kvm \ - -e kvm_get_kvm_safe \ - -e kvm_put_kvm + -e kvm_file_to_kvm_fn # Force grep to emit a goofy group separator that can in turn be replaced with # the above newline macro (newlines in Make are a nightmare). Note, grep only diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index bab71d398236..891a67cb365a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1314,7 +1314,7 @@ void kvm_get_kvm(struct kvm *kvm) { refcount_inc(&kvm->users_count); } -EXPORT_SYMBOL_GPL(kvm_get_kvm); +EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_get_kvm); /* * Make sure the vm is not during destruction, which is a safe version of @@ -1324,14 +1324,14 @@ bool kvm_get_kvm_safe(struct kvm *kvm) { return refcount_inc_not_zero(&kvm->users_count); } -EXPORT_SYMBOL_GPL(kvm_get_kvm_safe); +EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_get_kvm_safe); void kvm_put_kvm(struct kvm *kvm) { if (refcount_dec_and_test(&kvm->users_count)) kvm_destroy_vm(kvm); } -EXPORT_SYMBOL_GPL(kvm_put_kvm); +EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_put_kvm); /* * Used to put a reference that was taken on behalf of an object associated |
