Re: [PATCH 5/5] slab: Allocate and use per-call-site caches

2024-09-11 Thread Kees Cook
On Thu, Aug 29, 2024 at 10:03:56AM -0700, Suren Baghdasaryan wrote: > On Fri, Aug 9, 2024 at 12:33 AM Kees Cook wrote: > > > > Use separate per-call-site kmem_cache or kmem_buckets. These are > > allocated on demand to avoid wasting memory for unused caches. > > > > A few caches need to be allocat

Re: [PATCH 4/5] alloc_tag: Track fixed vs dynamic sized kmalloc calls

2024-09-11 Thread Kees Cook
On Thu, Aug 29, 2024 at 09:00:37AM -0700, Suren Baghdasaryan wrote: > On Fri, Aug 9, 2024 at 12:33 AM Kees Cook wrote: > [...] > > -#define kmem_cache_alloc(...) > > alloc_hooks(kmem_cache_alloc_noprof(__VA_ARGS__)) > > +#define kmem_cache_alloc(...) > > alloc_hooks(kme

Re: [PATCH 3/5] codetag: Introduce codetag_early_walk()

2024-09-11 Thread Kees Cook
On Thu, Aug 29, 2024 at 08:39:29AM -0700, Suren Baghdasaryan wrote: > On Fri, Aug 9, 2024 at 12:33 AM Kees Cook wrote: > > > > In order to process builtin alloc_tags much earlier during boot (before > > register_codetag() is processed), provide codetag_early_walk() that > > perform a lockless walk

Re: [PATCH 2/5] codetag: Run module_load hooks for builtin codetags

2024-09-11 Thread Kees Cook
On Thu, Aug 29, 2024 at 08:02:13AM -0700, Suren Baghdasaryan wrote: > On Fri, Aug 9, 2024 at 12:33 AM Kees Cook wrote: > > > > The module_load callback should still run for builtin codetags that > > define it, even in a non-modular kernel. (i.e. for the cmod->mod == NULL > > case). > > > > Signed-

Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2024-09-11 Thread Luis Chamberlain
On Mon, Sep 09, 2024 at 06:27:26PM +0200, Thorsten Blum wrote: > Add the __counted_by compiler attribute to the flexible array member > attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Increment num before adding a new param_attribute to the attrs ar

RE: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-11 Thread David Laight
... > > [1] Both the '+' and '*' have extra code to detect overflow and return > > a 'big' value that will cause kmalloc() to return NULL. > > I've not looked at the generated code but it is likely to be horrid > > (especially the check for multiply overflowing). > > In this case there are enou

RE: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-11 Thread David Laight
From: Vincent Mailhol > Sent: 10 September 2024 03:50 > > If the offsetof() of a given flexible array member (fam) is smaller > than the sizeof() of the containing struct, then the struct_size() > macro reports a size which is too big. > > This occurs when the two conditions below are met: > >

Re: -Wformat-trunctation with `make W=1`

2024-09-11 Thread Arnd Bergmann
On Wed, Sep 11, 2024, at 00:26, Kees Cook wrote: > On Mon, Sep 09, 2024 at 04:26:03PM +0300, Andy Shevchenko wrote: >> Recently I'm trying to compile my (almost) x86_64_defconfig based kernel with >> `make W=1` while having CONFIG_WERROR=y. With a handful of patches I was able >> to achieve that wi