From nobody Sun Jun 14 09:56:24 2026 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAE053D3D09; Thu, 2 Apr 2026 10:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775124342; cv=none; b=sAHfoL1wt+fH9Vku0w5VZQdMp+jzsozsVQx+G2fwaqLB25fDfSYhvlHimVI07TjZr0WS3lzbe+WxhUJC7AuU15yE2e2vs5iQJyb9LH06dumX6f1lmEHXUuPuaY8OlDjxDUEPsDQCAIMdh2ENlCI8jqrrRXMl5d6ok3qvc7ysGiU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775124342; c=relaxed/simple; bh=b2JNMs0NZ18PorNCvdnpqWu24AHCLQdIaeRbgJrvROE=; h=MIME-Version:Date:From:To:Cc:Message-Id:Subject:Content-Type; b=dvRdmCRUxg6RdmrCAsNQ9YsUr857ctBxjBTr4TRjh9wQx4sGx9h+nZmH1jtq1nmAKe4CCM4DQuZlDP3+j3sdqUr+b3FiHMHM3Xzj19Q8mBVtB+RN+Qmz7R0QYLYLsnByj0YIdLk2L9jzY9mxqljSupLGeJTAhXb92LUhc/XXihU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=barre.sh; spf=pass smtp.mailfrom=barre.sh; dkim=pass (2048-bit key) header.d=barre.sh header.i=@barre.sh header.b=ErXhcK0R; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=P1mtd33L; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=barre.sh Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=barre.sh Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=barre.sh header.i=@barre.sh header.b="ErXhcK0R"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="P1mtd33L" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2ED5E1400034; Thu, 2 Apr 2026 06:05:40 -0400 (EDT) Received: from phl-imap-04 ([10.202.2.82]) by phl-compute-06.internal (MEProxy); Thu, 02 Apr 2026 06:05:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=barre.sh; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1775124340; x=1775210740; bh=OB IVJ+q0wfIwTSriESzZgxCy2O/5HaujjjBF4P444r8=; b=ErXhcK0RECxP2OB3on tW9Tzcd5SZESNv+s9HtDTpHY34Y4sSAjz62inSyLtIg4FUt75oDRWog9iaHGI/Li X5KIgSnVqlHOEkhTyscjSCuSn2yzclGm6bDUNCEfIEn6yiMzHZ9x+S1zVM1dISXC qpKF8DvhbNcsPOdN84zV00nD80IEJkTSh6QVlomXht+Cudscev929a04E/wcTruQ pKdQ1norj0HSiwD0Hxjx912PsnYmiVjkAbDgb2oKUmn+oa8qvRnGpdGJSiY6/B0C E64e5iL8dP66UdP9utW+MNZglq5LyVxwRinRbKO9n9YaIMrjZO8lBhzKydPPsX1s 1mDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1775124340; x=1775210740; bh=OBIVJ+q0wfIwTSriESzZgxCy2O/5 HaujjjBF4P444r8=; b=P1mtd33LjSCeV7UO7GiTLidBqXgmJI9MlI6Jt+40A+Np Meu3zWI9D/kj7xjf9/3PYpfGu8tnMBclxxTKI6lqPTYXT1M6LMBbMU2DQ4Womkeg rktgu8cvNB/tJNCde1xiKTP3JctDyaMfTq243FkKgIgh8LvQImdVRJvNFtpncpm+ b1kgQHP+Rcm8eGfNXuf1LAJFWmiQr+skUecW04yzlQ6c8SRQsFuLxHhl6JqkVmLW QOS0eMp1S3Cg3Oz+13AbgQz5eMVaIiFQYPboQWN2jQLNq7judKpGeLU30SNcoewI l6oi9v8eppFgXFoAi/EYWn8ntoDUdI54Hnm9H/IgwA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdehjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefoggffhffvvefkufgtgfesthejredtredttd enucfhrhhomhepfdfrihgvrhhrvgcuuegrrhhrvgdfuceophhivghrrhgvsegsrghrrhgv rdhshheqnecuggftrfgrthhtvghrnhepjeffuefggfeuieehtdegfedujeektedugffhge dukeegfeeggfeludfhteefhfeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomhepphhivghrrhgvsegsrghrrhgvrdhshhdpnhgspghrtghpthhtoh epkedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghsmhgruggvuhhssegtohgu vgifrhgvtghkrdhorhhgpdhrtghpthhtoheplhhinhhugigpohhsshestghruhguvggshi htvgdrtghomhdprhgtphhtthhopehluhgthhhosehiohhnkhhovhdrnhgvthdprhgtphht thhopegvrhhitghvhheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepvhelfhhssehlih hsthhsrdhlihhnuhigrdguvghvpdhrtghpthhtohepshgrnhguvggvnhesrhgvughhrght rdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtohepshhtrggslhgvsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i97614980:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 87FE8B6006E; Thu, 2 Apr 2026 06:05:39 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 02 Apr 2026 12:03:12 +0200 From: "Pierre Barre" To: ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org Cc: linux_oss@crudebyte.com, v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org, sandeen@redhat.com Message-Id: <0ddc72da-d196-4f01-8755-0086f670e779@app.fastmail.com> Subject: [PATCH] 9p: fix access mode flags being ORed instead of replaced Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since commit 1f3e4142c0eb ("9p: convert to the new mount API"), v9fs_apply_options() applies parsed mount flags with |=3D onto flags already set by v9fs_session_init(). For 9P2000.L, session_init sets V9FS_ACCESS_CLIENT as the default, so when the user mounts with "access=3Duser", both bits end up set. Access mode checks compare against exact values, so having both bits set matches neither mode. This causes v9fs_fid_lookup() to fall through to the default switch case, using INVALID_UID (nobody/65534) instead of current_fsuid() for all fid lookups. Root is then unable to chown or perform other privileged operations. Fix by clearing the access mask before applying the user's choice. Fixes: 1f3e4142c0eb ("9p: convert to the new mount API") Signed-off-by: Pierre Barre Reviewed-by: Christian Schoenebeck --- fs/9p/v9fs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 057487efaaeb..05a5e1c4df35 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -413,7 +413,11 @@ static void v9fs_apply_options(struct v9fs_session_inf= o *v9ses, /* * Note that we must |=3D flags here as session_init already * set basic flags. This adds in flags from parsed options. + * Access flags are mutually exclusive, so clear any access + * bits set by session_init before applying the user's choice. */ + if (ctx->session_opts.flags & V9FS_ACCESS_MASK) + v9ses->flags &=3D ~V9FS_ACCESS_MASK; v9ses->flags |=3D ctx->session_opts.flags; #ifdef CONFIG_9P_FSCACHE v9ses->cachetag =3D ctx->session_opts.cachetag; -- 2.51.0