Commit 4e397274 authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Andrew Morton

kasan: speed up match_all_mem_tag test for SW_TAGS

Checking all 256 possible tag values in the match_all_mem_tag KASAN test
is slow and produces 256 reports.  Instead, just check the first 8 and the
last 8.

Link: https://lkml.kernel.org/r/6fe51262defd80cdc1150c42404977aafd1b6167.1703188911.git.andreyknvl@google.comSigned-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3ab9304d
......@@ -1797,6 +1797,14 @@ static void match_all_mem_tag(struct kunit *test)
/* For each possible tag value not matching the pointer tag. */
for (tag = KASAN_TAG_MIN; tag <= KASAN_TAG_KERNEL; tag++) {
/*
* For Software Tag-Based KASAN, skip the majority of tag
* values to avoid the test printing too many reports.
*/
if (IS_ENABLED(CONFIG_KASAN_SW_TAGS) &&
tag >= KASAN_TAG_MIN + 8 && tag <= KASAN_TAG_KERNEL - 8)
continue;
if (tag == get_tag(ptr))
continue;
......
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