From: sashiko-bot@kernel.org
To: "Lianjie Wang" <lian@is.s.u-tokyo.ac.jp>
Cc: v9fs@lists.linux.dev
Subject: Re: [PATCH 5/5] 9p/virtio: keep zero-copy buffers until the device returns them
Date: Tue, 10 Nov 2026 10:53:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-206904@kernel.org> (raw)
In-Reply-To: <20261109105251.2545764-6-lian@is.s.u-tokyo.ac.jp>
> When a fatal signal ends the wait of p9_virtio_zc_request() while the
> device still holds the request, the payload pages are released, and
> p9_client_zc_rpc() returns to its caller once the RFLUSH arrives. Since
> the caller may free the buffers, a misbehaving device can answer the
> request after the RFLUSH and write the reply into freed memory. With the
> payload bounced through swiotlb, the guest itself copies the reply into
> the freed memory when req_done() unmaps the returned buffers:
>
> BUG: KASAN: use-after-free in swiotlb_bounce+0x236/0x270
> Write of size 4080 at addr ffff888004800010 by task swapper/1/0
> Call Trace:
> swiotlb_bounce+0x236/0x270
> req_done+0xb2/0x280
>
> Fix this by releasing the pages in req_done() once the device returns
> the request, when the wait ends without a reply. req_done() can find the
> pages only through the request, so the page arrays, their page counts
> and need_drop are gathered into struct p9_zc_pages allocated for each
> zero-copy request. p9_client_zc_rpc() now waits until the device returns
> the request, since the caller may reuse or free the buffers after
> p9_client_zc_rpc() returns.
>
> This patch is assisted by Claude Opus 5.5.
>
> Fixes: abfa034e4b8e ("fs/9p: Update zero-copy implementation in 9p")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109105251.2545764-1-lian@is.s.u-tokyo.ac.jp?part=5
next prev parent reply other threads:[~2026-11-10 10:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 10:52 [PATCH 0/5] 9p: bound zero-copy error replies and keep flushed requests until the device returns them Lianjie Wang
2026-11-09 10:52 ` [PATCH 1/5] 9p/virtio: clamp the reply size of a zero-copy request Lianjie Wang
2026-11-10 10:53 ` sashiko-bot
2026-11-12 7:53 ` netdev-bot+sashiko
2026-11-09 10:52 ` [PATCH 2/5] 9p: ignore a zero-copy reply that arrives after a fatal signal Lianjie Wang
2026-11-10 10:53 ` sashiko-bot
2026-11-12 7:53 ` netdev-bot+sashiko
2026-11-09 10:52 ` [PATCH 3/5] 9p/virtio: keep a request until the device returns it Lianjie Wang
2026-11-10 10:53 ` sashiko-bot
2026-11-12 7:53 ` netdev-bot+sashiko
2026-11-09 10:52 ` [PATCH 4/5] 9p: take the tag of a flushed request from the request Lianjie Wang
2026-11-10 10:53 ` sashiko-bot
2026-11-09 10:52 ` [PATCH 5/5] 9p/virtio: keep zero-copy buffers until the device returns them Lianjie Wang
2026-11-10 10:53 ` sashiko-bot [this message]
2026-11-12 7:53 ` netdev-bot+sashiko
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=sashiko-outbox-206904@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lian@is.s.u-tokyo.ac.jp \
--cc=sashiko-reviews@lists.linux.dev \
--cc=v9fs@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.