[moderation] [trace?] KCSAN: data-race in bpf_prog_run_clear_cb / tracing_gen_ctx_irq_test

0 views
Skip to first unread message

syzbot

unread,
7:00 PM (1 hour ago) 7:00 PM
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 666539eecdf4 Merge tag 'assoc-array-fixes-v2'
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=172343a1580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
dashboard link: https://syzkaller.appspot.com/bug?extid=a6f6c19c5a5b62f4363a
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [da...@davemloft.net edum...@kernel.org ho...@kernel.org ku...@kernel.org linux-...@vger.kernel.org linux-tra...@vger.kernel.org net...@vger.kernel.org pab...@redhat.com willemdebr...@gmail.com]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a943b9915869/disk-666539ee.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9bfd839d7ea5/vmlinux-666539ee.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0f20b9720a71/bzImage-666539ee.xz

AI-generated root cause summary:
A data race occurs on the 2-byte field task_struct::migration_disabled between
an unmarked plain read in the tracing subsystem and an unmarked plain write in
migrate_disable(). While a task running on CPU 1 executes
tracing_gen_ctx_irq_test() with interrupts enabled, migration_disable_value()
performs an unannotated read of current->migration_disabled. Concurrently on the
same CPU, an APIC timer interrupt invokes softirq packet processing that
executes a BPF socket filter, calling bpf_prog_run_pin_on_cpu() and inlined
__migrate_disable(), which performs an unannotated write to the interrupted
task's migration_disabled field. Because kernel/sched/Makefile disables KCSAN
for sched core files, the race was exposed through the inlined definition of
__migrate_disable() in include/linux/sched.h and the unannotated access in
kernel/trace/trace.c.

full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=a6f6c19c5a5b62f4363a

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a6f6c1...@syzkaller.appspotmail.com

==================================================================
BUG: KCSAN: data-race in bpf_prog_run_clear_cb / tracing_gen_ctx_irq_test

write to 0xffff8881035bc978 of 2 bytes by interrupt on cpu 1:
__migrate_disable include/linux/sched.h:2496 [inline]
migrate_disable include/linux/sched.h:2512 [inline]
bpf_prog_run_pin_on_cpu include/linux/filter.h:836 [inline]
bpf_prog_run_clear_cb+0xb3/0x290 include/linux/filter.h:1119
run_filter net/packet/af_packet.c:2111 [inline]
packet_rcv+0x26e/0xba0 net/packet/af_packet.c:2184
dev_queue_xmit_nit+0x4c4/0x510 net/core/dev.c:2678
xmit_one net/core/dev.c:4064 [inline]
dev_hard_start_xmit+0xb5/0x3d0 net/core/dev.c:4084
sch_direct_xmit+0x1c4/0x360 net/sched/sch_generic.c:411
__dev_xmit_skb net/core/dev.c:4419 [inline]
__dev_queue_xmit+0xe7d/0x2020 net/core/dev.c:5058
dev_queue_xmit include/linux/netdevice.h:3485 [inline]
neigh_hh_output include/net/neighbour.h:538 [inline]
neigh_output include/net/neighbour.h:552 [inline]
ip_finish_output2+0x845/0x920 net/ipv4/ip_output.c:236
__ip_finish_output net/ipv4/ip_output.c:-1 [inline]
ip_finish_output+0x112/0x290 net/ipv4/ip_output.c:324
NF_HOOK_COND include/linux/netfilter.h:314 [inline]
ip_output+0xbd/0x1c0 net/ipv4/ip_output.c:437
dst_output include/net/dst.h:472 [inline]
ip_local_out net/ipv4/ip_output.c:131 [inline]
__ip_queue_xmit+0xbf3/0xc30 net/ipv4/ip_output.c:533
ip_queue_xmit+0x39/0x50 net/ipv4/ip_output.c:547
__tcp_transmit_skb+0x1cad/0x2110 net/ipv4/tcp_output.c:1773
__tcp_send_ack+0x288/0x3b0 net/ipv4/tcp_output.c:4577
tcp_send_ack+0x29/0x30 net/ipv4/tcp_output.c:4583
tcp_delack_timer_handler+0x238/0x270 net/ipv4/tcp_timer.c:347
tcp_delack_timer+0x11d/0x230 net/ipv4/tcp_timer.c:378
call_timer_fn+0x36/0x280 kernel/time/timer.c:1749
expire_timers kernel/time/timer.c:1800 [inline]
__run_timers kernel/time/timer.c:2375 [inline]
__run_timer_base+0x40c/0x610 kernel/time/timer.c:2387
run_timer_base kernel/time/timer.c:2396 [inline]
run_timer_softirq+0x31/0x70 kernel/time/timer.c:2406
handle_softirqs+0x109/0x310 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x40/0xf0 kernel/softirq.c:786
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0x74/0x80 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
rdtsc_ordered arch/x86/include/asm/tsc.h:57 [inline]
delay_tsc+0x5b/0xa0 arch/x86/lib/delay.c:70
udelay include/asm-generic/delay.h:64 [inline]
delay_access kernel/kcsan/core.c:332 [inline]
kcsan_setup_watchpoint+0x255/0x3f0 kernel/kcsan/core.c:622
migration_disable_value kernel/trace/trace.c:1718 [inline]
tracing_gen_ctx_irq_test+0xdd/0x110 kernel/trace/trace.c:1747
tracing_gen_ctx_flags include/linux/trace_events.h:204 [inline]
tracing_gen_ctx include/linux/trace_events.h:211 [inline]
tracing_gen_ctx_dec include/linux/trace_events.h:218 [inline]
trace_event_buffer_reserve+0xe4/0x180 kernel/trace/trace_events.c:720
do_trace_event_raw_event_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_event_raw_event_sys_exit+0x60/0xf0 include/trace/events/syscalls.h:44
__do_trace_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_syscall_exit+0xc2/0x120 kernel/entry/syscall-common.c:18
syscall_exit_work include/linux/entry-common.h:269 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:304 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:341 [inline]
do_syscall_64+0x361/0x3a0 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff8881035bc978 of 2 bytes by task 7698 on cpu 1:
migration_disable_value kernel/trace/trace.c:1718 [inline]
tracing_gen_ctx_irq_test+0xdd/0x110 kernel/trace/trace.c:1747
tracing_gen_ctx_flags include/linux/trace_events.h:204 [inline]
tracing_gen_ctx include/linux/trace_events.h:211 [inline]
tracing_gen_ctx_dec include/linux/trace_events.h:218 [inline]
trace_event_buffer_reserve+0xe4/0x180 kernel/trace/trace_events.c:720
do_trace_event_raw_event_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_event_raw_event_sys_exit+0x60/0xf0 include/trace/events/syscalls.h:44
__do_trace_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_sys_exit include/trace/events/syscalls.h:44 [inline]
trace_syscall_exit+0xc2/0x120 kernel/entry/syscall-common.c:18
syscall_exit_work include/linux/entry-common.h:269 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:304 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:341 [inline]
do_syscall_64+0x361/0x3a0 arch/x86/entry/syscall_64.c:107
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 7698 Comm: dhcpcd-run-hook Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages