Thread (16 messages) flat view 16 messages, 1 author, 2021-01-15
DORMANTno replies REVIEWED: 9 (9M)

Revision v4 of 2 in this series; 2 review trailers.

Revisions (2)
  1. v3 [diff vs current]
  2. v4 current

[PATCH v4 15/15] kasan: don't run tests when KASAN is not enabled

From: Andrey Konovalov <hidden>
Date: 2021-01-15 17:55:20
Also in: linux-mm, lkml
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

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
Reviewed-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrey Konovalov <redacted>
---
 lib/test_kasan.c | 5 +++++
 1 file changed, 5 insertions(+)
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;
-- 
2.30.0.284.gd98b1dd5eaa7-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help