From: Dominique Martinet <asmadeus@codewreck.org>
To: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>,
v9fs@lists.linux.dev, Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
linux-kernel@vger.kernel.org,
Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>,
Ao Wang <wangao@seu.edu.cn>, Xuewei Feng <fengxw06@126.com>,
Qi Li <qli01@tsinghua.edu.cn>, Ke Xu <xuke@tsinghua.edu.cn>,
stable@vger.kernel.org
Subject: Re: [PATCH] 9p/trans_virtio: bound RERROR copy by mapped pages
Date: Mon, 14 Sep 2026 08:36:49 +0900 [thread overview]
Message-ID: <aqczkXDT-thZshJr@codewreck.org> (raw)
In-Reply-To: <23241140.EfDdHjke4D@weasel>
Christian Schoenebeck wrote on Sun, Sep 13, 2026 at 08:09:05PM +0200:
> > I'm not sure that can actually happen:
> > If there was an "in page" (if there wasn't this is all noop anyway and
> > data was written directly to req->rc.sdata), then req->rc.size amount of
> > data was received into the pages, so if it does happen to span over a
> > page boundary then there are at least two pages and we don't need to
> > double-check here.
> >
> > Christian, do you agree with me this patch is not required?
>
> req->rc.size is coming from virtio device's used-ring len, and that is written
> by 9p server, and this server-written value is not verified anywhere against
> the real sizes of the descriptors that guest provided, neither by the kernel's
> virtio subsystem, nor by 9p client.
Wait, is it?
req->rc.size is written in req_done() and comes from
virtqueue_get_buf(), I assume that was the actual data obtained from the
transport (e.g. akin to read() return value, not what is in the payload)
Or can the server lie about this?
If we can't trust req->rc.size I believe the p9pdu processing will also
read past the end of buffer so there are much bigger "problems"
With that said, I agree with your assessment that qemu is mostly
trusted, and don't want to spend too much effort on this (unless
something like me losing my job happens and I suddently find a lot of
free time :P), so if you (or someone) can confirm rc.size isn't trusted
then let's drop this here.
FWIW I said "mostly trusted" because lately we've had things like black
box hypervisors (I don't remember the exact name) where guest VMs memory
is encrypted and can't be accessed even by the host: sure the server
could still *crash* a guest, but it shouldn't be able to get arbitrary
write/read primitives, so if someone wants to spend effort fixing such
bugs I think it's welcome and I'll be happy to take patches.
(although it should probably start at getting a way to trust the size
e.g. clamp it to whatever pages we fed to the server rather than check here)
This pretty much aligns with what Jürgen said for xen recently here
=====
https://lore.kernel.org/r/931b763d-2ee6-4fbf-9222-c5b75f35ec47@suse.com
> Especially with driver domains malicious backends are a thing. They should
> only be capable to deliver wrong or no data to the frontend, but ideally
> the frontend should not trust the backend.
>
> Any work towards that goal is to be supported IMHO, and there are already
> frontends listed in Xen's support statement following this rule, so any
> violation of that principle in those frontends will be regarded to be a
> security issue worth an XSA.
====
> P.S. Remarkable backlog processing today! :)
Thanks! I _think_ I got to at reply to each mail I wanted to look at
overnight, but I'm sure I missed some, so if you have something in
progress that you want me to look at feel free to ping me again
(and someday we'll be able to get through the virtio backend page
mapping rework started in December[1] (Christoph Hellwig didn't forget and
pinged us in May...) / your msize limit lifting work[2]... someday...
But that should probably get priority over chasing untrusted servers)
(The links are for myself more than anything else, my working memo is in
flight mails)
[1] 20251214-virtio_trans_iter-v2-1-f7f7072e8c15@codewreck.org
[2] https://lore.kernel.org/all/cover.1657920926.git.linux_oss@crudebyte.com/
Cheers,
--
Dominique
next prev parent reply other threads:[~2026-09-13 23:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 14:06 Yizhou Zhao
2026-09-13 9:45 ` Dominique Martinet
2026-09-13 18:09 ` Christian Schoenebeck
2026-09-13 23:36 ` Dominique Martinet [this message]
2026-09-14 4:01 ` Christian Schoenebeck
2026-09-14 9:55 ` Dominique Martinet
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=aqczkXDT-thZshJr@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=fengxw06@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=qli01@tsinghua.edu.cn \
--cc=stable@vger.kernel.org \
--cc=v9fs@lists.linux.dev \
--cc=wangao@seu.edu.cn \
--cc=xuke@tsinghua.edu.cn \
--cc=yangyx22@mails.tsinghua.edu.cn \
--cc=zhaoyz24@mails.tsinghua.edu.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®