fortify: Add KUnit tests for runtime overflows
authorKees Cook <keescook@chromium.org>
Fri, 7 Apr 2023 19:27:15 +0000 (12:27 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 29 Feb 2024 21:38:02 +0000 (13:38 -0800)
commitfa4a3f86d4982b603865ccb97dde82f0ae1e3302
treee300b82305372177203a92531c0190864c4d34f6
parent4ce615e798a752d4431fcc52960478906dec2f0e
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>
lib/Makefile
lib/fortify_kunit.c