From: asmadeus@codewreck.org
To: Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: Kees Cook <kees@kernel.org>,
Dominique Martinet via B4 Relay
<devnull+asmadeus.codewreck.org@kernel.org>,
Eric Van Hensbergen <ericvh@kernel.org>,
Latchesar Ionkov <lucho@ionkov.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
stable@vger.kernel.org, Yuhao Jiang <danisjiang@gmail.com>,
security@kernel.org, v9fs@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] net/9p: Fix buffer overflow in USB transport layer
Date: Mon, 23 Jun 2025 06:37:10 +0900 [thread overview]
Message-ID: <aFh3hqGbzC-K3ylo@codewreck.org> (raw)
In-Reply-To: <2332540.nosMkMiWtC@silver>
Christian Schoenebeck wrote on Sun, Jun 22, 2025 at 11:20:21PM +0200:
> On Sunday, June 22, 2025 10:39:29 PM CEST asmadeus@codewreck.org wrote:
> [...]
> > (... And this made me realize commit 60ece0833b6c ("net/9p: allocate
> > appropriate reduced message buffers") likely broke everything for
> > 9p/rdma 3 years ago, as rdma is swapping buffers around...
> > I guess it doesn't have (m)any users...)
>
> That patch contains an RDMA exception:
Oh, thanks for pointing that out!
BTW I just tried __counted_by and it's not obvious because it's not
allocated with the fcall (fcall structs themselves are allocated in the
req, and each fcall gets a data buffer)
For everything other than RDMA it shouldn't be too difficult to bubble
the allocation up (fcall+data as a flexible array as a pointer in req),
but then with large "round" msizes we'd get into the next power of two
buckets so I think it's probably better to keep as is.
(.. that and I wouldn't look forward to rework the buffer swapping logic
with RDMA, even if it should be straightforward enough with a couple of
container_of()s...)
Perhaps when/if counted_by learns to apply to pointers:
---
.../include/net/9p/9p.h:558:13: error: ‘counted_by’ attribute is not allowed for a non-array field
558 | u8 *sdata __counted_by(capacity);
| ^~~~~
make[3]: *** [.../scripts/Makefile.build:287: trans_xen.o] Error 1
In file included from client.c:22:
---
Thanks,
--
Dominique Martinet | Asmadeus
prev parent reply other threads:[~2025-06-22 21:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-22 13:39 [PATCH v3] net/9p: Fix buffer overflow in USB transport layer Dominique Martinet
2025-06-22 13:39 ` Dominique Martinet via B4 Relay
2025-06-22 20:02 ` Kees Cook
2025-06-22 20:39 ` asmadeus
2025-06-22 21:20 ` Christian Schoenebeck
2025-06-22 21:37 ` asmadeus [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=aFh3hqGbzC-K3ylo@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=danisjiang@gmail.com \
--cc=devnull+asmadeus.codewreck.org@kernel.org \
--cc=ericvh@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=m.grzeschik@pengutronix.de \
--cc=security@kernel.org \
--cc=stable@vger.kernel.org \
--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.