hw/9pfs: guest-controlled pointer dereference from type confusion on union V9fsFidOpenState (fid_type TOCTOU in v9fs_open)

Summary

I was testing my harness, and this is one of the security bugs that it has found from the test runs. After manually verifying the root cause and tracing the exec flow, I can validate the finding and reliably reproduce the type confusion using the PoCs. With the PoCs, a guest can trigger type confusion on union V9fsFidOpenState in QEMU's 9pfs server on current master (d7a65d1793), and from there drive QEMU into a crash on every run (for both asan build and a plain debug build). The attacker is root inside the guest, driving the virtio-9p device from guest userspace. Every request it sends is individually well-formed. It's the ordering that makes them malicious.

Two well-formed 9P requests on the same fid, published in the same virtqueue notification, leave a fid whose fid_type tag is P9_FID_DIR while the payload of the union holds V9fsXattr bytes the guest controls. A following Treaddir then locks and unlocks a CoMutex that is built out of those bytes, and walks a waiter list whose head is a pointer the guest supplied.

The root cause is that the fid_type check and the fid_type assignment it checks are not atomic. v9fs_open() is a check->yield->set sequence, where hw/9pfs/9p.c:2156 validates that the fid is untyped, :2161 yields into a worker thread, and :2174 types the fid on resume. Across that yield the fid is still untyped, nothing re-validates it, and no lock covers it. v9fs_xattrcreate() (:4238, :4251-4258) runs inside the window with no yield of its own, so it always wins.

This is not the consumer-side union misuse fixed in June 2026 (c3aa2491cd, 32cae47c33, 75893c058b). Those add "check fid_type before touching fs.fd" guards. Here fid_type is truthful about the tag and wrong only about the payload, so a consumer-side type check cannot detect it.

The protocol-level check is not atomic across a coroutine yield.

The following are tested and demonstrated In this report:

  1. Type confusion
  2. Guest control of the aliased bytes (shown in gdb)
  3. A deterministic fatal segfault in a non-sanitizer build
  4. One additional Tflush can result in a full 64-bit guest-controlled value consumed as a Coroutine * and dereferenced at co->ctx on a stock -O2 build. Register rdi at the faulting instruction holds the guest controlled eight bytes.

Converting the dereference into a controlled write requires the guest to point it at memory it controls, which requires a host address leak (which is essentially another vulnerability). I looked for one in this surface but did not find one. I also tested to be sure that a heap spray cannot substitute for it. The info below shows a type confusion that reaches a guest-controlled pointer dereference - it's not a working exploit, but it has the potential.

Environment

Reproduced on current master:

  • QEMU commit: d7a65d1793d691d356a56833620f7d1e6f5d653b
  • QEMU version string: QEMU emulator version 11.1.50 (v11.1.0-2117-gd7a65d1793)
  • target: x86_64-softmmu
  • machine: -M pc, -accel qtest, -display none, -nodefaults equivalent (libqos default)
  • devices: -device virtio-9p-pci,fsdev=fsdev0,mount_tag=qtest, with either -fsdev local,id=fsdev0,path=<scratch dir>,security_model=mapped-xattr or -fsdev synth,id=fsdev0. No non-default device property is set.
  • protocol: 9P2000.L — the version a normal Linux mount -t 9p negotiates
  • trigger interface: 9P messages on the virtio queue only. No host-side actor, no guest image, no network, nothing written to the host filesystem beyond the throwaway export directory the stock 9pfs qtests already create.
  • ASan build: CC=clang CXX=clang++ ../configure --enable-asan --enable-ubsan --disable-werror --target-list=x86_64-softmmu
  • non-sanitizer debug build: ../configure --enable-debug --target-list=x86_64-softmmu,i386-softmmu
  • stock -O2 build (no --enable-debug, no sanitizer): ../configure --target-list=x86_64-softmmu --disable-werror
  • ASan options: detect_leaks=0 (and detect_stack_use_after_return=0 for one row, noted where used)
  • host: Debian 13, clang-19
Version/Commit
First affected release v2.8.0 (tagged 2016-12-20)
Release tags with the window 128 (v2.8.0 … v11.1.2)
Release tags with the readdir_mutex_u sink 103 (v5.2.0 … v11.1.2)
Status on master unfixed at d7a65d1793 / 3377670ee9

Root Cause Analysis

Affected device: hw/9pfs/9p.c, i.e. virtio-9p-pci and any other 9pfs transport. Crash sink: util/qemu-coroutine-lock.c:154.

Bug: the fid_type check and the fid_type assignment are not atomic (v9fs_open in hw/9pfs/9p.c:2156-2174)

The type confusion exists because the check and the state change it guards are not atomic. Everything downstream - the union overlay, the lock-flavour pivot, the guest-chosen pointer - is a consequence of that one property. None of it is reachable if the two happen in one step.

These handlers are coroutines on a single thread, and nothing preempts them. The only point at which another request can interleave is an explicit yield. "Atomic" therefore needs no lock here - it means no yield between the check and the set

