Commit cdb9b07d authored by Marco Elver's avatar Marco Elver Committed by Paul E. McKenney

kcsan: Make reporting aware of KCSAN tests

Reporting hides KCSAN runtime functions in the stack trace, with
filtering done based on function names. Currently this included all
functions (or modules) that would match "kcsan_". Make the filter aware
of KCSAN tests, which contain "kcsan_test", and are no longer skipped in
the report.

This is in preparation for adding a KCSAN test module.
Signed-off-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent f770ed10
...@@ -262,16 +262,32 @@ static const char *get_thread_desc(int task_id) ...@@ -262,16 +262,32 @@ static const char *get_thread_desc(int task_id)
static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries) static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries)
{ {
char buf[64]; char buf[64];
int len; char *cur;
int skip = 0; int len, skip;
for (; skip < num_entries; ++skip) { for (skip = 0; skip < num_entries; ++skip) {
len = scnprintf(buf, sizeof(buf), "%ps", (void *)stack_entries[skip]); len = scnprintf(buf, sizeof(buf), "%ps", (void *)stack_entries[skip]);
if (!strnstr(buf, "csan_", len) &&
!strnstr(buf, "tsan_", len) && /* Never show tsan_* or {read,write}_once_size. */
!strnstr(buf, "_once_size", len)) if (strnstr(buf, "tsan_", len) ||
strnstr(buf, "_once_size", len))
continue;
cur = strnstr(buf, "kcsan_", len);
if (cur) {
cur += sizeof("kcsan_") - 1;
if (strncmp(cur, "test", sizeof("test") - 1))
continue; /* KCSAN runtime function. */
/* KCSAN related test. */
}
/*
* No match for runtime functions -- @skip entries to skip to
* get to first frame of interest.
*/
break; break;
} }
return skip; return skip;
} }
......
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