fortify: Split reporting and avoid passing string pointer
authorKees Cook <keescook@chromium.org>
Fri, 7 Apr 2023 19:27:13 +0000 (12:27 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 29 Feb 2024 21:38:02 +0000 (13:38 -0800)
commit475ddf1fce1ec4826c8dda40ec59f7f83a7aadb8
treee9c16bb1b04f47c6fbeb51e532a6271dd1ebb05c
parent99db710f768e988e70f1164537bf533a017be24d
fortify: Split reporting and avoid passing string pointer

In preparation for KUnit testing and further improvements in fortify
failure reporting, split out the report and encode the function and access
failure (read or write overflow) into a single u8 argument. This mainly
ends up saving a tiny bit of space in the data segment. For a defconfig
with FORTIFY_SOURCE enabled:

$ size gcc/vmlinux.before gcc/vmlinux.after
   text     data     bss     dec         hex filename
26132309        9760658 2195460 38088427        2452eeb gcc/vmlinux.before
26132386        9748382 2195460 38076228        244ff44 gcc/vmlinux.after

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
arch/arm/boot/compressed/misc.c
arch/arm/boot/compressed/misc.h
arch/x86/boot/compressed/misc.c
include/linux/fortify-string.h
lib/string_helpers.c
tools/objtool/noreturns.h