From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A40BB29B0; Wed, 9 Jul 2025 06:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752043829; cv=none; b=ijMI76LCAWjV/Zg0UO3z24L7jGHG0PTeOxO0yvM5lUB6zPnj6N1QNEWOXg+X+t7qJ9RqggSbN88LUhjMrR2+Gv9azEY6PmXtkck5LG1cHbf0iqghQNMaerWe1vncjjQ3l3J7ktjvCf3HKJYE/KwhO+xukxVfSN5bw6AaBEDcsjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752043829; c=relaxed/simple; bh=4MHCMXqkaf7S/tE0zRVKzQ5WFpevnAtw1v2rwPlBjVA=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=rpguwynZQEO+K2TEZvrqccwa1BBGHKgphDVIaJ2YGrk/96tMvMrm8S1qjedp0/PDZGHENytOLR5VJ9NRPE+0ihT2Njz8E1ho0VmtipI04xnmlsuUOL83DvUjHMz04tTwUwTyEV1vGyHYRY9ydd+hpj8yKcj+Q5YJo+W9oCFHUHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4bcT980wTkztSlX; Wed, 9 Jul 2025 14:49:16 +0800 (CST) Received: from kwepemf200001.china.huawei.com (unknown [7.202.181.227]) by mail.maildlp.com (Postfix) with ESMTPS id AA188140203; Wed, 9 Jul 2025 14:50:22 +0800 (CST) Received: from kwepemf200001.china.huawei.com (7.202.181.227) by kwepemf200001.china.huawei.com (7.202.181.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 9 Jul 2025 14:50:22 +0800 Received: from kwepemf200001.china.huawei.com ([7.202.181.227]) by kwepemf200001.china.huawei.com ([7.202.181.227]) with mapi id 15.02.1544.011; Wed, 9 Jul 2025 14:50:22 +0800 From: "zoudongjie (A)" To: "seanjc@google.com" , "pbonzini@redhat.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "Chenzhendong (alex)" , luolongmin , "Mujinsheng (DxJanesir)" , "chenjianfei (D)" , "Fangyi (Eric)" , "lishan (E)" , Renxuming , suxiaodong , "caijunjie (A)" , "zoudongjie (A)" Subject: [v2] KVM: x86: Question on lock protection in handle_ept_misconfig Thread-Topic: [v2] KVM: x86: Question on lock protection in handle_ept_misconfig Thread-Index: AdvwnWLWK0cIKxYnTaSRFSLUUanbNQ== Date: Wed, 9 Jul 2025 06:50:22 +0000 Message-ID: <32045ab842954dd5867b55ee965ffcc7@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Resending as plain text to fix formatting issues. --- Hi all, I noticed that in handle_ept_misconfig(), kvm_io_bus_write() is called. And= =20 within kvm_io_bus_write(), BUS is obtained through srcu_dereference(). Duri= ng=20 this process, kvm->slots_lock is not acquired, nor is srcu_read_lock() call= ed=20 for protection. If another process is synchronizing BUS at the same time,=20 synchronize_srcu_expedited() cannot safely reclaim space(it cannot protect= =20 srcu_dereference() outside the critical section?), how can we ensure that B= US=20 obtained by kvm_io_bus_write() is the latest? Thanks, Junjie Cai Reported by: Junjie Cai