Kees Cook
73f62e60d8
lkdtm: Move crashtype definitions into each category
...
It's long been annoying that to add a new LKDTM test one had to update
lkdtm.h and core.c to get it "registered". Switch to a per-category
list and update the crashtype walking code in core.c to handle it.
This also means that all the lkdtm_* tests themselves can be static now.
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Kees Cook <keescook@chromium.org >
2022-04-12 16:16:48 -07:00
Kees Cook
f4e335f345
lkdtm/fortify: Swap memcpy() for strncpy()
...
The memcpy() runtime defenses are still not landed, so test with
strncpy() for now.
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com >
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com >
Signed-off-by: Kees Cook <keescook@chromium.org >
Link: https://lore.kernel.org/r/20220216202548.2093883-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-02-25 12:11:01 +01:00
Kees Cook
fe8e353bfd
lkdtm/fortify: Consolidate FORTIFY_SOURCE tests
...
The FORTIFY_SOURCE tests were split between bugs.c and fortify.c. Move
tests into fortify.c, standardize their naming, add CONFIG hints, and
add them to the lkdtm selftests.
Cc: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Kees Cook <keescook@chromium.org >
Link: https://lore.kernel.org/r/20210818174855.2307828-3-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-08-18 22:28:51 +02:00
Kees Cook
5b777131bd
lkdtm: Add CONFIG hints in errors where possible
...
For various failure conditions, try to include some details about where
to look for reasons about the failure.
Signed-off-by: Kees Cook <keescook@chromium.org >
Link: https://lore.kernel.org/r/20210623203936.3151093-8-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-24 15:32:08 +02:00
Francis Laniel
febebaf366
drivers/misc/lkdtm: add new file in LKDTM to test fortified strscpy
...
This new test ensures that fortified strscpy has the same behavior than
vanilla strscpy (e.g. returning -E2BIG when src content is truncated).
Finally, it generates a crash at runtime because there is a write overflow
in destination string.
Link: https://lkml.kernel.org/r/20201122162451.27551-5-laniel_francis@privacyrequired.com
Signed-off-by: Francis Laniel <laniel_francis@privacyrequired.com >
Reviewed-by: Kees Cook <keescook@chromium.org >
Cc: Daniel Axtens <dja@axtens.net >
Cc: Daniel Micay <danielmicay@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-12-15 22:46:16 -08:00