[PULL 00/23] 9p queue 2026-06-29

Christian Schoenebeck posted 23 patches 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/cover.1782739719.git.qemu._5Foss@crudebyte.com
Maintainers: Christian Schoenebeck <qemu_oss@crudebyte.com>, Greg Kurz <groug@kaod.org>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
fsdev/file-op-9p.h                    |  11 ++
fsdev/qemu-fsdev-opts.c               |   6 +
fsdev/qemu-fsdev.c                    |   2 +-
hw/9pfs/9p-local.c                    |  14 +-
hw/9pfs/9p-synth.c                    |  51 ++++++-
hw/9pfs/9p.c                          | 113 ++++++++++++++-
hw/9pfs/9p.h                          |   2 +
hw/9pfs/virtio-9p-device.c            |  17 +++
hw/9pfs/xen-9p-backend.c              |  31 ++++
qemu-options.hx                       |  28 ++--
system/vl.c                           |   7 +-
tests/qtest/libqos/virtio-9p-client.c | 124 ++++++++++++++++
tests/qtest/libqos/virtio-9p-client.h |  88 +++++++++++-
tests/qtest/libqos/virtio-9p.c        |   6 +
tests/qtest/libqos/virtio-9p.h        |   6 +
tests/qtest/virtio-9p-test.c          | 262 +++++++++++++++++++++++++++++++++-
16 files changed, 746 insertions(+), 22 deletions(-)
[PULL 00/23] 9p queue 2026-06-29
Posted by Christian Schoenebeck 3 weeks, 5 days ago
The following changes since commit 20553466cc47af6a8c95f665b601fce3c852e503:

  Merge tag 'pbouvier/pr/docs-20260626' of https://gitlab.com/p-b-o/qemu into staging (2026-06-27 23:28:35 -0400)

are available in the Git repository at:

  https://github.com/cschoenebeck/qemu.git tags/pull-9p-20260629

for you to fetch changes up to 75893c058b21d87d1ec66bbd4e8bf84e1fd616d1:

  hw/9pfs/local: harden local_fid_fd() on FID types (2026-06-29 15:10:32 +0200)

----------------------------------------------------------------
9pfs changes:

- Fix DoS via Treaddir (CVE-2026-9238).

- Add xattr FID limit (CVE-2026-8348).

- Fix union V9fsFidOpenState type confusion.

----------------------------------------------------------------
Christian Schoenebeck (23):
      hw/9pfs: add msize_limit transport callback
      9pfs/virtio: implement msize_limit callback
      9pfs/xen: implement msize_limit callback
      hw/9pfs: cap negotiated msize to transport limit
      hw/9pfs: add response_buffer_size transport callback
      9pfs/virtio: implement response_buffer_size callback
      9pfs/xen: implement response_buffer_size callback
      hw/9pfs: cap Treaddir allocation (CVE-2026-9238)
      hw/9pfs: add xattr FID limit to prevent memory exhaustion
      hw/9pfs: add max_xattr option
      qemu-options: document 9pfs max_xattr option
      tests/9p: add Tread / Rread test client functions
      tests/9p: add Tclunk / Rclunk test client functions
      tests/9p: add Txattrcreate / Rxattrcreate test client functions
      hw/9pfs: enable xattr (mockup) support for synth fs driver
      hw/9pfs: add xattr count query interface to fs synth driver
      tests/9p: increase P9_MAX_SIZE for test client
      tests/9p: add virtio_9p_add_synth_driver_args() test client function
      tests/9p: add 3 xattr FID limit test cases (synth fs driver)
      tests/9p: add 3 xattr FID limit test cases (local fs driver)
      hw/9pfs: fix invalid union access by v9fs_co_fsync()
      hw/9pfs: fix invalid union access by v9fs_co_fstat()
      hw/9pfs/local: harden local_fid_fd() on FID types

 fsdev/file-op-9p.h                    |  11 ++
 fsdev/qemu-fsdev-opts.c               |   6 +
 fsdev/qemu-fsdev.c                    |   2 +-
 hw/9pfs/9p-local.c                    |  14 +-
 hw/9pfs/9p-synth.c                    |  51 ++++++-
 hw/9pfs/9p.c                          | 113 ++++++++++++++-
 hw/9pfs/9p.h                          |   2 +
 hw/9pfs/virtio-9p-device.c            |  17 +++
 hw/9pfs/xen-9p-backend.c              |  31 ++++
 qemu-options.hx                       |  28 ++--
 system/vl.c                           |   7 +-
 tests/qtest/libqos/virtio-9p-client.c | 124 ++++++++++++++++
 tests/qtest/libqos/virtio-9p-client.h |  88 +++++++++++-
 tests/qtest/libqos/virtio-9p.c        |   6 +
 tests/qtest/libqos/virtio-9p.h        |   6 +
 tests/qtest/virtio-9p-test.c          | 262 +++++++++++++++++++++++++++++++++-
 16 files changed, 746 insertions(+), 22 deletions(-)
