slab: Introduce kmalloc_obj() and family
| From: | Kees Cook <kees-AT-kernel.org> | |
| To: | Vlastimil Babka <vbabka-AT-suse.cz> | |
| Subject: | [PATCH v5 0/4] slab: Introduce kmalloc_obj() and family | |
| Date: | Fri, 21 Nov 2025 17:42:56 -0800 | |
| Message-ID: | <20251122014258.do.018-kees@kernel.org> | |
| Cc: | Kees Cook <kees-AT-kernel.org>, Randy Dunlap <rdunlap-AT-infradead.org>, Miguel Ojeda <ojeda-AT-kernel.org>, Przemek Kitszel <przemyslaw.kitszel-AT-intel.com>, "Gustavo A. R. Silva" <gustavoars-AT-kernel.org>, Linus Torvalds <torvalds-AT-linux-foundation.org>, Matthew Wilcox <willy-AT-infradead.org>, Christoph Lameter <cl-AT-linux.com>, Marco Elver <elver-AT-google.com>, Vegard Nossum <vegard.nossum-AT-oracle.com>, Pekka Enberg <penberg-AT-kernel.org>, David Rientjes <rientjes-AT-google.com>, Joonsoo Kim <iamjoonsoo.kim-AT-lge.com>, Andrew Morton <akpm-AT-linux-foundation.org>, Roman Gushchin <roman.gushchin-AT-linux.dev>, Harry Yoo <harry.yoo-AT-oracle.com>, Bill Wendling <morbo-AT-google.com>, Justin Stitt <justinstitt-AT-google.com>, Jann Horn <jannh-AT-google.com>, Greg Kroah-Hartman <gregkh-AT-linuxfoundation.org>, Sasha Levin <sashal-AT-kernel.org>, linux-mm-AT-kvack.org, Nathan Chancellor <nathan-AT-kernel.org>, Peter Zijlstra <peterz-AT-infradead.org>, Nick Desaulniers <nick.desaulniers+lkml-AT-gmail.com>, Jonathan Corbet <corbet-AT-lwn.net>, Jakub Kicinski <kuba-AT-kernel.org>, Yafang Shao <laoar.shao-AT-gmail.com>, Tony Ambardar <tony.ambardar-AT-gmail.com>, Alexander Lobakin <aleksander.lobakin-AT-intel.com>, Jan Hendrik Farr <kernel-AT-jfarr.cc>, Alexander Potapenko <glider-AT-google.com>, linux-kernel-AT-vger.kernel.org, linux-hardening-AT-vger.kernel.org, linux-doc-AT-vger.kernel.org, llvm-AT-lists.linux.dev | |
| Archive-link: | Article |
Hi, Here's a refresh and update on the kmalloc_obj() API proposal for discussion here and at LPC[1]. Please see patch 2 for the bulk of the details. And note that this is obviously not v6.19 material! :) The tree-wide patch for conversions is here: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linu... Thanks! -Kees [1] https://lpc.events/event/19/contributions/2136/ v5: - switch to using assignment with type as first argument (Linus) - fix various comment, commit log, and kern-docs (Randy, Miguel) - renamed flex_counter internal helpers with "__" prefix (Przemek) v4: https://lore.kernel.org/lkml/20250315025852.it.568-kees@k... v3: https://lore.kernel.org/lkml/20240822231324.make.666-kees... v2: https://lore.kernel.org/lkml/20240807235433.work.317-kees... v1: https://lore.kernel.org/lkml/20240719192744.work.264-kees... Kees Cook (4): compiler_types: Introduce __flex_counter() and family slab: Introduce kmalloc_obj() and family checkpatch: Suggest kmalloc_obj family for sizeof allocations coccinelle: Add kmalloc_objs conversion script scripts/checkpatch.pl | 39 ++++- scripts/coccinelle/api/kmalloc_objs.cocci | 168 +++++++++++++++++++++ Documentation/process/deprecated.rst | 42 ++++++ include/linux/compiler_types.h | 31 ++++ include/linux/overflow.h | 40 +++++ include/linux/slab.h | 172 ++++++++++++++++++++++ 6 files changed, 486 insertions(+), 6 deletions(-) create mode 100644 scripts/coccinelle/api/kmalloc_objs.cocci -- 2.34.1
