syzbot


KCSAN: data-race in __perf_event_read_value / perf_event_set_state (3)

Status: moderation: reported on 2024/12/26 15:08
Subsystems: perf
[Documentation on labels]
Reported-by: syzbot+e5ee965be96aeb3bf530@syzkaller.appspotmail.com
First crash: 14h24m, last: 14h22m
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in __perf_event_read_value / perf_event_set_state perf 1 209d 209d 0/28 auto-obsoleted due to no activity on 2024/07/06 04:07
upstream KCSAN: data-race in __perf_event_read_value / perf_event_set_state (2) perf 1 68d 68d 0/28 auto-obsoleted due to no activity on 2024/11/23 12:41

Sample crash report:
==================================================================
BUG: KCSAN: data-race in __perf_event_read_value / perf_event_set_state

write to 0xffff888150734dd0 of 8 bytes by task 23120 on cpu 1:
 perf_event_update_time kernel/events/core.c:675 [inline]
 perf_event_set_state+0x1a1/0x3f0 kernel/events/core.c:694
 event_sched_in+0xe9/0x6d0 kernel/events/core.c:2604
 group_sched_in kernel/events/core.c:2653 [inline]
 merge_sched_in kernel/events/core.c:3924 [inline]
 visit_groups_merge+0xc26/0x1c00 kernel/events/core.c:3869
 pmu_groups_sched_in kernel/events/core.c:3951 [inline]
 __pmu_ctx_sched_in+0xc8/0xf0 kernel/events/core.c:3963
 ctx_sched_in+0x361/0x3b0 kernel/events/core.c:4014
 perf_event_sched_in kernel/events/core.c:2751 [inline]
 perf_event_context_sched_in kernel/events/core.c:4061 [inline]
 __perf_event_task_sched_in+0x56a/0xa10 kernel/events/core.c:4090
 perf_event_task_sched_in include/linux/perf_event.h:1517 [inline]
 finish_task_switch+0x218/0x2b0 kernel/sched/core.c:5238
 context_switch kernel/sched/core.c:5372 [inline]
 __schedule+0x6fa/0x930 kernel/sched/core.c:6756
 preempt_schedule_common kernel/sched/core.c:6935 [inline]
 __cond_resched+0x28/0x50 kernel/sched/core.c:7280
 _cond_resched include/linux/sched.h:2056 [inline]
 io_handle_tw_list+0x180/0x200 io_uring/io_uring.c:1065
 tctx_task_work_run+0x6e/0x1c0 io_uring/io_uring.c:1121
 tctx_task_work+0x40/0x80 io_uring/io_uring.c:1139
 task_work_run+0x13a/0x1a0 kernel/task_work.c:239
 get_signal+0xe78/0x1000 kernel/signal.c:2790
 arch_do_signal_or_restart+0x95/0x4b0 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x62/0x120 kernel/entry/common.c:218
 do_syscall_64+0xd6/0x1c0 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888150734dd0 of 8 bytes by task 23124 on cpu 0:
 __perf_event_read_value+0xba/0x1c0 kernel/events/core.c:5601
 perf_read_one kernel/events/core.c:5756 [inline]
 __perf_read kernel/events/core.c:5809 [inline]
 perf_read+0x174/0x4a0 kernel/events/core.c:5826
 loop_rw_iter+0x237/0x360
 io_iter_do_read io_uring/rw.c:772 [inline]
 __io_read+0xa5a/0xaf0 io_uring/rw.c:869
 io_read+0x1e/0x60 io_uring/rw.c:947
 io_issue_sqe+0x150/0xc10 io_uring/io_uring.c:1740
 io_wq_submit_work+0x3eb/0x540 io_uring/io_uring.c:1849
 io_worker_handle_work+0x486/0x9d0 io_uring/io-wq.c:601
 io_wq_worker+0x286/0x820 io_uring/io-wq.c:655
 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

value changed: 0x00000000062b4ced -> 0x00000000062bf2f9

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 23124 Comm: iou-wrk-23120 Not tainted 6.13.0-rc4-syzkaller-00012-g9b2ffa6148b1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/26 15:09 upstream 9b2ffa6148b1 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __perf_event_read_value / perf_event_set_state
2024/12/26 15:08 upstream 9b2ffa6148b1 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __perf_event_read_value / perf_event_set_state
* Struck through repros no longer work on HEAD.