[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202209221446.5E90AEED@keescook>
Date: Thu, 22 Sep 2022 14:49:08 -0700
From: Kees Cook <keescook@...omium.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Christian König <christian.koenig@....com>,
Pekka Enberg <penberg@...nel.org>,
Feng Tang <feng.tang@...el.com>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Alex Elder <elder@...nel.org>,
Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Daniel Micay <danielmicay@...il.com>,
Yonghong Song <yhs@...com>, Marco Elver <elver@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, netdev@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
linux-fsdevel@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
dev@...nvswitch.org, x86@...nel.org,
linux-wireless@...r.kernel.org, llvm@...ts.linux.dev,
linux-hardening@...r.kernel.org,
Hyeonggon Yoo <42.hyeyoo@...il.com>
Subject: Re: [PATCH 00/12] slab: Introduce kmalloc_size_roundup()
On Thu, Sep 22, 2022 at 11:05:47PM +0200, Vlastimil Babka wrote:
> On 9/22/22 17:55, Kees Cook wrote:
> > On Thu, Sep 22, 2022 at 09:10:56AM +0200, Christian König wrote:
> > [...]
> > > So when this patch set is about to clean up this use case it should probably
> > > also take care to remove ksize() or at least limit it so that it won't be
> > > used for this use case in the future.
> >
> > Yeah, my goal would be to eliminate ksize(), and it seems possible if
> > other cases are satisfied with tracking their allocation sizes directly.
>
> I think we could leave ksize() to determine the size without a need for
> external tracking, but from now on forbid callers from using that hint to
> overflow the allocation size they actually requested? Once we remove the
> kasan/kfence hooks in ksize() that make the current kinds of usage possible,
> we should be able to catch any offenders of the new semantics that would appear?
That's correct. I spent the morning working my way through the rest of
the ksize() users I didn't clean up yesterday, and in several places I
just swapped in __ksize(). But that wouldn't even be needed if we just
removed the kasan unpoisoning from ksize(), etc.
I am tempted to leave it __ksize(), though, just to reinforce that it's
not supposed to be used "normally". What do you think?
--
Kees Cook
Powered by blists - more mailing lists