hw/9pfs: mutate FID path from main thread only (CVE-2026-93834)
PATCH 1/1 hw/9pfs: mutate FID path from main thread only (CVE-2026-93834)
v9fs_co_open2() is the only code that mutates a FID path from a worker
thread: inside its v9fs_co_run_in_worker() block it frees fidp->path and copies in the new path under the held FID path write lock.
Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (v9fs_walk(), v9fs_xattrwalk(), v9fs_stat(), v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.
Fix this by making the worker thread block in v9fs_co_open2() read-only with respect to the FID: render the new path into the local 'path' variable only and copy it to fidp->path after the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491
--- hw/9pfs/cofile.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
hw/9pfs/cofile.c +14 -6
@@ -144,10 +144,11 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidState *fidp, cred.fc_mode = mode &07777 ; cred.fc_uid = fidp->uid; cred.fc_gid = gid; +v9fs_path_init (&path);/* * Hold the directory fid lock so that directory path name -* don't change. Take the write lock to be sure this fid -* cannot be used by another operation. +* don't change. Take the write lock since the fid path is +* mutated below on success. */ v9fs_path_write_lock (s); v9fs_co_run_in_worker(
@@ -157,23 +158,30 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidState *fidp,if (err <0 ) { err = -errno; }else { -v9fs_path_init (&path); err =v9fs_name_to_path (s, &fidp->path, name->data, &path);if (!err) { err = s->ops->lstat (&s->ctx, &path, stbuf);if (err <0 ) { err = -errno; s->ops->close (&s->ctx, &fidp->fs); - }else { -v9fs_path_copy (&fidp->path, &path); } }else { s->ops->close (&s->ctx, &fidp->fs); } -v9fs_path_free (&path); } }); +/* +* The fid path must not be mutated from the worker thread: other +* requests may access the same fid on the main thread, and the main +* thread never takes the path lock for reads. Mutate the new path +* here, on the main thread and still under the held write lock, like +* every other mutation of a fid path. +*/ +if (!err) { +v9fs_path_copy (&fidp->path, &path); + }v9fs_path_unlock (s); +v9fs_path_free (&path);if (!err) { total_open_fd++;if (total_open_fd > open_fd_hw) {
Signature · 1 line
2.47.3
Quoted 9 lines · On Mon, 21 Sep 2026 14:18:58 +0200 Christian Schoenebeck…
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.
Quoted 7 lines
Fix this by making the worker thread block in
v9fs_co_open2()read-only with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fid path.")
Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834
Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491
Cannot find that either...
Quoted 2 lines
Signed-off-by Christian Schoenebeck <[email protected]>---
but fix looks good.
Quoted 56 lines
hw/9pfs/cofile.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)hw/9pfs/cofile.c +14
-6@@ -144,10 +144,11 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidState *fidp, cred.fc_mode = mode &07777 ; cred.fc_uid = fidp->uid; cred.fc_gid = gid; +v9fs_path_init (&path);/* * Hold the directory fid lock so that directory path name -* don't change. Take the write lock to be sure this fid -* cannot be used by another operation. +* don't change. Take the write lock since the fid path is +* mutated below on success. */ v9fs_path_write_lock (s); v9fs_co_run_in_worker(@@ -157,23 +158,30 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidState *fidp,if (err <0 ) { err = -errno; }else { -v9fs_path_init (&path); err =v9fs_name_to_path (s, &fidp->path, name->data, &path);if (!err) { err = s->ops->lstat (&s->ctx, &path, stbuf);if (err <0 ) { err = -errno; s->ops->close (&s->ctx, &fidp->fs); - }else { -v9fs_path_copy (&fidp->path, &path); } }else { s->ops->close (&s->ctx, &fidp->fs); } -v9fs_path_free (&path); } }); +/* +* The fid path must not be mutated from the worker thread: other +* requests may access the same fid on the main thread, and the main +* thread never takes the path lock for reads. Mutate the new path +* here, on the main thread and still under the held write lock, like +* every other mutation of a fid path. +*/ +if (!err) { +v9fs_path_copy (&fidp->path, &path); + }v9fs_path_unlock (s); +v9fs_path_free (&path);if (!err) { total_open_fd++;if (total_open_fd > open_fd_hw) {
Signature · 1 line
Greg
Quoted 24 lines · Greg Kurz
Quoted 9 lines · On Mon, 21 Sep 2026 14:18:58 +0200 Christian Schoenebeck…
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Quoted 7 lines
Fix this by making the worker thread block in
v9fs_co_open2()read-only with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fid path.")Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834
Quoted 7 lines
Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491Cannot find that either...
Initially confidential, so only visible to maintainers with acccounts added to the gitlab project. Bugs should be made public when their patch is posted for review, so I've turned off the confidential flag now.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Quoted 32 lines · On Tuesday, 22 September 2026 14:30:53 CEST Daniel P. Berrangé wrote:
Quoted 31 lines · Greg Kurz
On Mon, 21 Sep 2026 14:18:58 +0200
Quoted 9 lines · Christian Schoenebeck
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Quoted 8 lines
Fix this by making the worker thread block in
v9fs_co_open2()read-only with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fidpath.")
Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491
Quoted 6 lines
Quoted 1 line
Cannot find that either...
Initially confidential, so only visible to maintainers with acccounts added to the gitlab project. Bugs should be made public when their patch is posted for review, so I've turned off the confidential flag now.
Strange policies. I would have:
- Added Greg (reviewer and previous 9p maintainer for years) to the report while it was still private. Instead I am the only one getting LLM generated security reports thrown at me.
- Considering the severeness of the vulnerability, I would have waited for the patch been pushed through stable branches before making the full report public, or at least until merged on git.
/Christian
Quoted 45 lines · On Tuesday, 22 September 2026 17:10:58 CEST Christian Schoenebeck wrote:
Quoted 35 lines · On Tuesday, 22 September 2026 14:30:53 CEST Daniel P. Berrangé wrote:
Quoted 34 lines · Greg Kurz
On Mon, 21 Sep 2026 14:18:58 +0200
Quoted 18 lines · Christian Schoenebeck
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Fix this by making the worker thread block in
v9fs_co_open2()read-only
with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned
back to the main thread and still under the held write lock of the FID,
like every other FID path mutation does.Quoted 2 lines
Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fidpath.")
Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491Quoted 6 lines
Quoted 1 line
Cannot find that either...
Initially confidential, so only visible to maintainers with acccounts added to the gitlab project. Bugs should be made public when their patch is posted for review, so I've turned off the confidential flag now.
Strange policies. I would have:
Quoted 7 lines
- Added Greg (reviewer and previous 9p maintainer for years) to the report while it was still private. Instead I am the only one getting LLM generated security reports thrown at me.
- Considering the severeness of the vulnerability, I would have waited for the patch been pushed through stable branches before making the full report public, or at least until merged on git.
CC-ing Peter Maydell for clarification on these QEMU policies:
Peter, context: this vulnerability was an unprivileged guest user sandbox escape combined with arbitrary code execution on host.
/Christian
Quoted 40 lines · Christian Schoenebeck
Quoted 32 lines · On Tuesday, 22 September 2026 14:30:53 CEST Daniel P. Berrangé wrote:
Quoted 31 lines · Greg Kurz
On Mon, 21 Sep 2026 14:18:58 +0200
Quoted 9 lines · Christian Schoenebeck
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Quoted 8 lines
Fix this by making the worker thread block in
v9fs_co_open2()read-only with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fidpath.")
Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491Quoted 6 lines
Quoted 1 line
Cannot find that either...
Initially confidential, so only visible to maintainers with acccounts added to the gitlab project. Bugs should be made public when their patch is posted for review, so I've turned off the confidential flag now.
Quoted 5 lines
Strange policies. I would have:
- Added Greg (reviewer and previous 9p maintainer for years) to the report while it was still private. Instead I am the only one getting LLM generated security reports thrown at me.
While we primarily only intend to add people in the MAINTAINERS file to the gitlab project, given Greg's long term involvement in QEMU I see no problem with adding him as a member in gitlab, which would allow for viewing all confidential bugs.
Greg, just ask one of the project owners listed:
https://gitlab.com/qemu-project/qemu/-/project_members?max_role=static-50
to add your gitlab account
Quoted 3 lines
- Considering the severeness of the vulnerability, I would have waited for the patch been pushed through stable branches before making the full report public, or at least until merged on git.
Once a patch is posted on the public mailing list, we consider the flaw to be public. Both the code and patch description provide sufficient info about the flaw that keeping the bug private is a false sense of protection. So it is documented that the confidential flag is to be removed when posting to qemu-devel:
https://www.qemu.org/contribute/security-process/
If a maintainer really wants additional code review before a bug is made public, then best to do that via private email, or the issue tracker, as best fits the situation.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Quoted 74 lines · On Wednesday, 23 September 2026 10:15:04 CEST Daniel P. Berrangé wrote:
Quoted 45 lines · Christian Schoenebeck
Quoted 37 lines · On Tuesday, 22 September 2026 14:30:53 CEST Daniel P. Berrangé wrote:
Quoted 36 lines · Greg Kurz
On Mon, 21 Sep 2026 14:18:58 +0200
Quoted 20 lines · Christian Schoenebeck
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Fix this by making the worker thread block in
v9fs_co_open2()read-only
with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned
back to the main thread and still under the held write lock of the FID,
like every other FID path mutation does.Quoted 2 lines
Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fidpath.")
Wow, it's a long standing issue ! ;-)
Quoted 1 line
Fixes CVE-2026-93834Cannot find it... embargoed ?
Quoted 3 lines
Reported-by: Milad Nasr <https://gitlab.com/sirkhezr>
Suggested-by: Milad Nasr <https://gitlab.com/sirkhezr>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491Quoted 6 lines
Quoted 1 line
Cannot find that either...
Initially confidential, so only visible to maintainers with acccounts added to the gitlab project. Bugs should be made public when their patch is posted for review, so I've turned off the confidential flag now.
Quoted 6 lines
Strange policies. I would have:
- Added Greg (reviewer and previous 9p maintainer for years) to the report while it was still private. Instead I am the only one getting LLM generated
security reports thrown at me.While we primarily only intend to add people in the
MAINTAINERSfile to the gitlab project, given Greg's long term involvement in QEMU I see no problem with adding him as a member in gitlab, which would allow for viewing all confidential bugs.Greg, just ask one of the project owners listed:
https://gitlab.com/qemu-project/qemu/-/project_members?max_role=static-50
to add your gitlab account
Quoted 3 lines
- Considering the severeness of the vulnerability, I would have waited for the patch been pushed through stable branches before making the full report public, or at least until merged on git.
Once a patch is posted on the public mailing list, we consider the flaw to be public. Both the code and patch description provide sufficient info about the flaw that keeping the bug private is a false sense of protection. So it is documented that the confidential flag is to be removed when posting to qemu-devel:
Quoted 5 lines
https://www.qemu.org/contribute/security-process/
If a maintainer really wants additional code review before a bug is made public, then best to do that via private email, or the issue tracker, as best fits the situation.
1. I explicitly *asked* on the private security report how to proceed and emphasized the question under the circumstance of its severeness, and was told to send the patch to public qemu-devel.
2. The patch alone neither exposes the severeness class, nor how to exploit. Making the security report public OTOH provides anybody a turn-key solution for existing production distributions, before these distros had any chance to patch.
3. It is not trivial to generate a working exploit from the patch alone, as it requires deep understanding of the target system's memory layout to construct a working exploit. Many LLMS probably fail on that task. Would be interesting to know from Milad Nasr how long the (supposedly frontier) LLM took to construct the working exploits, but I guess it still took a while.
4. Current embargo policy says:
"Thus the QEMU maintainers will generally reject requests for arbitrary embargoes unless high severity, extenuating circumstances can be demonstrated."
-> It *was* high severity.
5. This rather relaxed handling, does not match with the very strict policy OTOTH of denying official reviewers access to private security reports.
/Christian
Quoted 19 lines · On Monday, 21 September 2026 14:18:58 CEST Christian Schoenebeck wrote:
v9fs_co_open2()is the only code that mutates a FID path from a worker
thread: inside itsv9fs_co_run_in_worker()block it freesfidp->pathand copies in the new path under the held FID path write lock.Every other FID path mutation in the 9p codebase happens on the main thread, so main thread readers (
v9fs_walk(),v9fs_xattrwalk(),v9fs_stat(),v9fs_co_name_to_path()) rely on the same (main) thread atomicity and don't take the path read lock themselves on main thread.Fix this by making the worker thread block in
v9fs_co_open2()read-only with respect to the FID: render the new path into the local 'path' variable only and copy it tofidp->pathafter the worker block returned back to the main thread and still under the held write lock of the FID, like every other FID path mutation does.Fixes 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fid path.")Fixes CVE-2026-93834Reported-by Milad Nasr <https://gitlab.com/sirkhezr>Suggested-by Milad Nasr <https://gitlab.com/sirkhezr>
Quoted 5 lines
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491
Signed-off-by Christian Schoenebeck <[email protected]>--- hw/9pfs/cofile.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
Queued on 9p.next:
https://github.com/cschoenebeck/qemu/commits/9p.next
Thanks!
/Christian