Re: [PULL 00/23] 9p queue 2026-06-29
Posted by Michael Tokarev 3 weeks, 4 days ago
On 29.06.2026 16:28, Christian Schoenebeck wrote:

> 9pfs changes:
> 
> - Fix DoS via Treaddir (CVE-2026-9238).
> 
> - Add xattr FID limit (CVE-2026-8348).
> 
> - Fix union V9fsFidOpenState type confusion.
> 
> ----------------------------------------------------------------
> Christian Schoenebeck (23):
>        hw/9pfs: add msize_limit transport callback
>        9pfs/virtio: implement msize_limit callback
>        9pfs/xen: implement msize_limit callback
>        hw/9pfs: cap negotiated msize to transport limit
>        hw/9pfs: add response_buffer_size transport callback
>        9pfs/virtio: implement response_buffer_size callback
>        9pfs/xen: implement response_buffer_size callback
>        hw/9pfs: cap Treaddir allocation (CVE-2026-9238)
>        hw/9pfs: add xattr FID limit to prevent memory exhaustion
>        hw/9pfs: add max_xattr option
>        qemu-options: document 9pfs max_xattr option
>        tests/9p: add Tread / Rread test client functions
>        tests/9p: add Tclunk / Rclunk test client functions
>        tests/9p: add Txattrcreate / Rxattrcreate test client functions
>        hw/9pfs: enable xattr (mockup) support for synth fs driver
>        hw/9pfs: add xattr count query interface to fs synth driver
>        tests/9p: increase P9_MAX_SIZE for test client
>        tests/9p: add virtio_9p_add_synth_driver_args() test client function
>        tests/9p: add 3 xattr FID limit test cases (synth fs driver)
>        tests/9p: add 3 xattr FID limit test cases (local fs driver)
>        hw/9pfs: fix invalid union access by v9fs_co_fsync()
>        hw/9pfs: fix invalid union access by v9fs_co_fstat()
>        hw/9pfs/local: harden local_fid_fd() on FID types

Thank you for this work!

FWIW, I've applied this to 11.0.x and 10.0.x.  For the latter, I also
picked up the following two commits which are simple refactoring:

commit c84ebaa6b2cf9a27fc051b4692a42350adf6358e
Author: Greg Kurz <groug@kaod.org>
Date:   Wed Mar 12 16:29:28 2025 +0100

     9pfs: Don't use file descriptors in core code


commit 29070a13e7c131448ff35c90c70ff42e2989d420
Author: Greg Kurz <groug@kaod.org>
Date:   Wed Mar 12 16:29:27 2025 +0100

     9pfs: local : Introduce local_fid_fd() helper


What do you think, for older 7.2.x series, which was an LTS but now
security-only support, which of the above should be picked up?
I mean, which are the most important ones here?

Thanks,

/mjt
Re: [PULL 00/23] 9p queue 2026-06-29
Posted by Christian Schoenebeck 3 weeks, 3 days ago
On Wednesday, 1 July 2026 12:15:23 CEST Michael Tokarev wrote:
[...]
> Thank you for this work!

Hi Michael,

> FWIW, I've applied this to 11.0.x and 10.0.x.  For the latter, I also
> picked up the following two commits which are simple refactoring:
> 
> commit c84ebaa6b2cf9a27fc051b4692a42350adf6358e
> Author: Greg Kurz <groug@kaod.org>
> Date:   Wed Mar 12 16:29:28 2025 +0100
> 
>      9pfs: Don't use file descriptors in core code

That's actually f2bb367d2b265c6c0ead1e0d4a8f7c43310b3107

