Skip to content

kcsan: Add support for reporting observed value changes

Marco Elver lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9kcsan: Simplify value change detectionkernel/kcsan/core.c+16 -240 replies
2/9kcsan: Distinguish kcsan_report() callskernel/kcsan/core.c kernel/kcsan/kcsan.h kernel/kcsan/report.c+33 -150 replies
3/9kcsan: Refactor passing watchpoint/other_infokernel/kcsan/report.c+4 -90 replies
4/9kcsan: Fold panic() call into print_report()kernel/kcsan/report.c+8 -130 replies
5/9kcsan: Refactor access_info initializationkernel/kcsan/report.c+25 -170 replies
6/9kcsan: Remove reporting indirectionkernel/kcsan/report.c+49 -660 replies
7/9kcsan: Remove kcsan_report_typekernel/kcsan/kcsan.h kernel/kcsan/report.c+20 -420 replies
8/9kcsan: Report observed value changeskernel/kcsan/core.c kernel/kcsan/kcsan.h kernel/kcsan/report.c+33 -90 replies
9/9kcsan: Document "value changed" lineDocumentation/dev-tools/kcsan.rst+35 -530 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMark Rutland
SeriesA-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] kcsan: Add support for reporting observed value changes

This series adds support for showing observed value changes in reports. Several clean up and refactors of KCSAN reporting code are done as a pre-requisite. An example of the new KCSAN reports:

	==================================================================
	BUG: KCSAN: data-race in test_kernel_read / test_kernel_write

	write to 0xffffffffc009a628 of 8 bytes by task 487 on cpu 0:
	 test_kernel_write+0x1d/0x30
	 access_thread+0x89/0xd0
	 kthread+0x23e/0x260
	 ret_from_fork+0x22/0x30

	read to 0xffffffffc009a628 of 8 bytes by task 488 on cpu 6:
	 test_kernel_read+0x10/0x20
	 access_thread+0x89/0xd0
	 kthread+0x23e/0x260
	 ret_from_fork+0x22/0x30

	value changed: 0x00000000000009a6 -> 0x00000000000009b2

	Reported by Kernel Concurrency Sanitizer on:
	CPU: 6 PID: 488 Comm: access_thread Not tainted 5.12.0-rc2+ #1
	Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
	==================================================================

On one hand this will help better understand "race of unknown origin" (one stack trace only) reports, but also provides more information to better understand normal data race reports like above where KCSAN also detected a value change.

Changelog
---------

This series was originally prepared courtesy of Mark Rutland in September 2020. Because KCSAN had a few minor changes since the original draft of the series, it required a rebase and re-test. To not be forgotten and get these changes in sooner than later, Mark kindly agreed to me adopting the series and doing the rebase, a few minor tweaks, and finally re-test.

Marco Elver (1):
kcsan: Document "value changed" line

Mark Rutland (8):
kcsan: Simplify value change detection
kcsan: Distinguish kcsan_report() calls
kcsan: Refactor passing watchpoint/other_info
kcsan: Fold panic() call into print_report()
kcsan: Refactor access_info initialization
kcsan: Remove reporting indirection
kcsan: Remove kcsan_report_type
kcsan: Report observed value changes

 Documentation/dev-tools/kcsan.rst |  88 +++++++---------
 kernel/kcsan/core.c               |  53 ++++------
 kernel/kcsan/kcsan.h              |  39 ++++---
 kernel/kcsan/report.c             | 169 ++++++++++++++++--------------
 4 files changed, 162 insertions(+), 187 deletions(-)
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog