From: sashiko-bot@kernel.org
To: "Lianjie Wang" <lian@is.s.u-tokyo.ac.jp>
Cc: v9fs@lists.linux.dev
Subject: Re: [PATCH 2/5] 9p: ignore a zero-copy reply that arrives after a fatal signal
Date: Tue, 10 Nov 2026 10:53:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-206901@kernel.org> (raw)
In-Reply-To: <20261109105251.2545764-3-lian@is.s.u-tokyo.ac.jp>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] net/9p: uninitialized stack memory read in p9_check_errors()
[1]
--
commit ef137edd1ee785bfc27fe33c6494662e5a3cdca5
Author: Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
9p: ignore a zero-copy reply that arrives after a fatal signal
This commit keeps err as -ERESTARTSYS in p9_client_zc_rpc() when a zero-copy
request is interrupted by a fatal signal, avoiding parsing an incomplete or
unbounded reply in p9_check_errors().
> diff --git a/net/9p/client.c b/net/9p/client.c
> index e63e8c2a853df..66980ad52bca8 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -706,10 +706,11 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
>
> if (c->trans_mod->cancel(c, req))
> p9_client_flush(c, req);
> -
> - /* if we received the response anyway, don't signal error */
> - if (READ_ONCE(req->status) == REQ_STATUS_RCVD)
> - err = 0;
> + /*
> + * err stays -ERESTARTSYS even if the reply has arrived, since
> + * the transport moves the error string of a zero-copy reply
> + * into rc only while it waits.
> + */
> }
> recalc_sigpending:
> if (sigpending) {
[Severity: Medium]
This problem wasn't introduced by this patch, but can p9_check_errors() read
uninitialized stack memory from ecode [1] when logging a legacy 9P2000
RERROR response?
net/9p/client.c:p9_check_errors() {
...
int ecode;
...
if (!p9_is_proto_dotl(c)) {
char *ename = NULL;
err = p9pdu_readf(&req->rc, c->proto_version, "s?d",
&ename, &ecode);
...
if (!err) {
err = p9_errstr2errno(ename, strlen(ename));
p9_debug(P9_DEBUG_9P, "<<< RERROR (%d) %s\n",
-ecode, ename);
}
...
}
Under legacy 9P2000, p9pdu_readf() stops at the '?' modifier in "s?d" and
returns 0 without writing to ecode, so p9_debug() formats uninitialized stack
memory into the debug log when CONFIG_NET_9P_DEBUG is enabled.
[1] https://sashiko.dev/#/bug/linux-cfaf1e1d-d65e-44c0-a62c-a97caf427656
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109105251.2545764-1-lian@is.s.u-tokyo.ac.jp?part=2
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 [this message]
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
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-206901@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.