[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221101222520.never.109-kees@kernel.org>
Date: Tue, 1 Nov 2022 15:33:08 -0700
From: Kees Cook <keescook@...omium.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Kees Cook <keescook@...omium.org>, David Gow <davidgow@...gle.com>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Hyeonggon Yoo <42.hyeyoo@...il.com>,
Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Guenter Roeck <linux@...ck-us.net>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Paolo Abeni <pabeni@...hat.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-hardening@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH 0/6] slab: Provide full coverage for __alloc_size attribute
Hi,
This is a series to work around a deficiency in GCC (>=11) and Clang
(<16) where the __alloc_size attribute does not apply to inlines. :(
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96503
This manifests as reduced overflow detection coverage for many allocation
sites under CONFIG_FORTIFY_SOURCE=y, where the allocation size was
not actually being propagated to __builtin_dynamic_object_size(). In
addition to working around the issue, expand use of __alloc_size (and
__realloc_size) to more places and provide KUnit tests to validate all
the covered allocator APIs.
-Kees
Kees Cook (6):
slab: Clean up SLOB vs kmalloc() definition
slab: Remove special-casing of const 0 size allocations
slab: Provide functional __alloc_size() hints to kmalloc_trace*()
string: Add __realloc_size hint to kmemdup()
driver core: Add __alloc_size hint to devm allocators
kunit/fortify: Validate __alloc_size attribute results
include/linux/device.h | 7 +-
include/linux/fortify-string.h | 2 +-
include/linux/slab.h | 36 ++---
include/linux/string.h | 2 +-
lib/Makefile | 1 +
lib/fortify_kunit.c | 255 +++++++++++++++++++++++++++++++++
mm/slab_common.c | 14 ++
7 files changed, 296 insertions(+), 21 deletions(-)
--
2.34.1
Powered by blists - more mailing lists