All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org, Stefano Stabellini <sstabellini@kernel.org>
Cc: qemu-stable@nongnu.org, Greg Kurz <groug@kaod.org>,
	Feifan Qian <bea1e@proton.me>,
	Anthony PERARD <anthony@xenproject.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [PATCH 8/8] hw/9pfs: cap Treaddir allocation (CVE-2026-9238)
Date: Fri, 12 Jun 2026 15:01:24 +0200	[thread overview]
Message-ID: <1958510.tdWV9SEqCh@weasel> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2606111720190.368315@ubuntu-linux-20-04-desktop>

On Friday, 12 June 2026 02:23:08 CEST Stefano Stabellini wrote:
> On Wed, 27 May 2026, Christian Schoenebeck wrote:
> > Constrain max_count in v9fs_readdir() to transport's current, real
> > response buffer size before calling v9fs_do_readdir() to prevent
> > excessive host memory allocation by bad clients.
> > 
> > Client may send a Treaddir request with a large 'count' parameter, and
> > while the negotiated 'msize' provides some limit, it accounts for guest
> > being somewhat faithful on the negotiated 'msize' value throughout the
> > session.
> > 
> > A bad guest client could have negotiated a large 'msize' but provide a
> > small reply buffer for Treaddir request, causing QEMU to allocate host
> > memory proportional to 'msize' before discovering the reply cannot fit.
> > 
> > Possible consequence was a potential DoS by a priviliged guest, causing
> > a disconnection of guest communication due to transport device being
> > marked as "broken", however QEMU process would have continued to run with
> > potentially giant host memory allocation, which might have negative
> > impact on other services running on host.
> > 
> > Fixes: CVE-2026-9238
> > Fixes: 2149675b195f ("9pfs: add new function v9fs_co_readdir_many()")
> > Reported-by: Feifan Qian <bea1e@proton.me>
> > Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > ---
> > 
> >  hw/9pfs/9p.c | 18 ++++++++++++++++--
> >  1 file changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
[...]
> >      /* Enough space for a R_readdir header: size[4] Rreaddir tag[2]
> >      count[4] */
> > 
> > -    if (max_count > s->msize - 11) {
> > -        max_count = s->msize - 11;
> > +    if (max_count > max_resp_sz - 11) {
> 
> max_resp_sz - 11 causes an underflow

Good catch!

I'll prepare a v2 with all your suggestions.

Thanks for your reviews, much appreciated!

/Christian




      reply	other threads:[~2026-06-12 13:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 21:16 [PATCH 0/8] 9pfs: fix DoS via Treaddir (CVE-2026-9238) Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 1/8] hw/9pfs: add msize_limit transport callback Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 2/8] 9pfs/virtio: implement msize_limit callback Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 3/8] 9pfs/xen: " Christian Schoenebeck
2026-06-08  7:43   ` Christian Schoenebeck
2026-06-11  3:11     ` Stefano Stabellini
2026-06-11 23:49   ` Stefano Stabellini
2026-06-12 12:53     ` Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 4/8] hw/9pfs: cap negotiated msize to transport limit Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 5/8] hw/9pfs: add response_buffer_size transport callback Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 6/8] 9pfs/virtio: implement response_buffer_size callback Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 7/8] 9pfs/xen: " Christian Schoenebeck
2026-06-12  0:23   ` Stefano Stabellini
2026-06-12 12:58     ` Christian Schoenebeck
2026-05-27 21:15 ` [PATCH 8/8] hw/9pfs: cap Treaddir allocation (CVE-2026-9238) Christian Schoenebeck
2026-06-12  0:23   ` Stefano Stabellini
2026-06-12 13:01     ` Christian Schoenebeck [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=1958510.tdWV9SEqCh@weasel \
    --to=qemu_oss@crudebyte.com \
    --cc=anthony@xenproject.org \
    --cc=bea1e@proton.me \
    --cc=edgar.iglesias@gmail.com \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=sstabellini@kernel.org \
    /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.