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 C7E00280324; Wed, 11 Feb 2026 02:21:29 +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=1770776491; cv=none; b=I3xYn6ADbGW/jDxmakMDABdFCDadYQVMRjVzomIGIPDjtO8GRt/GQMLKFWcoHabMmKBps/qOaKR8pMbvpkgB+5WlaWxwyPP+elwz3N4FfEXpKT9IPqYj1h1C6wGq4mr0tqcrVc+Kijnjrna7dg8rP70N8v+KpOadOdhx2bH4j2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770776491; c=relaxed/simple; bh=cynBJVM5vk3Nh0ijs+G7e0CUh0IFSFBo6KExgpHuhiU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ng02Jz9vc7EaEaMPIpINkUgCoOCKXCkxI1FUOjijsefMyz2BlzZPGQFvfB4mrxGtHvBjrU+0uGYDvthXZfQh8+unQb7M1no60VMJXkD457ofOSZLJNqoBkjyx5erO7aiXD0PySAk9JZhD8p9SemtzSp62xWw/liEGynyAIBdxRE= 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=Qge59cfu; 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="Qge59cfu" 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=TWonym77rAWoA+mRhPZypHFC7hQNiGXQAaD+O3JuAkY=; b=Qge59cfuedzmr47H7HZWU6BNFa wztpmWN0yrhsy9qHVwKI5JGpYAbhNHL6wZ633X0OfpNBhiBgvo1PIZNfgK+m7Qtnw/b0Fi67bp356 Z/URrT+u8BvHYk2uBmA2cRPRgEn0VFGtj4oJnRHUvsLDRE8CJKmG5ITBDZOSTkFMErKNnTxiUAAED xYJXxfCB0cjhjIHKQxDvgmm5cPbXnYfEVqeavZa9oGAOtYLs5lcoNO13iX60IyLy/jxImUL1KWIiq VtxOFvaeqkOpVnFh5Xhq7mquf4ZIuF7UbGz+w0A1pgwYFg8glYf+b+irxvRtjGLhuzjDxu3NE+sIz 3UtT7ozA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1vpztF-0000000HP3i-0I0I; Wed, 11 Feb 2026 02:23:41 +0000 Date: Wed, 11 Feb 2026 02:23:41 +0000 From: Al Viro To: Jann Horn Cc: Kees Cook , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] fs: Keep long filenames in isolated slab buckets Message-ID: <20260211022341.GL3183987@ZenIV> References: <20260211004811.work.981-kees@kernel.org> <202602101736.80F1783@keescook> 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: Sender: Al Viro On Wed, Feb 11, 2026 at 03:06:47AM +0100, Jann Horn wrote: > > > I think this path, where we always do maximally-sized allocations, is > > > the normal case where we're handling paths coming from userspace... > > > > Actually, is there any reason we can't use strnlen_user() in > > do_getname(), and then just use strndup_user() in the long case? > > I'm not an expert, but as far as I know, this path is supposed to be > really fast (because pretty much every syscall that operates on a path > will hit it), and doesn't care how much memory it allocates (because > these allocations are normally only alive for the duration of a > syscall). strnlen_user() would add another pass over the userspace > buffer, which I think would probably have negative performance impact? Sigh... This is the case of path longer than 168 bytes (EMBEDDED_NAME_MAX); that's not hard to trigger, but not exactly common. What matters more is that we really do not want to deal with the "now it appears to be empty" case here - it makes the logics in the caller more convoluted and it's not pretty as it is. And no, it is not going to be presistent - the longest you can stick such beasts in there is probably with io-uring; names copied in when request is submitted and stay around until a worker thread gets around to finishing the request.