From: Fang Xieyan <fangxy@xiaopeng.com>
To: "Michael S . Tsirkin" <mst@redhat.com>,
jasowangio@gmail.com, eperezma@redhat.com
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
Subject: [PATCH v3 0/2] vhost-vdpa: reject mappings over unmapped VA gaps
Date: Tue, 1 Dec 2026 17:17:20 +0800 [thread overview]
Message-ID: <20261201091722.46805-1-fangxy@xiaopeng.com> (raw)
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
next reply other threads:[~2026-12-01 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:17 Fang Xieyan [this message]
2026-12-01 9:17 ` [PATCH v3 1/2] vhost-vdpa: reject zero-size unmap Fang Xieyan
2026-12-01 9:17 ` [PATCH v3 2/2] vhost-vdpa: use vma_lookup() in vhost_vdpa_va_map() Fang Xieyan
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=20261201091722.46805-1-fangxy@xiaopeng.com \
--to=fangxy@xiaopeng.com \
--cc=eperezma@redhat.com \
--cc=fan.jiaming@hotmail.com \
--cc=jasowangio@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xieyongji@bytedance.com \
--cc=xiongweimin@kylinos.cn \
/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®