mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: "zoudongjie (A)" <zoudongjie@huawei.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	 "mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>,
	 "dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	 "hpa@zytor.com" <hpa@zytor.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Chenzhendong (alex)" <alex.chen@huawei.com>,
	 luolongmin <luolongmin@huawei.com>,
	"Mujinsheng (DxJanesir)" <mujinsheng@huawei.com>,
	 "chenjianfei (D)" <chenjianfei3@huawei.com>,
	"Fangyi (Eric)" <eric.fangyi@huawei.com>,
	 "lishan (E)" <lishan24@huawei.com>,
	Renxuming <renxuming@huawei.com>,
	 suxiaodong <suxiaodong1@huawei.com>,
	"caijunjie (A)" <caijunjie15@h-partners.com>
Subject: Re: [Question Consultation] KVM: x86: No lock protection was applied in handle_ept_misconfig of kernel 5.10?
Date: Wed, 9 Jul 2025 05:42:17 -0700	[thread overview]
Message-ID: <aG5jqVJ0S2nDFMch@google.com> (raw)
In-Reply-To: <fb4c14aa629a4dddb44d0fa9c4f7b498@huawei.com>

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>

      reply	other threads:[~2025-07-09 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  6:32 zoudongjie (A)
2025-07-09 12:42 ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aG5jqVJ0S2nDFMch@google.com \
    --to=seanjc@google.com \
    --cc=alex.chen@huawei.com \
    --cc=bp@alien8.de \
    --cc=caijunjie15@h-partners.com \
    --cc=chenjianfei3@huawei.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=eric.fangyi@huawei.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lishan24@huawei.com \
    --cc=luolongmin@huawei.com \
    --cc=mingo@redhat.com \
    --cc=mujinsheng@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=renxuming@huawei.com \
    --cc=suxiaodong1@huawei.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zoudongjie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®