Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F278C7EE2F for ; Thu, 2 Mar 2023 19:20:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjCBTUM (ORCPT ); Thu, 2 Mar 2023 14:20:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjCBTUK (ORCPT ); Thu, 2 Mar 2023 14:20:10 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B181EBDD; Thu, 2 Mar 2023 11:19:54 -0800 (PST) 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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=bkzoc/tUK4PrSpc0Zzz+weifcs/tyweKIYQNyK6abeM=; b=Di2PLfsCLVWUTD/DT2zMiuIUf8 dZGRXyjXeB1f9lgY66JvT48GRj1ZPgWzBfzMuhAB557MFT/0zGVEFtJme8YsxjezQWqgjBjXJ3d/s drF62qiDAvRTj3GEQBvwTTvobBq51eKyMFmkq5EFAivqNcxwh2hhmwZB5soKWCvfP4QjK8CTU0RFV sl24sDnWiIwzfj5jUKqGPO/IKvgKVfKz0Vrmr5t2WrFMlRKTmCrQmk5FKaVwDwrHrbpB0Hw67yOCR 1tmbUv0h7ThsxblsUvacdEwLl4j5a1ZbqGje8bThbz2I7285PdXjJeYHYyks/YCsQBqustAWnN+y3 DKJNOW9A==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pXoSz-00DNar-1U; Thu, 02 Mar 2023 19:19:49 +0000 Date: Thu, 2 Mar 2023 19:19:49 +0000 From: Al Viro To: Linus Torvalds Cc: Mateusz Guzik , Kees Cook , Eric Biggers , Alexander Potapenko , Christian Brauner , serge@hallyn.com, paul@paul-moore.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH v3 2/2] vfs: avoid duplicating creds in faccessat if possible Message-ID: References: <20230125155557.37816-1-mjguzik@gmail.com> <20230125155557.37816-2-mjguzik@gmail.com> <20230302083025.khqdizrnjkzs2lt6@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 02, 2023 at 11:10:03AM -0800, Linus Torvalds wrote: > On Thu, Mar 2, 2023 at 11:03 AM Linus Torvalds > wrote: > > > > It might be best if we actually exposed it as a SLAB_SKIP_ZERO thing, > > just to make it possible to say - exactly in situations like this - > > that this particular slab cache has no advantage from pre-zeroing. > > Actually, maybe it's just as well to keep it per-allocation, and just > special-case getname_flags() itself. > > We could replace the __getname() there with just a > > kmem_cache_alloc(names_cachep, GFP_KERNEL | __GFP_SKIP_ZERO); > > we're going to overwrite the beginning of the buffer with the path we > copy from user space, and then we'd have to make people comfortable > with the fact that even with zero initialization hardening on, the > space after the filename wouldn't be initialized... ACK; same in getname_kernel() and sys_getcwd(), at the very least.