summaryrefslogtreecommitdiff
path: root/lib/test_kasan.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2017-04-24 22:03:14 -0600
committerJens Axboe <axboe@fb.com>2017-04-24 22:03:14 -0600
commitd9fd363a6cbfae24ffaa00ac6fd3ce8e271acaf1 (patch)
tree9139831824ebe9cf77d1bf836b558ee2061c0483 /lib/test_kasan.c
parenta44f53faf4674d84cba79f7ee574584e18ab8744 (diff)
parent8f9cedc76fc7d9bc916127f8fe1287a249891d40 (diff)
Merge branch 'master' into for-4.12/post-merge
Diffstat (limited to 'lib/test_kasan.c')
-rw-r--r--lib/test_kasan.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index 0b1d3140fbb8..a25c9763fce1 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -20,6 +20,7 @@
#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/module.h>
+#include <linux/kasan.h>
/*
* Note: test functions are marked noinline so that their names appear in
@@ -474,6 +475,12 @@ static noinline void __init use_after_scope_test(void)
static int __init kmalloc_tests_init(void)
{
+ /*
+ * Temporarily enable multi-shot mode. Otherwise, we'd only get a
+ * report for the first case.
+ */
+ bool multishot = kasan_save_enable_multi_shot();
+
kmalloc_oob_right();
kmalloc_oob_left();
kmalloc_node_oob_right();
@@ -499,6 +506,9 @@ static int __init kmalloc_tests_init(void)
ksize_unpoisons_memory();
copy_user_test();
use_after_scope_test();
+
+ kasan_restore_multi_shot(multishot);
+
return -EAGAIN;
}