> commit 29070a13e7c131448ff35c90c70ff42e2989d420
> Author: Greg Kurz <groug@kaod.org>
> Date:   Wed Mar 12 16:29:27 2025 +0100
> 
>      9pfs: local : Introduce local_fid_fd() helper

And that's 4f82ce8cd94f2601fb2b2e4cfe0cf5b44131817e

Both are safe to be picked and required for the patches in this PR.

> What do you think, for older 7.2.x series, which was an LTS but now
> security-only support, which of the above should be picked up?
> I mean, which are the most important ones here?

Good question. It depends on what the exact policy on the reduced support
level means (for 7.2.x). I mean these are essentially all security related
patches, but with different impact:

- All issues in this PR require full root control over guest. They are not 
  possible exploits by regular guest users (so low to medium severity).

- Patch 8 prevents a potential DoS combined with unlimited host memory 
  allocation / exhaustion.

- Patch 9 also prevents a potential unlimited host memory allocation / 
  exhaustion, however that's a bit tricky to pick alone, as it introduces a 
  hard coded limit on the max. amount of open xattrs to client, a limit which 
  did not exist before at all. The limit is chosen high enough to 
  theoretically not cause issues, but you'll never know what happens in 
  guest's user space, therefore patch 10 introduced a configurable option for 
  this limit, which OTOH is odd to be back-ported to such old stable branches.

- Patches 21 .. 23 merely fix a rather theoretical issue. I have not 
  identified a way for a exploit on this issue. So probably can be omitted.

- Most of the other patches are test cases for guarding these fixed issues. No 
  idea if you usually pick tests up or not. They are useful though to verify 
  whether they fix the issues as intended. Note though that they are 
  registered as "slow" tests, which do not run by default, e.g.:

  cd build
  tests/qtest/qos-test -m slow

Also note that Pierrick reported that some of the tests introduced by this PR
failed at their end. I couldn't reproduce so far, it might be a false
positive, minor issue with the test environment, in worst case I still have to
fix something on the core patches. So keep an eye on that, please:

https://lore.kernel.org/qemu-devel/53159abf-ae84-465a-ac70-8ad71fa6c045@oss.qualcomm.com/

/Christian
Re: [PULL 00/23] 9p queue 2026-06-29
Posted by Pierrick Bouvier 3 weeks, 5 days ago
Hi Christian,

On 6/29/2026 6:28 AM, Christian Schoenebeck wrote:
> The following changes since commit 20553466cc47af6a8c95f665b601fce3c852e503:
> 
>   Merge tag 'pbouvier/pr/docs-20260626' of https://gitlab.com/p-b-o/qemu into staging (2026-06-27 23:28:35 -0400)
> 
> are available in the Git repository at:
> 
>   https://github.com/cschoenebeck/qemu.git tags/pull-9p-20260629
> 
> for you to fetch changes up to 75893c058b21d87d1ec66bbd4e8bf84e1fd616d1:
> 
>   hw/9pfs/local: harden local_fid_fd() on FID types (2026-06-29 15:10:32 +0200)
> 
> ----------------------------------------------------------------
> 9pfs changes:
> 
> - Fix DoS via Treaddir (CVE-2026-9238).
> 
> - Add xattr FID limit (CVE-2026-8348).
> 
> - Fix union V9fsFidOpenState type confusion.
> 
> ----------------------------------------------------------------
> Christian Schoenebeck (23):
>       hw/9pfs: add msize_limit transport callback
>       9pfs/virtio: implement msize_limit callback
>       9pfs/xen: implement msize_limit callback
>       hw/9pfs: cap negotiated msize to transport limit
>       hw/9pfs: add response_buffer_size transport callback
>       9pfs/virtio: implement response_buffer_size callback
>       9pfs/xen: implement response_buffer_size callback
>       hw/9pfs: cap Treaddir allocation (CVE-2026-9238)
>       hw/9pfs: add xattr FID limit to prevent memory exhaustion
>       hw/9pfs: add max_xattr option
>       qemu-options: document 9pfs max_xattr option
>       tests/9p: add Tread / Rread test client functions
>       tests/9p: add Tclunk / Rclunk test client functions
>       tests/9p: add Txattrcreate / Rxattrcreate test client functions
>       hw/9pfs: enable xattr (mockup) support for synth fs driver
>       hw/9pfs: add xattr count query interface to fs synth driver
>       tests/9p: increase P9_MAX_SIZE for test client
>       tests/9p: add virtio_9p_add_synth_driver_args() test client function
>       tests/9p: add 3 xattr FID limit test cases (synth fs driver)
>       tests/9p: add 3 xattr FID limit test cases (local fs driver)
>       hw/9pfs: fix invalid union access by v9fs_co_fsync()
>       hw/9pfs: fix invalid union access by v9fs_co_fstat()
>       hw/9pfs/local: harden local_fid_fd() on FID types
> 
>  fsdev/file-op-9p.h                    |  11 ++
>  fsdev/qemu-fsdev-opts.c               |   6 +
>  fsdev/qemu-fsdev.c                    |   2 +-
>  hw/9pfs/9p-local.c                    |  14 +-
>  hw/9pfs/9p-synth.c                    |  51 ++++++-
>  hw/9pfs/9p.c                          | 113 ++++++++++++++-
>  hw/9pfs/9p.h                          |   2 +
>  hw/9pfs/virtio-9p-device.c            |  17 +++
>  hw/9pfs/xen-9p-backend.c              |  31 ++++
>  qemu-options.hx                       |  28 ++--
>  system/vl.c                           |   7 +-
>  tests/qtest/libqos/virtio-9p-client.c | 124 ++++++++++++++++
>  tests/qtest/libqos/virtio-9p-client.h |  88 +++++++++++-
>  tests/qtest/libqos/virtio-9p.c        |   6 +
>  tests/qtest/libqos/virtio-9p.h        |   6 +
>  tests/qtest/virtio-9p-test.c          | 262 +++++++++++++++++++++++++++++++++-
>  16 files changed, 746 insertions(+), 22 deletions(-)
> 