But v9fs_open() yields. It tests that the fid is untyped at hw/9pfs/9p.c:2156, yields at :2161, and assigns the type at :2174:

    if (fidp->fid_type != P9_FID_NONE) {          /* :2156  CHECK            */
        err = -EINVAL;
        goto out;
    }

    err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); /* :2161  YIELD           */
    ...
    if (S_ISDIR(stbuf.st_mode)) {
        err = v9fs_co_opendir(pdu, fidp);
        if (err < 0) {
            goto out;
        }
        fidp->fid_type = P9_FID_DIR;               /* :2174  SET             */

v9fs_co_lstat() (hw/9pfs/cofile.c:50) is a v9fs_co_run_in_worker() body, so it hands the work to the thread pool and yields the coroutine. For the whole duration of that round trip the fid is still P9_FID_NONE in memory, and therefore to every other request - even though a request that was already acknowledged it being untyped intends to make it a directory. The check's result is a fact about the past by the time it is acted on.

Three separate things would each close the window, and none of them is present:

  • No re-validation. The check at :2156 is never repeated. When the coroutine resumes, :2174 writes fidp->fid_type = P9_FID_DIR unconditionally, over whatever type the fid acquired in the meantime.
  • No mutual exclusion. The only lock held across the yield is v9fs_path_read_lock() — a read lock, so it does not exclude a second reader, and the racer takes no path lock at all. No lock covers fidp->fid_type or fidp->fs on any path.
  • No reservation. Nothing marks the fid as spoken-for. There is no state between "untyped" and "typed", so an in-flight claim is indistinguishable from no claim.

The assignment at :2174 is also narrow: it writes the fid_type enum and nothing else. v9fs_open() makes exactly one other write into the fid's union V9fsFidOpenState payload — 8 bytes at :2170, itemised in the table below — and never resets the rest of it to match the new tag. So the fid ends up tagged as one type and populated as another. That is the type confusion, and it is purely the width of the non-atomic update: a narrow write completing a stale decision.

Two request coroutines race on the same fid, both dispatched from a single virtqueue notification:

  • Request A - Tlopen(fid=1), handled by v9fs_open(). Not atomic: check :2156, yield :2161, set :2174.
  • Request B - Txattrcreate(fid=1), handled by v9fs_xattrcreate(). Atomic: it makes the symmetric check and then mutates with no yield in between, so once it is entered it runs to completion before A can resume.

Only A has a window. B is the code that runs inside it:

hw/9pfs/9p.c:4238-4258

    if (file_fidp->fid_type != P9_FID_NONE) {      /* :4238  stale CHECK     */
        err = -EINVAL;
        goto out_put_fid;
    }
    ...
    xattr_fidp = file_fidp;
    xattr_fidp->fid_type = P9_FID_XATTR;           /* :4251                  */
    xattr_fidp->fs.xattr.copied_len = 0;
    xattr_fidp->fs.xattr.xattrwalk_fid = false;
    xattr_fidp->fs.xattr.len = size;               /* :4254  guest-chosen    */
    xattr_fidp->fs.xattr.flags = rflags;
    v9fs_string_init(&xattr_fidp->fs.xattr.name);
    v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name);  /* :4257           */
    xattr_fidp->fs.xattr.value = g_malloc0(size);  /* :4258                  */

B's check at :4238 reads P9_FID_NONE, and that answer is correct at the instance it is taken: the fid genuinely has no type yet, because A has not reached :2174.

Neither store is overwritten and lost. Both survive, in different parts of the same object. B writes the tag and the union payload. A, upon resume, rewrites the tag but only the first 8 bytes of the payload. Byte by byte, with fs being the union V9fsFidOpenState whose measured layout is tabulated two subsections below:

write fid_type fs bytes 0–7 bytes 8–15 bytes 16–47 bytes 48–63
initial state, alloc_fid() g_new0 P9_FID_NONE 0 0 0 0
B at :4251–:4258 P9_FID_XATTR xattr.copied_len = 0 xattr.len ← guest xattr.value = heap ptr; .name, .flags ← guest (not written)
A at :2170 (not written) dir.stream = real DIR * (not written) (not written) (not written)
A at :2174 P9_FID_DIR (not written) (not written) (not written) (not written)
net result, read as V9fsDir P9_FID_DIR dir.stream, valid dir.proto_version ← guest dir.readdir_mutex_u ← guest rest of dir.readdir_mutex_u, zero

A's only write to fs is the one at :2170: v9fs_co_opendir() passes &fidp->fs to s->ops->opendir() (hw/9pfs/codir.c:328), and the backend stores a DIR * into fs.dir.stream (local_opendir(), hw/9pfs/9p-local.c:539) - union bytes 0–7, on top of xattr.copied_len. Nothing else in v9fs_open() touches the union, and nothing re-runs v9fs_readdir_init(): it is called exactly once per fid, from alloc_fid() at hw/9pfs/9p.c:374.

So the fid is left in a state neither handler ever wrote: a truthful-looking P9_FID_DIR tag and a working dir.stream, sitting on top of a payload that is still V9fsXattr from byte 8 upwards. That is the type confusion. v9fs_xattrcreate() is not at fault - it acted on a true answer. v9fs_open() acted on an answer that had expired, and its two writes were too narrow to repair what that cost. The pivot and Reaching the sink subsections below turn the two surviving guest-controlled regions into, respectively, a lock-flavour pivot (dir.proto_version, offset 8) and a guest-controlled pointer (dir.readdir_mutex_u, offsets 16–63).

Why no scheduling luck is needed

handle_9p_output() (hw/9pfs/virtio-9p-device.c:46) is a plain non-coroutine handler with a while ((pdu = pdu_alloc(s))) / virtqueue_pop() / pdu_submit() loop. When the Tlopen coroutine yields at hw/9pfs/9p.c:2161, control returns to that loop, which immediately pops and submits the Txattrcreate from the same notification. Publishing both descriptor chains in the avail ring before a single kick makes the interleaving deterministic - the PoC wins the race in every run, with no retry loop.

Rxattrcreate arriving before Rlopen is the observable confirmation that the interleaving happened. PoC asserts on both replies in that order.

The union overlay, as measured

Measured with gdb -batch -ex 'ptype /o ...' on the build under test (traces/struct_overlay_ptype.txt), not inferred:

union V9fsFidOpenState  = { int fd; V9fsDir dir(112); V9fsXattr xattr(48); void *private; }

V9fsDir     : stream@0   proto_version@8   readdir_mutex_u@16 (CoMutex,48)  readdir_mutex_L@64
V9fsXattr   : copied_len@0  len@8  value@16  name@24 (V9fsString,16)  flags@40  xattrwalk_fid@44
V9fsString  : size@0 (uint16_t)  data@8
CoMutex     : locked@0  ctx@8  from_push@16  to_pop@24  handoff@32  sequence@36  holder@40

Resolving readdir_mutex_u at union offset 16 against V9fsXattr:

V9fsDir field union offset aliased V9fsXattr field guest control
proto_version 8 low 32 bits of xattr.len full — Txattrcreate size
readdir_mutex_u.locked 16 low 32 bits of xattr.value non-zero heap pointer
readdir_mutex_u.ctx 24 xattr.name.size 0…65535
readdir_mutex_u.from_push 32 xattr.name.data pointer to a buffer holding the guest's xattr name
readdir_mutex_u.to_pop 40 xattr.flags 0…3

The pivot: proto_version flips the readdir lock flavour

alloc_fid() calls v9fs_readdir_init(s->proto_version, &f->fs.dir) at hw/9pfs/9p.c:374. For a normal Linux 9P2000.L mount that initializes readdir_mutex_L as a real QemuMutex and leaves readdir_mutex_u as the zeroed bytes from g_new0.

