From nobody Sat Sep 26 20:00:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1789993423; cv=none; d=zohomail.com; s=zohoarc; b=Jyq/EcR1+9Fs947FdOJxkToUP3dlWAhtHa2sd+3wJXlkq71KS1siGm/cCEBzKilJX6xJsW69rO0UuEzM9H6oloWmYQ8nmrfwh4CPN5/0DGb0/VGwRL54kXgcT4qRP6PlT2Zyu+0LS01V6Dcwx+UVXjNDiVPZ6tVbtjo1csXn8/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789993423; h=Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xRAjs31oYZHJT4KXgomXBio+IZsCVIU9k+xalIhBFOc=; b=Iyipp5dnrSvNDcrJG0AE21/fe9EoJ96bi5DuwViVsf9TqAaA6hSVlvki+0oX8OQNcLoEe2eG8d8IDmfvOG0V1ZK/PJohO5VUfS/m0cCQ7s6SAH2nADJ5O9TVyEgYPJ/vqXXKmdoCxeCoHDKaTsWvjCKkbK+qRf1Lx57ZgRS4vxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789993422854751.0144298828986; Mon, 21 Sep 2026 05:23:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x8d3X-0002FV-QV; Mon, 21 Sep 2026 08:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <2ecdcd9af56ca251fe689edf09d8029fd0feeed9@kylie.crudebyte.com>) id 1x8d3U-0002FD-2X; Mon, 21 Sep 2026 08:23:32 -0400 Received: from kylie.crudebyte.com ([5.189.157.229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <2ecdcd9af56ca251fe689edf09d8029fd0feeed9@kylie.crudebyte.com>) id 1x8d3R-0000jR-RK; Mon, 21 Sep 2026 08:23:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=kylie; h=Message-Id:Cc:To:Subject:Date:From:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Content-ID: Content-Description; bh=xRAjs31oYZHJT4KXgomXBio+IZsCVIU9k+xalIhBFOc=; b=CXlIt CynFewY7G99g22mP1deW58kibTLszBV0+UVOSkAoSzsCMRcjJVkAxj996YOT3zBrOx4NlOF9EA4b4 Z4H9s4ydTUh0YNhGhX4d/1oT23Apg6RdsPWp8Di5hQIIUbcjoCojVG3rT6CXdKl1aOBvMekAl41GN V8ktJbG9LwrlDnvAm8okq+VrEqhIV84lWwlhswcwZ/1Qg0AYcEw/rEEuV+dFKPpK3GWvSpqJMoVYk aWtgPwKT9x+xCY0tyvTIhCOKewFpS3KOTUMxAih9DPoz4w41llaNkpv6YbH46IEO30W30XEyhOIGB bomBD6Zxypk6exbOdNGOME2m0AK0QplneLFNhG6N7Ue6nFFbcqDTLXZiywnP4aa2x/A+fpXWXlYRs wonWHzhDbODZXCr075DoNvQC/qfZ0kHwmPm9jIL9P0MkLlxXDRs2XLN2td4+3hio9i89v2bP/pVQZ ZsfZJ7Uex8YAnGAPoQZs7Fs6bQdo+OJfF28QYwn98jXGoIVrAd316ZzViDc+p7cbLzYfzndp4jIqb ktWnzfCZZYl8/fDxUiqeKy5K0qYt4XkBUse1gjK+a+hBSQVH7i+tIHPpKscHlscqOKYaeMlMxq0ci ckQ0hvBgRAfHaT0gO1lTu4eZ1jUIDqJg4nmqLHf9PBNfbamOVn6VmCogPq3U8g=; From: Christian Schoenebeck Date: Mon, 21 Sep 2026 14:18:58 +0200 Subject: [PATCH] hw/9pfs: mutate FID path from main thread only (CVE-2026-93834) To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Greg Kurz Message-Id: Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=5.189.157.229; envelope-from=2ecdcd9af56ca251fe689edf09d8029fd0feeed9@kylie.crudebyte.com; helo=kylie.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1789993427112158500 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Fixes: 02cb7f3a25 ("hw/9pfs: Use read-write lock for protecting fid path.") Fixes: CVE-2026-93834 Reported-by: Milad Nasr Suggested-by: Milad Nasr Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4491 Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz --- hw/9pfs/cofile.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c index 6e775c8e41..27fe5bfb20 100644 --- a/hw/9pfs/cofile.c +++ b/hw/9pfs/cofile.c @@ -144,10 +144,11 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidS= tate *fidp, cred.fc_mode =3D mode & 07777; cred.fc_uid =3D fidp->uid; cred.fc_gid =3D 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, V9fsFidS= tate *fidp, if (err < 0) { err =3D -errno; } else { - v9fs_path_init(&path); err =3D v9fs_name_to_path(s, &fidp->path, name->data, &pat= h); if (!err) { err =3D s->ops->lstat(&s->ctx, &path, stbuf); if (err < 0) { err =3D -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) { --=20 2.47.3