This series brought a test regression:
$ ./build/pyvenv/bin/meson test -C build \
--setup thorough --print-errorlogs \
qemu:qtest-aarch64/qos-test
...
ERROR:../tests/qtest/libqos/virtio-9p-client.c:280:v9fs_req_recv:
assertion failed (hdr.id == id): (7 == 121)

It seems to come test added in patch 19
"tests/9p: add 3 xattr FID limit test cases (synth fs driver)"
This test runs only with slow setup, so I suspect it never worked and
was never ran.

Could you take a look to fix or revert the concerned change?
You can add me in copy, I'll be happy to review and test it.

Thanks,
Pierrick
Re: [PULL 00/23] 9p queue 2026-06-29
Posted by Christian Schoenebeck 3 weeks, 3 days ago
On Tuesday, 30 June 2026 09:28:48 CEST Pierrick Bouvier wrote:
> Hi Christian,

Hi Pierrick,

> This series brought a test regression:
> $ ./build/pyvenv/bin/meson test -C build \
> --setup thorough --print-errorlogs \
> qemu:qtest-aarch64/qos-test
> ...
> ERROR:../tests/qtest/libqos/virtio-9p-client.c:280:v9fs_req_recv:
> assertion failed (hdr.id == id): (7 == 121)
> 
> It seems to come test added in patch 19
> "tests/9p: add 3 xattr FID limit test cases (synth fs driver)"
> This test runs only with slow setup, so I suspect it never worked and
> was never ran.

Of course I ran these slow tests.

I intentionally registered these tests as "slow" tests as they take a long 
time to complete and QEMU tests being notorious on exceeding the overall CI 
timeout limit. So these tests are exempted from running in the official CI 
pipeline, but not from mine.

I just reran them with latest master head. However I am unable to reproduce 
your reported test error so far.

You cropped the output too aggressively. I need to know:

- Which test exactly failed? (especially whether it's really a synth backend 
  or a local backend test that failed)

- What is the errno being printed *before* the "assertion failed" message?
  ("(hdr.id == id): (7 == 121)" just means 9p server responded with an error 
  response instead of the expected one)

- Were you running the tests in a Docker environment or something or just 
  plain locally?

- Does the underlying host file system support xattrs? (might matter if it's a 
  local backend test that's failing)

/Christian
Re: [PULL 00/23] 9p queue 2026-06-29
Posted by Stefan Hajnoczi 3 weeks, 5 days ago
Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.