v9fs_readdir_lock() / v9fs_readdir_unlock() (hw/9pfs/9p.h:206-222) dispatch on the fid's dir.proto_version:

static inline void coroutine_fn v9fs_readdir_unlock(V9fsDir *dir)
{
    if (dir->proto_version == V9FS_PROTO_2000U) {
        qemu_co_mutex_unlock(&dir->readdir_mutex_u);
    } else {
        qemu_mutex_unlock(&dir->readdir_mutex_L);
    }
}

V9FS_PROTO_2000U == 0x01 (hw/9pfs/9p.h:99). So a Txattrcreate with size = 1 writes 1 into xattr.len, which aliases dir.proto_version, and the lock flavour flips to the never-initialized CoMutex made of xattr bytes.

Meanwhile v9fs_readdir() gates on the session version, not the fid's:

hw/9pfs/9p.c:2776

    if (s->proto_version != V9FS_PROTO_2000L) {

The session is still 9P2000.L, so the Treaddir is admitted. The two fields have diverged - that is what makes the sink reachable.

Reaching the sink

With locked != 0, qemu_co_mutex_lock() takes qemu_co_mutex_lock_slowpath(), which declares a CoWaitRecord w; on the stack, pushes &w onto mutex->from_push, and yields. But this runs inside a thread-pool worker - do_readdir_many() is called from a v9fs_co_run_in_worker() body at hw/9pfs/codir.c:229 - so the worker-completion path resumes the coroutine, which returns believing it holds the lock and leaves a dangling stack record on from_push.

v9fs_readdir_unlock() at hw/9pfs/codir.c:178 then calls qemu_co_mutex_unlock(). Its fast path is if (qatomic_fetch_dec(&mutex->locked) == 1) return; (util/qemu-coroutine-lock.c:289); locked is the low 32 bits of V9fsXattr::value (both at union offset 16), i.e. a fragment of the g_malloc0() pointer rather than a lock count, so the test does not hold and control falls into the pop_waiter() -> move_waiters() list walk at :294-299:

  • move_waiters() reads w->next at util/qemu-coroutine-lock.c:154 (QSLIST_REMOVE_HEAD) and writes w->next at :155 (QSLIST_INSERT_HEAD), for every node on the list.
  • The list head, CoMutex::from_push, aliases V9fsXattr::name.data - a pointer to a buffer whose bytes are the guest-controlled xattr name.

The access violation in the captured runs is the read at :154, because the first node on the list is the dangling stack record, not the guest's. The write at :155 targets the same address one instruction later, so a node that is readable but attacker-controlled takes an 8-byte write instead.

Carrying the walk to the guest's bytes: one extra Tflush

The dangling stack record is in front of the guest's buffer. qemu_co_mutex_lock_slowpath() declares CoWaitRecord w; at util/qemu-coroutine-lock.c:198 and push_waiter() prepends it (:202 -> :142-146, QSLIST_INSERT_HEAD_ATOMIC), so the guest's buffer is seemingly always the second node. The walk dies on the first one only because that one has been overwritten by the time it runs.

A hardware watchpoint on w.next, set immediately after push_waiter(), names the first writer: synth_get_dentry() at hw/9pfs/9p-synth.c:246, reached from the loop's first do_readdir() call at hw/9pfs/codir.c:122 via synth_readdir() (hw/9pfs/9p-synth.c:268) and do_readdir() (hw/9pfs/codir.c:39). The rewinddir()/seekdir()/telldir() calls that run earlier inside the same critical section (hw/9pfs/codir.c:100-108) do not reach that far down the stack - the watchpoint does not fire for them. Capture, with the gdb script and the command that produced it: traces/o0_watchpoint_clobberer.txt.

do_readdir_many() has exactly one guest-reachable exit ahead of that first do_readdir():

hw/9pfs/codir.c:116      if (v9fs_request_cancelled(pdu)) {
                             err = -EINTR;
                             break;
                         }
hw/9pfs/codir.c:122      err = do_readdir(pdu, fidp, &dent);

v9fs_flush() sets cancel_pdu->cancelled = 1 at hw/9pfs/9p.c:3201, ahead of its only yield (qemu_co_queue_wait() at :3205), so a Tflush naming the Treaddir's tag, published in the same single kick - the same batching the race itself uses - breaks the loop before do_readdir() runs. The stack record is then still intact when the list is walked, the walk survives node 0, and it reaches node 1, the guest's xattr-name buffer. move_waiters() reverses from_push into to_pop, so that node is the one pop_waiter() returns first.

Its first 8 bytes are then consumed as CoWaitRecord::co and handed to qemu_co_mutex_wake(), which loads co->ctx before calling aio_co_wake(). On a stock -O2 build (traces/rel_o2_coptr.txt):

Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
qemu_co_mutex_unlock (mutex=mutex@entry=0x55555765da88) at ../util/qemu-coroutine-lock.c:299
299             qemu_co_mutex_wake(mutex, to_wake->co);
si_addr  = 0x414141414169
=> 0x555555f6326c <qemu_co_mutex_unlock+140>:   mov    0x28(%rdi),%rax
rdi      = 0x414141414141
#1 v9fs_readdir_unlock   hw/9pfs/9p.h:218
#2 do_readdir_many       hw/9pfs/codir.c:178
#5 v9fs_readdir          hw/9pfs/9p.c:2784

0x28 is offsetof(Coroutine, ctx). rdi holds the guest's eight bytes verbatim, and a second marker gives rdi = 0x133713371337, si_addr = 0x13371337135f - si_addr tracks the input exactly, which is what distinguishes a guest-controlled pointer from a derived one.

The capture above is the synth case; the local backend - a real exported host directory, what a deployed share uses - gives the same two registers, because the Tflush takes do_readdir_many() out at codir.c:116 before the backend's readdir() is ever called. That run is "case 0" at the top of traces/rel_o2_coptr.txt.

On --enable-debug this last step is masked, and that is a build artifact, not a property of the defect. At -O0, move_waiters() gets its own stack frame one level deeper than qemu_co_mutex_lock_slowpath() had (lock side: do_readdir_many -> qemu_co_mutex_lock -> slowpath; unlock side: do_readdir_many -> qemu_co_mutex_unlock -> pop_waiter -> move_waiters), and its prologue stores a stack canary at the address of w.next - overwriting the record it is about to walk. At -O2 the compiler inlines move_waiters() and pop_waiter() into qemu_co_mutex_unlock(), the colliding frame never exists, and the walk completes. Both builds crash; only the -O2 one crashes on the guest's pointer.

A marker such as 0x4141414141414141 behaves identically, but marker + 0x28 is then non-canonical, so the CPU raises #GP rather than #PF and the kernel reports si_addr = 0. The three shipped coptr cases use canonical markers so the faulting address is legible, otherwise the crash would seem like a NULL dereference.

Steps to Reproduce

  1. Do QEMU ASan build:
cd ~/targets/qemu &&
mkdir -p build-asan &&
cd build-asan &&
CC=clang CXX=clang++ ../configure --enable-asan --enable-ubsan --disable-werror --target-list=x86_64-softmmu
ninja qemu-system-x86_64
  1. Build the PoC. It is an ordinary qos-graph qtest built on the in-tree tests/qtest/libqos/virtio-9p-client.h helpers. build.sh builds it without modifying the QEMU source tree - it runs ninja tests/qtest/qos-test once, lifts the compile and link command lines meson already generated for qos-test out of ninja -t commands, and relinks them with poc.o added:
cd poc
./build.sh ~/targets/qemu/build-asan /tmp/9p_poc     # -> /tmp/9p_poc/qos-poc

poc/README.md also gives the one-line in-tree route. The QEMU build directory must have 9pfs enabled (i.e the same have_virtfs guard that gates the stock virtio-9p-test.c at tests/qtest/meson.build:372-374). If you can run virtio-9p-test, then you will be able to build the PoCs.

  1. Run it. No root, no guest image, no network:
export QTEST_QEMU_BINARY=~/targets/qemu/build-asan/qemu-system-x86_64
cd ~/targets/qemu/build-asan      # the 'local' case creates its scratch dir in $PWD
P=/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio-9p/virtio-9p-tests

ASAN_OPTIONS=detect_leaks=0 /tmp/9p_poc/qos-poc -p $P/local/poc/xattr_dir_union
  1. Observe the crash

    # race won: fid 1 is P9_FID_DIR with V9fsXattr bytes
    =================================================================
    ==74045==ERROR: AddressSanitizer: stack-use-after-return on address 0x7f96c0bf7368 at pc 0x55709d58af86 bp 0x7f96cd5ffa20 sp 0x7f96cd5ffa18
    READ of size 8 at 0x7f96c0bf7368 thread T0
        #0 0x55709d58af85 in move_waiters ~/targets/qemu/build-asan/../util/qemu-coroutine-lock.c:154:9
        #1 0x55709d58af85 in pop_waiter ~/targets/qemu/build-asan/../util/qemu-coroutine-lock.c:164:9
        #2 0x55709d589ef7 in qemu_co_mutex_unlock ~/targets/qemu/build-asan/../util/qemu-coroutine-lock.c:295:33
        #3 0x55709baa4b6c in v9fs_readdir_unlock ~/targets/qemu/build-asan/../hw/9pfs/9p.h:218:9
        #4 0x55709baa4b6c in do_readdir_many ~/targets/qemu/build-asan/../hw/9pfs/codir.c:178:5
        #5 0x55709baa3a56 in v9fs_co_readdir_many ~/targets/qemu/build-asan/../hw/9pfs/codir.c:229:5
        #6 0x55709ba9d42c in v9fs_do_readdir ~/targets/qemu/build-asan/../hw/9pfs/9p.c:2645:13
        #7 0x55709ba89cae in v9fs_readdir ~/targets/qemu/build-asan/../hw/9pfs/9p.c:2784:13
        #8 0x55709d58e4b9 in coroutine_trampoline ~/targets/qemu/build-asan/../util/coroutine-ucontext.c:175:9
        #9 0x7f96d4d7580f  (/lib/x86_64-linux-gnu/libc.so.6+0x5880f) (BuildId: 5e5b51f4c39af9ac589408c1dc432ba390a273cc)
    
    Address 0x7f96c0bf7368 is located in stack of thread T0 at offset 40 in frame
        #0 0x55709d5897ff in qemu_co_mutex_lock_slowpath /home/khsu_paloaltonetworks_com/targets/qemu/build-asan/../util/qemu-coroutine-lock.c:196
    
      This frame has 1 object(s):
        [32, 48) 'w' (line 198) <== Memory access at offset 40 is inside this variable

All eight cells below are deterministic: 20 runs of each row, in that row's own build and ASAN_OPTIONS combination, gave 160/160 race won and 160/160 fatal (traces/determinism.txt). The PoC contains no retry loop — both descriptor chains are published to the avail ring before a single kick, so the interleaving is forced rather than raced. The eight cells are eight observations of six distinct PoC cases, not eight separate defects: rows 1, 3 and 4 are the same case watched under three different instrumentations, and rows 2, 6 and 7 are controls. The Case column gives the -p suffix to pass to the PoC binary.

Two fsdev backends appear below. local (-fsdev local,path=…,security_model=…) exports a real host directory and is what an actual host <-> guest share uses; synth is an in-memory tree that QEMU's own documentation describes as "Synthetic filesystem, only used by QTests" (qemu-options.hx:1970). Both the crash and the guest-pointer dereference are shown on local - rows 1 and 5. The synth rows are controls: they repeat the same results with no host filesystem in the picture at all.

# Case (-p suffix) Backend QEMU build ASAN_OPTIONS Result Trace
1 local/poc/xattr_dir_union local, security_model=mapped-xattr ASan detect_leaks=0 stack-use-after-return in move_waiters asan_local_stack_uar.txt
2 synth/poc/xattr_dir_union_ctrl synth ASan detect_leaks=0 same fault, no host filesystem involved — control: the backend is not load-bearing asan_synth_ctrl.txt
3 local/poc/xattr_dir_union (row 1, detector off) local ASan +detect_stack_use_after_return=0 SEGV + 3 UBSan misaligned-access errors asan_local_segv_nosuar.txt
4 local/poc/xattr_dir_union (row 1, no sanitizer) local --enable-debug, no sanitizer — SIGSEGV (signal 11) debug_local_sigsegv.txt
5 local/poc/xattr_dir_union_coptr local stock -O2 — SIGSEGV on the guest's own 64-bit value: rdi = 0x414141414141, si_addr = 0x414141414169 rel_o2_coptr.txt (case 0)
6 synth/poc/xattr_dir_union_coptr_a (row 5, synth) synth stock -O2 — byte-identical fault — control: the guest-pointer result does not depend on the backend either rel_o2_coptr.txt
7 synth/poc/xattr_dir_union_coptr_b (row 6, second marker) synth stock -O2 — rdi = 0x133713371337, si_addr = 0x13371337135f — control: the faulting address tracks the guest's input, so the pointer is chosen and not derived rel_o2_coptr.txt
8 synth/poc/xattr_dir_union_coptr_nonul (row 6, NUL-free marker) synth stock -O2 — rdi = 0xdeadbeefcafebabe — all eight bytes guest-chosen and all eight in-bounds of the g_malloc(9) chunk; non-canonical, so #GP: si_code = 128, si_addr = 0 rel_o2_coptr.txt

You may refer to the PoCs and their corresponding traces in the attachment.

Observe the guest's controlled value deref in gdb

Terminal 1 - run the attach script

$ /tmp/9pattach.sh build-rel
9pattach: waiting for a stopped build-rel QEMU with virtio-9p-pci ...
9pattach: (start the harness in terminal 1 now, with QTEST_STOP=1)
9pattach: pid 3791186 is the qos probe (no virtio-9p-pci) -- resuming it
9pattach: found 9pfs QEMU pid 3792194 (harness pid 3791174) -- attaching
Attaching to process 3792194
[New LWP 3792326]
[New LWP 3792321]
[New LWP 3792307]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007ff17b65372e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Breakpoint 1 at 0x55cd6c96d263: file ../hw/9pfs/9p.c, line 2156.
Breakpoint 2 at 0x55cd6c96d52f: file ../hw/9pfs/9p.c, line 2174.
Breakpoint 3 at 0x55cd6c96b9bc: file ../hw/9pfs/9p.c, line 4238.
Breakpoint 4 at 0x55cd6c96ba47: file ../hw/9pfs/9p.c, line 4258.
Breakpoint 5 at 0x55cd6c96b536: file ../hw/9pfs/9p.c, line 2784.
Breakpoint 6 at 0x55cd6cebe26c: file ../util/qemu-coroutine-lock.c, line 299.

=== 9pfs fid_type-confusion debug session ===
breakpoints: [A] 2156/2174  [B] 4238/4258  [!] 2784  [X] lock.c:299
commands:    'fid <V9fsFid*>'  'fault'  'resume_harness'  'info breakpoints'

Attached to a QEMU that the harness SIGSTOPped: type 'c' to let it run.
It will stop again at [!] 2784 with the fid already confused, and will
freeze the harness there so you can take your time.  DO NOT park at the
[A]/[B] breakpoints -- the harness's 10 s deadline is live until [!].

(gdb)

Terminal 2 - run Qemu

$ cd ~/targets/qemu/build-rel
$ P=/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio-9p/virtio-9p-tests
QTEST_STOP=1 QTEST_QEMU_BINARY=$PWD/qemu-system-x86_64 /tmp/9p_poc_rel_1008/qos-poc -p $P/local/poc/xattr_dir_union_coptr
TAP version 14
# random seed: R02Sff0a161f7710997898aaf4d8cc31b766
# QTEST_QEMU_STORAGE_DAEMON_BINARY not defined, skipping vhost-user-blk-test
# starting QEMU: exec ~/targets/qemu/build-rel/qemu-system-x86_64 -qtest unix:/tmp/qtest-3791174.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-3791174.qmp,id=char0 -object monitor-qmp,id=qmp0,chardev=char0 -display none -audio none -run-with exit-with-parent=on -machine none  -accel qtest
# Start of x86_64 tests
# Start of pc tests
# Start of i440FX-pcihost tests
# Start of pci-bus-pc tests
# Start of pci-bus tests
# Start of virtio-9p-pci tests
# Start of virtio-9p tests
# Start of virtio-9p-tests tests
# Start of local tests
# Start of poc tests
# starting QEMU: exec ~/targets/qemu/build-rel/qemu-system-x86_64 -qtest unix:/tmp/qtest-3791174.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-3791174.qmp,id=char0 -object monitor-qmp,id=qmp0,chardev=char0 -display none -audio none -run-with exit-with-parent=on -M pc  -fsdev local,id=fsdev0,path='/home/khsu_paloaltonetworks_com/targets/qemu/build-rel/qtest-9p-local-A7T4W3',security_model=mapped-xattr -device virtio-9p-pci,fsdev=fsdev0,addr=04.0,mount_tag=qtest  -accel qtest
# race won: fid 1 is P9_FID_DIR; fake CoWaitRecord::co = 0x0000414141414141, ::next = NULL
# expect a fault at 0x0000414141414169 (marker + offsetof(Coroutine, ctx))

Terminal 1 - Continue and Observe Segfault because of arbitrary pointer deref

...
...
(gdb) c
Continuing.
[New Thread 0x7ff170fff6c0 (LWP 3842325)]

[A] v9fs_open CHECK  :2156  fid=1 fid_type=0 (expect 0 = P9_FID_NONE)

[B] v9fs_xattrcreate CHECK :4238  fid=1 fid_type=0 (sees A's stale NONE)

[B] v9fs_xattrcreate SET   :4258  wrote P9_FID_XATTR + guest payload
fid=1  fid_type=3   (0=NONE 1=FILE 2=DIR 3=XATTR)
raw union: {0x0, 0x1, 0x0, 0x6, 0x55cd784680f0, 0x0, 0x0, 0x0}
as V9fsDir  : stream=(nil) proto_version=1
  CoMutex   : locked=0 ctx=0x6 from_push=0x55cd784680f0 to_pop=(nil) handoff=0 seq=0 holder=(nil)
as V9fsXattr: copied_len=0 len=1 value=(nil) name.size=6 name.data=0x55cd784680f0 flags=0

[A] v9fs_open SET    :2174  about to write P9_FID_DIR over fid_type=3
    ^^ if that is 3 (P9_FID_XATTR), racer B already ran: the race is won
fid=1  fid_type=3   (0=NONE 1=FILE 2=DIR 3=XATTR)
raw union: {0x7ff154000b90, 0x1, 0x55cd78468110, 0x6, 0x55cd784680f0, 0x0, 0x0, 0x0}
as V9fsDir  : stream=0x7ff154000b90 proto_version=1
  CoMutex   : locked=2017886480 ctx=0x6 from_push=0x55cd784680f0 to_pop=(nil) handoff=0 seq=0 holder=(nil)
as V9fsXattr: copied_len=140674473134992 len=1 value=0x55cd78468110 name.size=6 name.data=0x55cd784680f0 flags=0

[!] v9fs_readdir :2784 -- fid is tagged DIR, payload is B's xattr bytes
fid=1  fid_type=2   (0=NONE 1=FILE 2=DIR 3=XATTR)
raw union: {0x7ff154000b90, 0x1, 0x55cd78468110, 0x6, 0x55cd784680f0, 0x0, 0x0, 0x0}
as V9fsDir  : stream=0x7ff154000b90 proto_version=1
  CoMutex   : locked=2017886480 ctx=0x6 from_push=0x55cd784680f0 to_pop=(nil) handoff=0 seq=0 holder=(nil)
as V9fsXattr: copied_len=140674473134992 len=1 value=0x55cd78468110 name.size=6 name.data=0x55cd784680f0 flags=0
    guest bytes about to become CoWaitRecord*: 0x55cd784680f0:	0x0000414141414141	0x0000000000000000
    harness pid 3791174 SIGSTOPped: its 10 s deadline is frozen, so you
    can inspect here for as long as you like.
    ('c' to run into the fault)
(gdb) c
Continuing.
[Thread 0x7ff170fff6c0 (LWP 3842325) exited]
[New Thread 0x7ff170fff6c0 (LWP 3895768)]

Thread 1 "qemu-system-x86" hit Breakpoint 6, qemu_co_mutex_wake (mutex=0x55cd77fc5eb8, co=0x414141414141) at ../util/qemu-coroutine-lock.c:190
190	    mutex->ctx = co->ctx;

[X] qemu_co_mutex_unlock :299 -- STOPPED ON the dereference
    next insn : => 0x55cd6cebe26c <qemu_co_mutex_unlock+140>:	mov    0x28(%rdi),%rax
    rdi       = 0x414141414141   <- the guest's bytes, about to be dereferenced
    rdi+0x28  = 0x414141414169   <- offsetof(Coroutine, ctx), the address that faults
    'stepi' to take the fault, then 'fault' to print si_addr.

(gdb) i r $rdi
rdi            0x414141414141      71748523475265

(gdb) stepi
[Thread 0x7ff170fff6c0 (LWP 3895768) exited]

Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
qemu_co_mutex_wake (mutex=0x55cd77fc5eb8, co=0x414141414141) at ../util/qemu-coroutine-lock.c:190
190	    mutex->ctx = co->ctx;

(gdb) fault

==== FAULT ====
si_addr = 0x414141414169
faulting insn: => 0x55cd6cebe26c <qemu_co_mutex_unlock+140>:	mov    0x28(%rdi),%rax
rax = 0x55cd784680f0
rdi = 0x414141414141   (+0x28 = 0x414141414169)         // "AAAAAA" is the guest's 6 xattr-name. +x28 offset is offsetof(Coroutine, ctx). 
rsi = 0
^ read the insn above to see which of these was dereferenced.
#0  qemu_co_mutex_wake (mutex=0x55cd77fc5eb8, co=0x414141414141) at ../util/qemu-coroutine-lock.c:190
#1  qemu_co_mutex_unlock (mutex=mutex@entry=0x55cd77fc5eb8) at ../util/qemu-coroutine-lock.c:299
#2  0x000055cd6c96e50c in v9fs_readdir_unlock (dir=0x55cd77fc5ea8) at ../hw/9pfs/9p.h:218
#3  do_readdir_many (pdu=0xfffffffc, fidp=0x55cd77fc5e90, entries=0x7ff17817cf58, offset=<optimized out>, maxsize=128, dostat=<optimized out>) at ../hw/9pfs/codir.c:178
#4  v9fs_co_readdir_many (pdu=pdu@entry=0x55cd78c26558, fidp=fidp@entry=0x55cd77fc5e90, entries=entries@entry=0x7ff17817cf58, offset=<optimized out>, maxsize=128, dostat=true)
    at ../hw/9pfs/codir.c:229
#5  0x000055cd6c96b57c in v9fs_do_readdir (pdu=0x55cd78c26558, fidp=0x55cd77fc5e90, offset=<optimized out>, max_count=<optimized out>) at ../hw/9pfs/9p.c:2645

The addresses in the backtrace show the overlap.

  #0  qemu_co_mutex_wake (mutex=0x55cd77fc5eb8, co=0x414141414141)  qemu-coroutine-lock.c:190
  #1  qemu_co_mutex_unlock (mutex@entry=0x55cd77fc5eb8)             qemu-coroutine-lock.c:299
           ^^^^^^^^^^^^^^^^^^^^^^^^
           the CoMutex being unlocked.  Note this address: 0x...eb8.

  #2  v9fs_readdir_unlock (dir=0x55cd77fc5ea8)                      hw/9pfs/9p.h:218
           ^^^^^^^^^^^^^^^^^^^^
           called as v9fs_readdir_unlock(&fidp->fs.dir), so dir == &fidp->fs,
           the base of the fid's union.  0x...ea8.

  #3  do_readdir_many (fidp=0x55cd77fc5e90, maxsize=128, ...)       hw/9pfs/codir.c:178
  #4  v9fs_co_readdir_many (fidp@entry=0x55cd77fc5e90, dostat=true) hw/9pfs/codir.c:229
  #5  v9fs_do_readdir (pdu=0x55cd78c26558, fidp=0x55cd77fc5e90)     hw/9pfs/9p.c:2645
           ^^^^^^^^^^^^^^^^^^^^^
           the V9fsFid itself.  0x...e90.

Three of those are the same object at three depths: mutex 0x55cd77fc5eb8 dir 0x55cd77fc5ea8 mutex - dir = 0x10 fidp 0x55cd77fc5e90 dir - fidp = 0x18 => mutex = fidp + 0x28.

So the CoMutex in frames #0/#1 is not a lock that lives somewhere else. It is 40 bytes into the V9fsFid — inside the fid's 112-byte V9fsFidOpenState union, which spans fidp+0x18 ... fidp+0x88.

A fid has exactly one union for its per-type payload, and fid_type is the only tag saying how to read it. Two writers, no copy:

  V9fsFid @ 0x55cd77fc5e90
    +0x00   fid, fid_type=2 (P9_FID_DIR)   <- written by v9fs_open(), hw/9pfs/9p.c:2174
    +0x18   union V9fsFidOpenState         <- 112 bytes.  ONE storage.  TWO types.
    ...
            read as V9fsDir                  written as V9fsXattr
            (because fid_type == DIR)        (by v9fs_xattrcreate(), hw/9pfs/9p.c:4251-4258,
                                              which ran BEFORE fid_type was set to DIR)
    +0x18     DIR *stream                      uint64_t copied_len
    +0x20     proto_version                    uint64_t len          <- selects the CoMutex
                                                                        branch at 9p.h:218
    +0x28     CoMutex readdir_mutex_u          void *value
                +0x00 locked                     "
                +0x08 ctx                      V9fsString name {
    +0x38       +0x10 from_push.slh_first   ==     char *data;          <- SAME 8 BYTES
                +0x18 to_pop                    }

&fidp->fs.dir.readdir_mutex_u: 0x55cd77fc5e90 + 0x18 + 0x10 = 0x55cd77fc5eb8 (mutex)

&fidp->readdir_mutex_u.from_push.slh_first: 0x55cd77fc5eb8 + 0x10 = 0x55cd77fc5ec8

&fidp->fs.xattr.name.data: 0x55cd77fc5e90 + 0x18 + 0x18 + 0x08 = 0x55cd77fc5ec8

Note the identical addresses. That collision is the type confusion bug. The waiter-list head of the CoMutex and the char * to the guest's xattr name are the same eight bytes of memory. v9fs_xattrcreate() stored a string pointer there; qemu_co_mutex_unlock() reads it as a CoWaitRecord *.

Impact, Exploitability, And Severity

Severity: High

Impact: Reliable Crash (resulted from type confusion that places guest-controlled bytes in CoMutex, causing attacker-controlled pointer dereference)

Exploitability: RCE possible but not proven due to the lack of another vulnerability or mechanisms/primitives.

How far this goes, and where it stops

The dereference is not the end of the chain. qemu_co_mutex_wake() loads co->ctx and calls aio_co_wake(co) → aio_co_enter(ctx, co), and ctx comes from the same attacker-chosen object, so the attacker selects the branch taken at util/async.c:

util/async.c:698
void aio_co_enter(AioContext *ctx, Coroutine *co)
{
    if (ctx != qemu_get_current_aio_context()) {
        aio_co_schedule(ctx, co);
        return;
    }

    if (qemu_in_coroutine()) {
        Coroutine *self = qemu_coroutine_self();
        assert(self != co);
        QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
    } else {
        qemu_aio_coroutine_enter(ctx, co);
    }
}

Only the fall-through branch reaches qemu_aio_coroutine_enter() and hence siglongjmp, so glibc's pointer mangling of the jmp_buf is not on the path the attacker would pick. The aio_co_schedule() branch at :701 never switches stacks. With co and ctx both pointing into attacker-controlled memory it performs, among others, QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines, co, co_scheduled_next) at util/async.c:648-649 — a write of a fully controlled 64-bit value to a chosen address — and then qemu_bh_schedule(ctx->co_schedule_bh) at :650, whose aio_bh_enqueue() does a qatomic_fetch_or(&bh->flags, ...) on a chosen QEMUBH *. Read from the source, not executed.

What stops it is a missing information disclosure, and that is a hard stop. Every one of those steps begins by dereferencing co, so the guest must first know a host address.

There's no read back nearby. It's also confirmed that heap spray cannot substitute for the disclosure, after some testing and debugging.

I can only confirm and verify a guest-controlled pointer dereference (deterministic) on a default-configuration build.

Given a host memory leak/read (i.e another vulnerability), RCE is plausible.

Suggested Fix

AI was used to develop a patch against the PoCs attached. The patch does fix the bug, and there's no regression failure. While I do review the patch manually to make sure the changes're reasonable, it's strongly advised that you treat it as reference when you develop an official fix. I am no expert in this system; the last thing I want to do is introducing another security regression failure or unforeseeable bugs...

The invariant

A fid's fid_type and the live member of union V9fsFidOpenState must never disagree, including across a yield. The check at hw/9pfs/9p.c:2156 establishes a precondition; the yield at :2161 discards it; :2174 acts on it anyway.

Re-testing fidp->fid_type == P9_FID_NONE after the yield would close the PoC's path, but it is a per-site patch that has to be repeated at every instance listed under Root Cause Analysis, and it leaves the window itself — the fid is still visibly untyped while a request holds it, so a second Tlopen and a Txattrcreate can still both be admitted and the loser just gets a late error. The alternative is to make the transition atomic by claiming the fid: give it a state that is neither "untyped" nor any real type, entered before the first yield.

The patch

The claim state is a new fid_type value:

hw/9pfs/9p.h

 enum {
     P9_FID_NONE = 0,
     P9_FID_FILE,
     P9_FID_DIR,
     P9_FID_XATTR,
+    /*
+     * Transient type, held by a request that has claimed an untyped fid
+     * and must yield before it can assign the fid its final type.
+     *
+     * It is not P9_FID_NONE, so every "is this fid still untyped?" test
+     * rejects a fid in this state, and it matches none of the real types,
+     * so no consumer will interpret fidp->fs while it is set. A fid is
+     * never left in this state across a request boundary.
+     */
+    P9_FID_PENDING,
 };

with two helpers next to alloc_fid() in hw/9pfs/9p.c (their explanatory comments are elided here and present in the patch file):

static bool v9fs_fid_claim(V9fsFidState *fidp)
{
    if (fidp->fid_type != P9_FID_NONE) {
        return false;
    }
    fidp->fid_type = P9_FID_PENDING;
    return true;
}


static void v9fs_fid_unclaim(V9fsFidState *fidp)
{
    if (fidp && fidp->fid_type == P9_FID_PENDING) {
        fidp->fid_type = P9_FID_NONE;
    }
}

Each of the four sites then turns its guard into a claim and drops an unconverted claim on the common exit path. For v9fs_open():

-    if (fidp->fid_type != P9_FID_NONE) {
+    if (!v9fs_fid_claim(fidp)) {
         err = -EINVAL;
         goto out;
     }
 ...
 out:
+    v9fs_fid_unclaim(fidp);
     put_fid(pdu, fidp);

Applied at v9fs_open() (:2156), v9fs_lcreate() (:2252), v9fs_create() (:2963), and v9fs_xattrwalk() — the last claims immediately after alloc_fid(s, newfid) at :4068, because both of its branches yield before assigning P9_FID_XATTR, and unclaims inside the existing if (xattr_fidp) at out:. Total: 64 insertions, 3 deletions across hw/9pfs/9p.c and hw/9pfs/9p.h.

Why a new enum value is safe here

This was checked by reading every fid_type consumer in hw/9pfs/, not assumed:

  • Every "still untyped?" guard is != P9_FID_NONE, so each one rejects P9_FID_PENDING with no change. That is what makes the racing Txattrcreate lose at :4238.
  • Every consumer dispatches on a concrete type — == P9_FID_FILE, == P9_FID_DIR, == P9_FID_XATTR — so none of them interprets fidp->fs while the claim is held. free_fid(), v9fs_reclaim_fd(), v9fs_reopen_fid(), local_fid_fd() and local_has_valid_file_handle() all fall through their type switches and do nothing, which is the correct behaviour for a fid whose union is not yet live.
  • No exit escapes the unclaim. Each of the four functions was extracted and every return and goto between the claim and out: enumerated: there is no early return, so out: is the single exit and one unclaim covers it.
  • clunk_fid() (hw/9pfs/9p.c:456-468) only unlinks the fid and sets clunked — it does not free it — so unclaiming before put_fid() is safe even on the paths that already clunked.
  • A fid is never observable as P9_FID_PENDING by the guest: the claim is taken and dropped inside one handler.

Test results

Patched tree built from d7a65d1793; stock -O2 configuration, same as build-rel. patches/9pfs-fid-claim.patch applies to a pristine d7a65d1793 with git apply and no fuzz. All of the following are in traces/fix_verification.txt.

git apply patches/9pfs-fid-claim.patch
ninja -C build-rel qemu-system-x86_64
# rebuild the PoC against the patched tree, then:
P=/x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio-9p/virtio-9p-tests
QTEST_QEMU_BINARY=$PWD/build-rel/qemu-system-x86_64 ./qos-poc -p $P/synth/fix/regression
Test Unpatched d7a65d1793 Patched
local/poc/xattr_dir_union SIGSEGV Rlerror errno 22, QEMU alive
local/poc/xattr_dir_union_coptr SIGSEGV Rlerror errno 22, QEMU alive
synth/poc/xattr_dir_union_ctrl SIGSEGV Rlerror errno 22, QEMU alive
synth/poc/xattr_dir_union_short SIGSEGV Rlerror errno 22, QEMU alive
synth/poc/xattr_dir_union_coptr_a SIGSEGV Rlerror errno 22, QEMU alive
synth/poc/xattr_dir_union_coptr_b SIGSEGV Rlerror errno 22, QEMU alive
synth/poc/xattr_fid_count_leak race won, counter over-charged Rlerror errno 22 — race blocked, so the miscount does not occur either
synth/poc/xattr_fid_count_control pass (no race in this case) pass, unchanged
synth/fix/regression fails passes

The six crashing cases now get Rlerror with errno 22 (EINVAL) for the Txattrcreate instead of Rxattrcreate, and no kill_qemu() detected QEMU death. They are written to assert the bug, so on a patched QEMU the harness still reports not ok — with the message Received response 7 (RLERROR) instead of 33 (RXATTRCREATE), which is the fix working.

synth/fix/regression is the one case written the other way round, as a regression test for the fix rather than for the bug. It drives the identical interleaving and asserts what a fixed QEMU must do: the racing Txattrcreate gets Rlerror/EINVAL, the Tlopen still succeeds, and a following Treaddir on that fid still returns entries — so it also fails a "fix" that closes the window by breaking Tlopen. Unpatched it reports not ok (Received response 33 (RXATTRCREATE) instead of 7 (RLERROR)); patched it reports ok and prints fid 1 stayed a directory; concurrent Txattrcreate rejected.

No regressions:

  • 36/36 in-tree 9pfs qtests pass, and the per-test verdicts are identical patched vs. unpatched (every qos-test path matching 9p).
  • meson test --suite qtest-x86_64 on the patched tree: Ok 69, Fail 0, Skipped 4, Timeout 0 — including qos-test, ahci-test and bios-tables-test.
  • scripts/checkpatch.pl --no-signoff: "total: 0 errors, 0 warnings, 127 lines checked … has no obvious style problems."

What that upstream coverage reaches, and what it does not. All 36 of those tests come from one upstream file, tests/qtest/virtio-9p-test.c (registered at tests/qtest/meson.build:373); two of the 36 are the generic pci-device-tests/nop and virtio-tests/nop nodes the qos graph contributes. That file sends Tlopen, Tlcreate and Txattrcreate, so two of the four claim sites — v9fs_open() and v9fs_lcreate() — are exercised on every run, as is the v9fs_xattrcreate() guard that must now reject P9_FID_PENDING. It sends no Tcreate and no Txattrwalk; neither appears anywhere under tests/qtest/. The claims added to v9fs_create() and v9fs_xattrwalk() are therefore covered by code review only — same three-line transform on the same guard shape, but that is an argument, not a measurement.

The three guards the patch deliberately leaves alone

hw/9pfs/ contains seven fid_type != P9_FID_NONE guards. The patch converts four. The other three are not converted, and the distinction is deliberate rather than an oversight:

site function what the untyped check is a precondition for
hw/9pfs/9p.c:2076 v9fs_walk(), the fid == newfid branch v9fs_path_copy(&fidp->path, &path) at :2081
hw/9pfs/9p.c:3393 v9fs_complete_rename() the new path built by v9fs_co_name_to_path() at :3397
hw/9pfs/9p.c:3472 v9fs_rename() v9fs_complete_rename() at :3482, under the rename write lock

None of the three goes on to assign fid_type, so none of them can produce the union type confusion this report is about. They use "the fid is untyped" to mean "there is no open state to invalidate while I rewrite fidp->path", and a racer that wins against them produces a path/type mismatch rather than a tag/payload mismatch — adjacent to CVE-2026-93834's class, not to this one. They are listed because the grep that finds the four patched sites also finds these, and because they do have the same non-atomic shape: v9fs_rename()'s check at :3472 precedes v9fs_path_write_lock() at :3481, which is qemu_co_rwlock_wrlock() under V9FS_PATHNAME_FSCONTEXT (hw/9pfs/9p.h:428-433) and can therefore yield before v9fs_complete_rename() at :3482 yields again. Converting them is a separate judgement about a separate consequence; this patch does not make it.

Acknowledgement

Please credit: Ken Hsu, Royce Lu, and Bo Qu - Palo Alto Networks NOVA