Commit 455a35a6 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Kees Cook

lib: add runtime test of check_*_overflow functions

This adds a small module for testing that the check_*_overflow
functions work as expected, whether implemented in C or using gcc
builtins.

Example output:

test_overflow: u8 : 18 tests
test_overflow: s8 : 19 tests
test_overflow: u16: 17 tests
test_overflow: s16: 17 tests
test_overflow: u32: 17 tests
test_overflow: s32: 17 tests
test_overflow: u64: 17 tests
test_overflow: s64: 21 tests
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
[kees: add output to commit log, drop u64 tests on 32-bit]
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent f0907827
...@@ -1785,6 +1785,9 @@ config TEST_BITMAP ...@@ -1785,6 +1785,9 @@ config TEST_BITMAP
config TEST_UUID config TEST_UUID
tristate "Test functions located in the uuid module at runtime" tristate "Test functions located in the uuid module at runtime"
config TEST_OVERFLOW
tristate "Test check_*_overflow() functions at runtime"
config TEST_RHASHTABLE config TEST_RHASHTABLE
tristate "Perform selftest on resizable hash table" tristate "Perform selftest on resizable hash table"
default n default n
......
...@@ -59,6 +59,7 @@ UBSAN_SANITIZE_test_ubsan.o := y ...@@ -59,6 +59,7 @@ UBSAN_SANITIZE_test_ubsan.o := y
obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o
obj-$(CONFIG_TEST_LKM) += test_module.o obj-$(CONFIG_TEST_LKM) += test_module.o
obj-$(CONFIG_TEST_OVERFLOW) += test_overflow.o
obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o
obj-$(CONFIG_TEST_SORT) += test_sort.o obj-$(CONFIG_TEST_SORT) += test_sort.o
obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment