Andrey Konovalov 99734b535d kasan: detect false-positives in tests
Currently, KASAN-KUnit tests can check that a particular annotated part of
code causes a KASAN report.  However, they do not check that no unwanted
reports happen between the annotated parts.

This patch implements these checks.

It is done by setting report_data.report_found to false in
kasan_test_init() and at the end of KUNIT_EXPECT_KASAN_FAIL() and then
checking that it remains false at the beginning of
KUNIT_EXPECT_KASAN_FAIL() and in kasan_test_exit().

kunit_add_named_resource() call is moved to kasan_test_init(), and the
value of fail_data.report_expected is kept as false in between
KUNIT_EXPECT_KASAN_FAIL() annotations for consistency.

Link: https://lkml.kernel.org/r/48079c52cc329fbc52f4386996598d58022fb872.1617207873.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-04-30 11:20:42 -07:00
..
2020-08-09 14:10:26 -07:00
2021-04-29 11:28:08 -07:00
2020-10-30 17:34:45 +11:00
2021-04-14 16:30:30 +03:00
2020-05-24 20:48:11 +02:00
2018-08-16 12:14:42 -07:00
2021-02-08 12:24:26 +01:00
2021-01-21 14:06:00 -07:00
2021-01-03 20:05:18 -05:00
2020-10-20 14:39:37 -07:00
2021-04-14 16:30:30 +03:00
2021-04-30 11:20:36 -07:00
2021-02-26 09:41:02 -08:00
2021-02-26 09:41:05 -08:00
2021-04-14 16:30:30 +03:00
2018-10-16 13:45:44 +02:00
2021-02-03 19:10:42 +01:00
2020-06-15 18:22:43 -07:00
2019-07-11 15:17:41 -07:00
2020-12-15 22:46:16 -08:00
2018-10-15 16:31:29 -04:00
2020-12-15 22:46:16 -08:00
2021-04-28 10:01:40 -07:00
2021-02-26 09:41:05 -08:00
2021-02-26 09:41:05 -08:00
2021-04-28 10:01:40 -07:00