From nobody Tue Sep 29 00:36:44 2026 Received: from oss.cyber.gouv.fr (oss.cyber.gouv.fr [51.159.188.251]) (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 D04E63A963D for ; Fri, 14 Aug 2026 10:20:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.188.251 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786702830; cv=none; b=c0uua8ml4s2YjyWMy5Tspup/asRwW/YDuKy3OUFlrh/vmRvMbd/HizgHAKPJBV2bZcT4xk1nWA/f4hG7Fi9RGgn2FeCELfreEseXDDmvs2Q6OIMOdyzpJistN9/TIWp4cWuRoVYgzRfKyQinrfX9vVthvkQ2TmxAH6z1bl3KCSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786702830; c=relaxed/simple; bh=y3DWyGIXR8/0fzifDTMyJa2o778amZYNOSmmA0lfp90=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PoahuJuhS/qcDIPoX8ZMiruHzFJzUMShVIVNBE404XoffQB5y4kiHLFtpqSF9xLy/YKOcACJ4TblN2sx/U5Z0sS/J3oa7B2Tit1QmrwXDSj4o/seurt6oNOre35btpfMBntvP2mjPwqV5yyRrP1pQFjn90P0bcjRsJyH9W8DFJI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.cyber.gouv.fr; spf=pass smtp.mailfrom=oss.cyber.gouv.fr; dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.b=ipfGjSii; arc=none smtp.client-ip=51.159.188.251 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.cyber.gouv.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.cyber.gouv.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.b="ipfGjSii" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=oss.cyber.gouv.fr; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CUXt3gj61jYbvRY5xsOEhynLi3+s2CWhcQknfmiEIjY=; b=ipfGjSiiBtSmwrB9krKcJmqrcv GvwrJDQjNKnV4QniFeHaNefHwPpBWBzFgJh0ffF3bLaNlQIUE9bpeD3ErAO0OWzhoEUJ+ZUyklbCc nw0tMgFOyNo+CBo0MHbHrWAx01Xa4ArIi5jjg6QJMpPSY7y1xZLkyVjEEEQAdBT1PKSABsK4HT+jE EM1j2SwUt5Br/EV2UM6KMYv7Pl5Gb8OfGMnREUDIMJ9vFP76D+Dw3Uh7HKMSpK2lGTZJ/JhTPy1kT w6NCyQGbNrsPrXXHHMy8um19BBNqjV1KanHkQeK3bwzhS1bvVc1OyS/IUN/EjpEZbSrrx5W+WwXG5 4HSJATUw==; Received: from [151.115.150.205] (port=45746 helo=gepetto..) by pf-012.whm.fr-par.scw.cloud with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.5) (envelope-from ) id 1wup1N-0000000AzxW-2ThK; Fri, 14 Aug 2026 12:20:14 +0200 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= To: Christian Brauner Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= Subject: [PATCH] nsfs: keep namespace tree fields stable until after RCU grace period Date: Fri, 14 Aug 2026 10:20:05 +0000 Message-ID: <20260814102005.1939777-1-Jeremy.Jean@oss.cyber.gouv.fr> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - pf-012.whm.fr-par.scw.cloud X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - oss.cyber.gouv.fr X-Get-Message-Sender-Via: pf-012.whm.fr-par.scw.cloud: authenticated_id: jeremy.jean@oss.cyber.gouv.fr X-Authenticated-Sender: pf-012.whm.fr-par.scw.cloud: jeremy.jean@oss.cyber.gouv.fr X-Source: X-Source-Args: X-Source-Dir: struct ns_common overlays struct ns_tree with the rcu_head used by kfree_rc= u().=20 That lets the deferred-free machinery overwrite ns_id and __ns_ref_active as soon as a namespace is queued for freeing, even though nsfs tree walkers may still read those fields under RCU after ns_tree_remove(). KASAN reports slab UAF. Keep the tree state and deferred-free callback storage separate. Namespace = tree readers can then continue to validate and take references until the grace period has elapsed. Assisted-by: Codex:gpt-5 Signed-off-by: J=C3=A9r=C3=A9my Jean --- include/linux/ns/ns_common_types.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/ns/ns_common_types.h b/include/linux/ns/ns_commo= n_types.h index ea45c54e4435..6ed6b497831c 100644 --- a/include/linux/ns/ns_common_types.h +++ b/include/linux/ns/ns_common_types.h @@ -116,10 +116,8 @@ struct ns_common { struct dentry *stashed; const struct proc_ns_operations *ops; unsigned int inum; - union { - struct ns_tree; - struct rcu_head ns_rcu; - }; + struct ns_tree; + struct rcu_head ns_rcu; }; =20 #define to_ns_common(__ns) \ --=20 2.47.3