LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/5] Add __alloc_size() for better bounds checking
@ 2021-08-18  5:08 Kees Cook
  2021-08-18  5:08 ` [PATCH 1/5] Compiler Attributes: " Kees Cook
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Kees Cook @ 2021-08-18  5:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Kees Cook, Andrew Morton, Miguel Ojeda, Nathan Chancellor,
	Nick Desaulniers, Daniel Micay, Christoph Lameter, Pekka Enberg,
	David Rientjes, Joonsoo Kim, Vlastimil Babka, Dennis Zhou,
	Tejun Heo, Masahiro Yamada, Michal Marek, clang-built-linux,
	linux-mm, linux-kbuild, linux-hardening

Hi,

GCC and Clang both use the "alloc_size" attribute to assist with bounds
checking around the use of allocation functions. Add the attribute,
adjust the Makefile to silence needless warnings, and add the hints to
the allocators where possible. These changes have been in use for a
while now in GrapheneOS.

To build without warnings, this series needs a couple small fixes for
allmodconfig, which I sent separately:
https://lore.kernel.org/lkml/20210818044540.1601664-1-keescook@chromium.org/
https://lore.kernel.org/lkml/20210818044252.1533634-1-keescook@chromium.org/
https://lore.kernel.org/lkml/20210818043912.1466447-1-keescook@chromium.org/

I figure I can take this via my "overflow" series, or it could go via
-mm?

-Kees

Kees Cook (5):
  Compiler Attributes: Add __alloc_size() for better bounds checking
  slab: Add __alloc_size attributes for better bounds checking
  mm/page_alloc: Add __alloc_size attributes for better bounds checking
  percpu: Add __alloc_size attributes for better bounds checking
  mm/vmalloc: Add __alloc_size attributes for better bounds checking

 Makefile                            |  6 +++-
 include/linux/compiler_attributes.h |  6 ++++
 include/linux/gfp.h                 |  4 +--
 include/linux/percpu.h              |  6 ++--
 include/linux/slab.h                | 50 ++++++++++++++++++-----------
 include/linux/vmalloc.h             | 22 ++++++-------
 6 files changed, 58 insertions(+), 36 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-08-25 16:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18  5:08 [PATCH 0/5] Add __alloc_size() for better bounds checking Kees Cook
2021-08-18  5:08 ` [PATCH 1/5] Compiler Attributes: " Kees Cook
2021-08-18 13:07   ` Miguel Ojeda
2021-08-18 17:58     ` Kees Cook
2021-08-18 18:04   ` Nathan Chancellor
2021-08-18 21:04     ` Kees Cook
2021-08-18  5:08 ` [PATCH 2/5] slab: Add __alloc_size attributes " Kees Cook
2021-08-18  5:31   ` Joe Perches
2021-08-18  6:16     ` Kees Cook
2021-08-18  6:30       ` Joe Perches
2021-08-19  0:27     ` Matthew Wilcox
2021-08-19  1:10       ` Joe Perches
2021-08-19  2:16         ` Matthew Wilcox
2021-08-19  2:59           ` Joe Perches
2021-08-18  5:08 ` [PATCH 3/5] mm/page_alloc: " Kees Cook
2021-08-18  5:08 ` [PATCH 4/5] percpu: " Kees Cook
2021-08-18  5:08 ` [PATCH 5/5] mm/vmalloc: " Kees Cook
2021-08-19  9:09 ` [PATCH 0/5] Add __alloc_size() " Christoph Hellwig
2021-08-19 14:18   ` Daniel Micay
2021-08-25 10:01     ` Christoph Lameter
2021-08-25 16:34       ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).