aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fortify_kunit.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2023-04-07 19:27:16 +0000
committerKees Cook <[email protected]>2024-02-29 21:38:02 +0000
commit3d965b33e40d973b450cb0212913f039476c16f4 (patch)
tree213bf660d55d66a2a4a273f8394156f30f83410c /lib/fortify_kunit.c
parentfortify: Add KUnit tests for runtime overflows (diff)
downloadkernel-3d965b33e40d973b450cb0212913f039476c16f4.tar.gz
kernel-3d965b33e40d973b450cb0212913f039476c16f4.zip
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/[email protected] Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'lib/fortify_kunit.c')
-rw-r--r--lib/fortify_kunit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/fortify_kunit.c b/lib/fortify_kunit.c
index f0accebeca02..493ec02dd5b3 100644
--- a/lib/fortify_kunit.c
+++ b/lib/fortify_kunit.c
@@ -17,8 +17,8 @@
/* Redefine fortify_panic() to track failures. */
void fortify_add_kunit_error(int write);
-#define fortify_panic(func, write, retfail) do { \
- __fortify_report(FORTIFY_REASON(func, write)); \
+#define fortify_panic(func, write, avail, size, retfail) do { \
+ __fortify_report(FORTIFY_REASON(func, write), avail, size); \
fortify_add_kunit_error(write); \
return (retfail); \
} while (0)