summaryrefslogtreecommitdiffstats
path: root/lib/Makefile
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2023-04-07 21:27:15 +0200
committerKees Cook <keescook@chromium.org>2024-02-29 22:38:02 +0100
commitfa4a3f86d4982b603865ccb97dde82f0ae1e3302 (patch)
treee300b82305372177203a92531c0190864c4d34f6 /lib/Makefile
parentfortify: Provide KUnit counters for failure testing (diff)
downloadlinux-fa4a3f86d4982b603865ccb97dde82f0ae1e3302.tar.xz
linux-fa4a3f86d4982b603865ccb97dde82f0ae1e3302.zip
fortify: Add KUnit tests for runtime overflows
With fortify overflows able to be redirected, we can use KUnit to exercise the overflow conditions. Add tests for every API covered by CONFIG_FORTIFY_SOURCE, except for memset() and memcpy(), which are special-cased for now. Disable warnings in the Makefile since we're explicitly testing known-bad string handling code patterns. Note that this makes the LKDTM FORTIFY_STR* tests obsolete, but those can be removed separately. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
index bc36a5c167db..eae87c41b22b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -402,6 +402,8 @@ obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o
CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable)
obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o
CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced)
+CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread)
+CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation)
CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN)
obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o
obj-$(CONFIG_STRCAT_KUNIT_TEST) += strcat_kunit.o