[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6400fedb.170a0220.ece29.04b8@mx.google.com>
Date: Thu, 2 Mar 2023 11:54:03 -0800
From: Kees Cook <keescook@...omium.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Mateusz Guzik <mjguzik@...il.com>,
Eric Biggers <ebiggers@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Christian Brauner <brauner@...nel.org>, serge@...lyn.com,
paul@...l-moore.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-security-module@...r.kernel.org
Subject: Re: [PATCH v3 2/2] vfs: avoid duplicating creds in faccessat if
possible
On Thu, Mar 02, 2023 at 07:19:49PM +0000, Al Viro wrote:
> On Thu, Mar 02, 2023 at 11:10:03AM -0800, Linus Torvalds wrote:
> > On Thu, Mar 2, 2023 at 11:03 AM Linus Torvalds
> > <torvalds@...ux-foundation.org> 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.
FWIW, much earlier analysis suggested opting out these kmem caches:
buffer_head
names_cache
mm_struct
anon_vma
skbuff_head_cache
skbuff_fclone_cache
Alexander's analysis more recently[2] of skbuff went a bit further,
I think, and allowed opt-out for non-kmem cache page allocations too.
-Kees
[1] https://lore.kernel.org/all/20190514143537.10435-5-glider@google.com/
--
Kees Cook
Powered by blists - more mailing lists