* [Question Consultation] KVM: x86: No lock protection was applied in handle_ept_misconfig of kernel 5.10?
@ 2025-07-09 6:32 zoudongjie (A)
2025-07-09 12:42 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: zoudongjie (A) @ 2025-07-09 6:32 UTC (permalink / raw)
To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
linux-kernel
Cc: Chenzhendong (alex), luolongmin, Mujinsheng (DxJanesir),
chenjianfei (D), Fangyi (Eric), lishan (E),
Renxuming, suxiaodong, caijunjie (A), zoudongjie (A)
Hi all,
I noticed that in handle_ept_misconfig(), kvm_io_bus_write() is called. And within kvm_io_bus_write(), BUS is obtained
through srcu_dereference(). During this process, kvm->slots_lock is not acquired, nor is srcu_read_lock() called for
protection. If another process is synchronizing BUS at the same time, synchronize_srcu_expedited() cannot safely reclaim
space(it cannot protect srcu_dereference() outside the critical section?), how can we ensure that BUS obtained by
kvm_io_bus_write() is the latest?
Thanks,
Junjie Cai
Reported by: Junjie Cai <caijunjie15@h-partners.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Question Consultation] KVM: x86: No lock protection was applied in handle_ept_misconfig of kernel 5.10?
2025-07-09 6:32 [Question Consultation] KVM: x86: No lock protection was applied in handle_ept_misconfig of kernel 5.10? zoudongjie (A)
@ 2025-07-09 12:42 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2025-07-09 12:42 UTC (permalink / raw)
To: zoudongjie (A)
Cc: pbonzini, tglx, mingo, bp, dave.hansen, x86, hpa, kvm,
linux-kernel, Chenzhendong (alex),
luolongmin, Mujinsheng (DxJanesir), chenjianfei (D),
Fangyi (Eric), lishan (E), Renxuming, suxiaodong, caijunjie (A)
On Wed, Jul 09, 2025, zoudongjie (A) wrote:
> Hi all,
>
> I noticed that in handle_ept_misconfig(), kvm_io_bus_write() is called. And
> within kvm_io_bus_write(), BUS is obtained through srcu_dereference(). During
> this process, kvm->slots_lock is not acquired, nor is srcu_read_lock() called
> for protection.
srcu_read_lock() is called via kvm_vcpu_srcu_read_lock() in the VM-Exit path of
vcpu_enter_guest(). KVM grabs kvm->srcu early during KVM_RUN (again via
kvm_vcpu_srcu_read_lock(), in kvm_arch_vcpu_ioctl_run()), and holds the lock for
essentially the entire duration of KVM_RUN. SRCU protection is temporarily
dropped only when the vCPU blocks and when the vCPU enters the guest.
> If another process is synchronizing BUS at the same time,
> synchronize_srcu_expedited() cannot safely reclaim space(it cannot protect
> srcu_dereference() outside the critical section?), how can we ensure that BUS
> obtained by kvm_io_bus_write() is the latest?
>
> Thanks,
> Junjie Cai
>
> Reported by: Junjie Cai <caijunjie15@h-partners.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-09 12:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-09 6:32 [Question Consultation] KVM: x86: No lock protection was applied in handle_ept_misconfig of kernel 5.10? zoudongjie (A)
2025-07-09 12:42 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®