Skip to content

slab: Provide full coverage for __alloc_size attribute

Kees Cook linux-hardening linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 5 repliesIn review
  2. v16 patches 24 repliesSuperseded

Changes in v2 from the cover letter

- drop trace wrapper refactoring -- handled differently now (vbabka)
- drop kunit/fortify test patch since it depends on other changes
- rebase
v1: https://lore.kernel.org/all/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2slab: Clean up SLOB vs kmalloc() definitioninclude/linux/slab.h+12 -41 reply
2/2slab: Remove special-casing of const 0 size allocationsinclude/linux/slab.h+2 -104 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchHyeonggon Yoo
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] slab: Provide full coverage for __alloc_size attribute

Hi,

These patches 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(). The problem was in two halves: the trace wrapper (now fixed in -next), and const-0 special-casing (covered here).

Thanks,

-Kees

v2:
- drop trace wrapper refactoring -- handled differently now (vbabka)
- drop kunit/fortify test patch since it depends on other changes
- rebase
v1: https://lore.kernel.org/all/[email protected]

Kees Cook (2):
slab: Clean up SLOB vs kmalloc() definition
slab: Remove special-casing of const 0 size allocations

 include/linux/slab.h | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.34.1