diff options
author | Andrey Konovalov <andreyknvl@google.com> | 2021-01-26 20:31:27 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2021-01-26 20:31:27 +1100 |
commit | aa4e875234078f5fd408bea6a3242e5fa5a58328 (patch) | |
tree | 6ee9e8d9cab2f9eb86233d5f3d4e750379054052 /lib/test_kasan.c | |
parent | 9a6db3bc4e3faf3c6c1f70a502642a6da500e52a (diff) | |
download | linux-next-aa4e875234078f5fd408bea6a3242e5fa5a58328.tar.gz |
kasan: don't run tests when KASAN is not enabled
Don't run KASAN tests when it's disabled with kasan.mode=off to avoid
corrupting kernel memory.
Link: https://linux-review.googlesource.com/id/I6447af436a69a94bfc35477f6bf4e2122948355e
Link: https://lkml.kernel.org/r/25bd4fb5cae7b421d806a1f33fb633edd313f0c7.1610733117.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Branislav Rankov <Branislav.Rankov@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'lib/test_kasan.c')
-rw-r--r-- | lib/test_kasan.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 4ba7461210fd..d16ec9e66806 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -47,6 +47,11 @@ static bool multishot; */ static int kasan_test_init(struct kunit *test) { + if (!kasan_enabled()) { + kunit_err(test, "can't run KASAN tests with KASAN disabled"); + return -1; + } + multishot = kasan_save_enable_multi_shot(); hw_set_tagging_report_once(false); return 0; |