Skip to content

9p: fix guest-triggered Treaddir/ACPI eject UAF

Christian Schoenebeck qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 5 repliesIn review
  2. v22 patches 3 repliesSuperseded
  3. v13 patches 17 repliesSuperseded

Changes in v3 from the cover letter

- Patch 2: set s->transport = NULL in v9fs_device_unrealize_common() and make the idempotent check just guard the v9fs_reset(s) and v9fs_device_unrealize_common(s) calls in xen_9pfs_disconnect() to prevent a NULL pointer dereference.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2hw/9pfs/virtio: drain in-flight PDUs before virtio-9p unrealizehw/9pfs/virtio-9p-device.c+1 -02 replies
2/2hw/9pfs/xen: drain in-flight PDUs before xen-9p disconnecthw/9pfs/9p.c hw/9pfs/xen-9p-backend.c+16 -22 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchStefano Stabellini
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] 9p: fix guest-triggered Treaddir/ACPI eject UAF

A guest can trigger unplugging 9pfs server's virtio-pci device via ACPI eject. As a consequence the device is unrealized, server's internal state is freed while pending coroutines would still have access to them, causing a potential heap-use-after-free.

Overview Patches:

- Patch 1: this is the core fix, that drains all PDUs (i.e. coroutines that handle individual pending requests in parallel) before freeing server state.

- Patch 2: fixes a similar identified issue with the Xen transport, even though not triggered via ACPI, it is also prone to UAF, plus a resource leak.

v3:
- Patch 2: set s->transport = NULL in v9fs_device_unrealize_common() and make the idempotent check just guard the v9fs_reset(s) and v9fs_device_unrealize_common(s) calls in xen_9pfs_disconnect() to prevent a NULL pointer dereference.

v2: [ https://lore.kernel.org/qemu-devel/[email protected]/ ]
- Patch 1: Make Jia the official author of this patch.
- Drop prev. patch 2 ("hw/9pfs/virtio: disable hotpluggable property...")
- Patch 2: defer explict xen_9pfs_disconnect() call from error paths of xen_9pfs_pdu_vmarshal() and xen_9pfs_pdu_vunmarshal().

Christian Schoenebeck (1):
hw/9pfs/xen: drain in-flight PDUs before xen-9p disconnect

Jia Jia (1):
hw/9pfs/virtio: drain in-flight PDUs before virtio-9p unrealize

 hw/9pfs/9p.c               |  1 +
 hw/9pfs/virtio-9p-device.c |  1 +
 hw/9pfs/xen-9p-backend.c   | 17 +++++++++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.3