diff options
| author | Sean Christopherson <seanjc@google.com> | 2026-08-26 09:56:47 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-09-22 07:23:24 -0700 |
| commit | 53c34396c19e45cd45e6b20c47ef9f47f289698b (patch) | |
| tree | bc2eb6a44299259846b6fa227496e1979dd29886 /tools/perf/scripts | |
| parent | 0ee2c883b62deb74d8c43007e8049dc006d3a2fb (diff) | |
KVM: guest_memfd: Elaborate on how release() vs. get_pfn() is safe against UAF
Add more context and information to the comment in kvm_gmem_release() that
explains why there's no synchronization on RCU _or_ kvm->srcu. Point (b)
from commit 67b43038ce14 ("KVM: guest_memfd: Remove RCU-protected attribute
from slot->gmem.file")
b) kvm->srcu ensures that kvm_gmem_unbind() and freeing of a memslot
occur after the memslot is no longer visible to kvm_gmem_get_pfn().
is especially difficult to fully grok, particularly in light of commit
ae431059e75d ("KVM: guest_memfd: Remove bindings on memslot deletion when
gmem is dying"), which addressed a race between unbind() and release().
See the extended on-list discussion[*] for more details about exactly what
KVM guards against, and how.
Opportunistically update the comment in kvm_gmem_unbind() to clarify the
rules for unbinding, i.e. to be more explicit about why it's ok to nullify
the file pointer even though kvm_gmem_get_pfn() doesn't take the invalidate
lock.
No functional change intended.
Link: https://lore.kernel.org/all/CAEvNRgGmyd1yqQXsnz5hWRZpBZUs%3DpiEWbEaqP9%2Bcz9ZqEMQ6g@mail.gmail.com [*]
Cc: Yan Zhao <yan.y.zhao@intel.com>
Cc: Vishal Annapurve <vannapurve@google.com>
Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
Link: https://patch.msgid.link/20260826165647.769231-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions
