🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25116

[PATCH v3 0/2] vhost-vdpa: reject mappings over unmapped VA gaps

#25116
From: Fang Xieyan
Date: Tue, 01 Dec 2026 09:17
62 lines
10797 bytes
vhost_vdpa_va_map() walks a request with find_vma(), which returns the
first VMA whose vm_end is past the address and says nothing about
vm_start.  When uaddr lies in an unmapped gap that VMA is used anyway:
uaddr - vma->vm_start wraps in u64 arithmetic, so the segment is filed
under a file offset that belongs to no VMA.

Two patches, to be applied in this order:

  1/2 vhost-vdpa: reject zero-size unmap
      Weimin Xiong's 2026-07-16 patch, rebased onto v7.4-rc5, his
      authorship and Eugenio's Acked-by kept.

  2/2 vhost-vdpa: use vma_lookup() in vhost_vdpa_va_map()
      The one-line change Jiaming Fan suggested while reviewing v2,
      with Cc stable.

Patch 2 has to come after patch 1 because vma_lookup() makes a request
that reaches a gap fail on the first iteration, and the rollback in
vhost_vdpa_va_map() then runs with size 0, which is the case patch 1
closes.  Measured on v7.4-rc5 with two probe vdpa parents, one with
dma_map() and one with set_map() only, and the four states built from
the files of this series.  For a one page request whose uaddr lies in
a hole below a shared file-backed VMA:

  pristine    mapped, offset=0xfffffffffffff000 reaches the parent
  patch 2     -EINVAL, and the rollback removes every mapping of the
              address space, two of them not named by the request
  patch 1 + 2 -EINVAL, and those mappings survive

Removing the whole table is not new with patch 2: it is already
reachable today with a uaddr above every VMA, and that is the route on
which the set_map-only parent was seen to be reprogrammed with an
empty table (set_map, nmaps 0).  Patch 1 stops both cases.

Changes in v3:
 - vma_lookup() instead of skipping the unmapped gap, following
   Jiaming Fan: skipping leaves a request with a hole in the middle
   partly mapped, and userspace cannot tell that from one mapped in
   full
 - patch 1 added, so that the guard and the lookup change land
   together

Weimin: your authorship and Eugenio's Acked-by are intact on patch 1
and you are cc'd on the series; if you would rather resend it
yourself, say so and I will drop it from mine.

Link: https://lore.kernel.org/all/20261126072414.97199-1-fangxy@xiaopeng.com/
Link: https://lore.kernel.org/all/20260716030238.124368-1-xiongwm2026@163.com/
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>

Fang Xieyan (1):
  vhost-vdpa: use vma_lookup() in vhost_vdpa_va_map()

xiongweimin (1):
  vhost-vdpa: reject zero-size unmap

 drivers/vhost/vdpa.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.50.1
Technical Details
Message-ID: <20261201091722.46805-1-fangxy@xiaopeng.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374887-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374887-linux-kernel-netdev=dewy.ru
From: fangxy@xiaopeng.com (Fang Xieyan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH v3 0/2] vhost-vdpa: reject mappings over unmapped VA gaps
Date: Tue,  1 Dec 2026 17:17:20 +0800
Organization: Usenet Network
Message-ID: <20261201091722.46805-1-fangxy@xiaopeng.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1671681"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bXaOFYu++ZcVEFadnllft8FiLF8= sha256:h6Vhgz2aZafVszvhSJH5MaWwi8MwrEHcFRE68qbLjKs=
	sha1:j+6fKSehv3imB7XLmBaPf93jUHQ= sha256:QWnbheonXjR/+HImSf9GsatgRa4VP2/2+oiHWn9TJsk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id D921C1172F3; Tue,  1 Dec 2026 12:17:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=xiaopeng.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ttccCJnrwxyG;
	Tue,  1 Dec 2026 12:17:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374887-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 524701172DB; Tue,  1 Dec 2026 12:17:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 10429601B90; Tue,  1 Dec 2026 09:17:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796116656;
	b=SSL7FnQ+3dgKU1BOt8ZznNGYUv3V51xw0wEJ63irPJc/xUd6Cf2xBpakRo1s4NhjHEh7
	 hnrQy0w277s09ycsm4QZkp4Nz44vxKn6Q21/xKqIXK2ncvTTdfqi/vzLti7JtboZw5nvP
	 G6MUofX3j6tD8APdZDDgFA408Q//DP72QyERvmgqLxgnx0TMEfMnu0Jnu8F5kHQHnTP1D
	 Zs6/jgig8eFyiZAXpJhQVFnXS/b1/Ww5RKNcICl6vI2nakDvA0M9tlzdZIcEWKTR3fzTS
	 HTETZvWZqacUNu07wmz0majdagUk/NaiWd4EUB7I/UlfVLeBtwTBSRlKiSzdyYM2ziQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796116656;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=VOHg4f1HdWpjl4kqDIEpPLPk5MFZEdqlz0P6SvWbDhs=;
	b=vXiXj7/4zF3fud8GZpS7wd0YvzWFy9ysBcK7DyGH8nVGSq5m/C1Ze5il2ckhjofhwy0+
	 qTTWITbODMdiAubg6Wa6ikZSV+5HjiBRkehO2jGW5GrCxAckxbAbqLWwSVHJgTInzPtTg
	 Hnsmj5xp4QXtqpkQJQPQGgKajoJX/LE+KXoXi+ojT9wY+p37WnZKRUwCHb5yK5UKlVfuk
	 3qWi5tATIYxcmhZPcb9i9JrEZtL9LSFb/qliWR5y+VCn10iruWfBTanPkUFKV8oQtawq1
	 NvHLKFuKTtp2TynunR/W7o+C7AI3IGlt9souv0EtECIogl/QXEc5yPydM4Dmm0TF10Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=GPm+dk7H;
	dmarc=none header.from=xiaopeng.com;
	spf=pass smtp.mailfrom=xiaopeng.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E123C606A681;
	Tue,  1 Dec 2026 09:17:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=GPm+dk7H
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.148
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796116655;
	b=RwVAuc4+qqdPxm614MElQdSrRWdtAw2L/O3OCb6tByC006GCcOap+KUsfpUPTLdhBYmI
	 nBJ+sTDU+Of+LEMy4pkXefsf/szVdsZTE1U8uY7EKCgookGq+l46mKEV7CE60x4zyfjc0
	 bileb0EmYF/w2mi4X164pgCN2u0cm96ATvitiCq9z55JpOs5pdBfR+OxK8ROkFIc8Ly+l
	 fyKxuYiRl+4JWNx1Lhh4o6S/LUqy/Nrti3OnNGxUgYNrt+8exEgOspxyK9ruOEDAcw+MF
	 DVaJRVD21BTIv+UQ937g+7gEXP3lUcg10Lg7/tQ6VHleMcVFNANMMAp4sn0Vwe1Gpeg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796116655;
	h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=VOHg4f1HdWpjl4kqDIEpPLPk5MFZEdqlz0P6SvWbDhs=;
	b=0bTgA+uQMk8Uxnr67DIX3RA3Wr4BqFZ40vZyPCLK7lurEbSBiuHHd+Tl2NXSSWm1VqQ8
	 D5x5W0v37ejKry5LMJ0aG3imZhlRTpETU/E8ib4ripOkqIiEOzcidoO+0YwwEuAjleBGr
	 FHfQGZNZIWXua3JpTjGMqsnRQsq6iP564zQoPlctT36xCMc1+bnkCYGpH3IfqSFgNm9As
	 u66q1FegUtQYbk2kE4gaQWuJg7ZkewA/2ZalqE41ARuV2J3deFVnHYiXInDT2pFZrJla9
	 l/eFAcDN8ZwHyURd1yDo7dL3V4GVdu7Ds6bG/F/bfYkYPh03M+42NXDQmQ/cBIp5sjg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=xiaopeng.com;
	spf=pass smtp.mailfrom=xiaopeng.com;
	dkim=pass header.d=xiaopeng.com header.i=@xiaopeng.com header.a=rsa-sha256 header.s=default header.b=GPm+dk7H;
	arc=none smtp.remote-ip=115.124.28.148
X-Received: from out28-148.mail.aliyun.com (out28-148.mail.aliyun.com [115.124.28.148])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FFD2606A320;
	Tue,  1 Dec 2026 09:17:33 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7FFD2606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xiaopeng.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaopeng.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=xiaopeng.com; s=default;
	t=1796116644; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;
	bh=VOHg4f1HdWpjl4kqDIEpPLPk5MFZEdqlz0P6SvWbDhs=;
	b=GPm+dk7HSH5xdXR0eOlGDUVUqoPclP/IIOwJe2qErjQ+hREzIlVNLnt7oV7VeSLr87ErDcS0v1/+RGgh5yGZb5HxuW91hQWRdqsWUwu52hn8HGuWmPl9ws7XySuBh9dKPT+p3csPTq7aDZa3jG1y2v49NggfZDDhxYOg6qwlReE=
X-Alimail-AntiSpam: AC=CONTINUE;BC=0.05600889|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0261335-0.00126391-0.972603;FP=10657372862706624451|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033032106048;MF=fangxy@xiaopeng.com;NM=1;PH=DS;RN=10;RT=10;SR=0;TI=SMTPD_---.kE3zIk-_1796116642;
X-Received: from localhost.localdomain(mailfrom:fangxy@xiaopeng.com fp:SMTPD_---.kE3zIk-_1796116642 cluster:ay29)
          by smtp.aliyun-inc.com;
          Tue, 01 Dec 2026 17:17:24 +0800
X-Cc: fan.jiaming@hotmail.com,
	xiongweimin@kylinos.cn,
	xieyongji@bytedance.com,
	virtualization@lists.linux.dev,
	kvm@vger.kernel.org,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.50.1
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list