From: Dominique Martinet <asmadeus@codewreck.org>
To: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>,
Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: 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: Sun, 13 Sep 2026 18:45:13 +0900 [thread overview]
Message-ID: <aqZwqdnm7PW8OUv-@codewreck.org> (raw)
In-Reply-To: <20260607140603.24342-1-zhaoyz24@mails.tsinghua.edu.cn>
Yizhou Zhao wrote on Sun, Jun 07, 2026 at 10:06:01PM +0800:
> handle_rerror() copies the variable-length error string of a zero-copy
> RERROR response from the receive pages into the request's static response
> buffer. The amount copied is bounded by P9_ZC_HDR_SZ, so the data can
> span at most two pages, but the helper is not told how many receive pages
> were actually mapped.
>
> If a malicious or broken virtio 9p device reports an RERROR length that
> exceeds the remaining bytes in the first mapped receive page, the error
> string is treated as crossing into a second page. When only one receive
> page was mapped, handle_rerror() still advances the page pointer and
> dereferences the next entry, reading past the allocated in_pages array.
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?
> Pass the number of mapped receive pages to handle_rerror(). If the error
> string would cross a page boundary but only one page is available, copy the
> bytes that fit in that page and leave the response truncated, matching the
> existing behavior for overlong RERROR messages. Otherwise continue with
> the second-page copy as before.
--
Dominique Martinet | Asmadeus
prev parent reply other threads:[~2026-09-13 9:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 14:06 Yizhou Zhao
2026-09-13 9:45 ` Dominique Martinet [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=aqZwqdnm7PW8OUv-@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®