fortify: Improve buffer overflow reporting
authorKees Cook <keescook@chromium.org>
Fri, 7 Apr 2023 19:27:16 +0000 (12:27 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 29 Feb 2024 21:38:02 +0000 (13:38 -0800)
commit3d965b33e40d973b450cb0212913f039476c16f4
tree213bf660d55d66a2a4a273f8394156f30f83410c
parentfa4a3f86d4982b603865ccb97dde82f0ae1e3302
fortify: Improve buffer overflow reporting

Improve the reporting of buffer overflows under CONFIG_FORTIFY_SOURCE to
help accelerate debugging efforts. The calculations are all just sitting
in registers anyway, so pass them along to the function to be reported.

For example, before:

  detected buffer overflow in memcpy

and after:

  memcpy: detected buffer overflow: 4096 byte read of buffer size 1

Link: https://lore.kernel.org/r/20230407192717.636137-10-keescook@chromium.org
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/fortify_kunit.c
lib/string_helpers.c