Re: [PATCH] KVM: x86/mmu: Protect noncoherent DMA zaps with SRCU

From: Huang, Kai

Date: Mon Aug 24 2026 - 17:36:36 EST


On Mon, 2026-08-24 at 10:49 -0700, Sean Christopherson wrote:
> Alternatively, what if we have kvm_zap_gfn_range() acquire SRCU?  Nesting "locks"
> is a-ok, and two of the three users of kvm_zap_gfn_range() have had this bug (see
> commit 074c00800719 ("KVM: x86: Use SRCU to protect zap in
> __kvm_set_or_clear_apicv_inhibit()").

kvm_vcpu_srcu_read_lock() doesn't allow nesting lock of KVM's SRCU. Doesn't
seem to be a problem for this particular case, though, because
sev_handle_rmp_fault() calls kvm_zap_gfn_range() after kvm_vcpu_srcu_read_lock()
is called.