Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kcsan: Enable context analysis

Enable context analysis for the KCSAN subsystem.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251219154418.3592607-31-elver@google.com

authored by

Marco Elver and committed by
Peter Zijlstra
0eaa911f 6556fde2

+10 -3
+2
kernel/kcsan/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + CONTEXT_ANALYSIS := y 3 + 2 4 KCSAN_SANITIZE := n 3 5 KCOV_INSTRUMENT := n 4 6 UBSAN_SANITIZE := n
+8 -3
kernel/kcsan/report.c
··· 116 116 * been reported since (now - KCSAN_REPORT_ONCE_IN_MS). 117 117 */ 118 118 static bool rate_limit_report(unsigned long frame1, unsigned long frame2) 119 + __must_hold(&report_lock) 119 120 { 120 121 struct report_time *use_entry = &report_times[0]; 121 122 unsigned long invalid_before; ··· 367 366 368 367 static void 369 368 print_stack_trace(unsigned long stack_entries[], int num_entries, unsigned long reordered_to) 369 + __must_hold(&report_lock) 370 370 { 371 371 stack_trace_print(stack_entries, num_entries, 0); 372 372 if (reordered_to) ··· 375 373 } 376 374 377 375 static void print_verbose_info(struct task_struct *task) 376 + __must_hold(&report_lock) 378 377 { 379 378 if (!task) 380 379 return; ··· 392 389 const struct access_info *ai, 393 390 struct other_info *other_info, 394 391 u64 old, u64 new, u64 mask) 392 + __must_hold(&report_lock) 395 393 { 396 394 unsigned long reordered_to = 0; 397 395 unsigned long stack_entries[NUM_STACK_ENTRIES] = { 0 }; ··· 500 496 } 501 497 502 498 static void release_report(unsigned long *flags, struct other_info *other_info) 499 + __releases(&report_lock) 503 500 { 504 501 /* 505 502 * Use size to denote valid/invalid, since KCSAN entirely ignores ··· 512 507 513 508 /* 514 509 * Sets @other_info->task and awaits consumption of @other_info. 515 - * 516 - * Precondition: report_lock is held. 517 - * Postcondition: report_lock is held. 518 510 */ 519 511 static void set_other_info_task_blocking(unsigned long *flags, 520 512 const struct access_info *ai, 521 513 struct other_info *other_info) 514 + __must_hold(&report_lock) 522 515 { 523 516 /* 524 517 * We may be instrumenting a code-path where current->state is already ··· 575 572 static void prepare_report_producer(unsigned long *flags, 576 573 const struct access_info *ai, 577 574 struct other_info *other_info) 575 + __must_not_hold(&report_lock) 578 576 { 579 577 raw_spin_lock_irqsave(&report_lock, *flags); 580 578 ··· 607 603 static bool prepare_report_consumer(unsigned long *flags, 608 604 const struct access_info *ai, 609 605 struct other_info *other_info) 606 + __cond_acquires(true, &report_lock) 610 607 { 611 608 612 609 raw_spin_lock_irqsave(&report_lock, *flags);