Skip to content

Commit

Permalink
kcsan: Support reporting scoped read-write access type
Browse files Browse the repository at this point in the history
Support generating the string representation of scoped read-write
accesses for completeness. They will become required in planned changes.

Signed-off-by: Marco Elver <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
  • Loading branch information
melver authored and paulmckrcu committed Sep 13, 2021
1 parent 6c65eb7 commit d627c53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel/kcsan/kcsan_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ static bool report_matches(const struct expect_report *r)
"read-write" :
"write") :
"read");
const bool is_atomic = (ty & KCSAN_ACCESS_ATOMIC);
const bool is_scoped = (ty & KCSAN_ACCESS_SCOPED);
const char *const access_type_aux =
(ty & KCSAN_ACCESS_ATOMIC) ?
" (marked)" :
((ty & KCSAN_ACCESS_SCOPED) ? " (scoped)" : "");
(is_atomic && is_scoped) ? " (marked, scoped)"
: (is_atomic ? " (marked)"
: (is_scoped ? " (scoped)" : ""));

if (i == 1) {
/* Access 2 */
Expand Down
4 changes: 4 additions & 0 deletions kernel/kcsan/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ static const char *get_access_type(int type)
return "write (scoped)";
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
return "write (marked, scoped)";
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE:
return "read-write (scoped)";
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
return "read-write (marked, scoped)";
default:
BUG();
}
Expand Down

0 comments on commit d627c53

Please sign in to comment.