From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 722DB477E53; Wed, 3 Jun 2026 18:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780512619; cv=none; b=rWl1WfdDgtPe4YY642hKGNxa6/JQ+GYcJomBFFvurSjn8AvkAb6ZIO5/FP7fshKTQFl0KsVESHAE+Euz5nLcjTwIi33KnYJWtoSVanwT8dC28tuOUh6mgSDroT0dluiVbc8SszAitc6376sS5YQdpGyhS/2w6k6UYHw5DJJ2sWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780512619; c=relaxed/simple; bh=SOlEDK8Sh9S2cMXhhYkWYasiHpYHLpJKORMAEbz9zyo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NU84O7mFiPUiiB4TrpOY8JcAj+1BFmeNT0TorqxnPQkrXMb1SD+Tsx/LTP861qmlOPZwLLvKwn+fWBisbYFOfpWBb2ZerI6BtoA3KWIg+e4E64J7+aIWi/GbK3oE7Jv+LPdU1w6691quxU1cpWMO3o3FZP9UqPFgjuq/y5tmyD0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=SoillID1; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="SoillID1" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HQV8SMIS7Y3ZO98u+aiPCRRGt8QfOs3Rmxeaom911Yk=; b=SoillID1fearalSiq+aJ5RD241 H8yqIqX4OiMpcxANNHIZPvR6XdNBHvA1mUMM+G9qpBwyUP8YCr7tiE4QxfjMzhtzZ3guxLIKIjgBv sDKpjV56h8JtXuBhiMW5RUmyq+NEB/0FtX3uf/lsMX9GQRaqjrDPN3CzgH0WgLrNAJNsLqowT3Fj/ xCG2c/RhVi6dB3sr089gkLt6/ZL+k96vaEtsdEMEb4YrWd78s8rrp+qOE6S4Bge4GMnbvU36Ye/b2 440ZzgstzY1UxelZ1S+LgYKtDIyR/wYTZalxy8cXzF3djXE/exINiZV5UIHmg0s5Td37S9FsTLbOD OybePIHw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99.2 #2 (Red Hat Linux)) id 1wUqfN-0000000FC3C-2Z3m; Wed, 03 Jun 2026 18:50:14 +0000 Date: Wed, 3 Jun 2026 19:50:13 +0100 From: Al Viro To: Jann Horn Cc: Christian Brauner , Jan Kara , Chuck Lever , Jeff Layton , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] fhandle: fix UAF due to unlocked ->mnt_ns read in may_decode_fh() Message-ID: <20260603185013.GZ2636677@ZenIV> References: <20260603-vfs-fhandle-uaf-fix-v1-1-ff64ee367e4d@google.com> <20260603181523.GW2636677@ZenIV> <20260603184151.GY2636677@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260603184151.GY2636677@ZenIV> Sender: Al Viro On Wed, Jun 03, 2026 at 07:41:51PM +0100, Al Viro wrote: > Basically, the store that cleared ->mnt_ns has been done in namespace_sem > scope and that scope is either no later than the scope in put_mnt_ns() argh... s/either// > that has dropped the active refcount of ns to zero. At the beginning > of that scope in put_mnt_ns() we are guaranteed to have the passive > refcount positive. Dropping the passive reference happens after an > rcu delay started in later in the same namespace_sem scope and namespace > is not freed until the passive refcount reaches zero. TL;DR: your fix is correct, but needs a better explanation of correctness. If nothing else, I'd like to have the above findable on lore - I've way too many pieces of half-baked docs sitting around in local notes as it is ;-/