Skip to content

Commit d627c53

Browse files
melverpaulmckrcu
authored andcommitted
kcsan: Support reporting scoped read-write access type
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]>
1 parent 6c65eb7 commit d627c53

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

kernel/kcsan/kcsan_test.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,12 @@ static bool report_matches(const struct expect_report *r)
210210
"read-write" :
211211
"write") :
212212
"read");
213+
const bool is_atomic = (ty & KCSAN_ACCESS_ATOMIC);
214+
const bool is_scoped = (ty & KCSAN_ACCESS_SCOPED);
213215
const char *const access_type_aux =
214-
(ty & KCSAN_ACCESS_ATOMIC) ?
215-
" (marked)" :
216-
((ty & KCSAN_ACCESS_SCOPED) ? " (scoped)" : "");
216+
(is_atomic && is_scoped) ? " (marked, scoped)"
217+
: (is_atomic ? " (marked)"
218+
: (is_scoped ? " (scoped)" : ""));
217219

218220
if (i == 1) {
219221
/* Access 2 */

kernel/kcsan/report.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ static const char *get_access_type(int type)
247247
return "write (scoped)";
248248
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
249249
return "write (marked, scoped)";
250+
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE:
251+
return "read-write (scoped)";
252+
case KCSAN_ACCESS_SCOPED | KCSAN_ACCESS_COMPOUND | KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC:
253+
return "read-write (marked, scoped)";
250254
default:
251255
BUG();
252256
}

0 commit comments

Comments
 (0)