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

0 views
Skip to first unread message

syzbot

unread,
7:07 PM (1 hour ago) 7:07 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=12947bed580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
dashboard link: https://syzkaller.appspot.com/bug?extid=37663b1c84b88e64544a
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [linux-...@vger.kernel.org linux-tra...@vger.kernel.org mathieu....@efficios.com mhir...@kernel.org ros...@goodmis.org]

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 between task context and an interrupt on the same CPU when
tracing_gen_ctx_irq_test() reads 'current->migration_disabled' via
migration_disable_value() in kernel/trace/trace.c while migrate_disable() or
migrate_enable() updates 'p->migration_disabled' in include/linux/sched.h. The
task modifies 'p->migration_disabled' using plain C read/write operations
without disabling hardware interrupts, and migration_disable_value() reads the
field with a plain memory access without READ_ONCE() or data_race(). When a
timer interrupt fires on the same CPU while the task is updating the counter and
executes a tracing event (e.g., bpf_trace_printk), KCSAN detects concurrent
unmarked memory accesses to 'current->migration_disabled'.

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

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

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

read to 0xffff888103b1ebf8 of 2 bytes by interrupt 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_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
trace_event_raw_event_bpf_trace_printk+0x9d/0x190 kernel/trace/bpf_trace.h:11
__do_trace_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
trace_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
____bpf_trace_printk kernel/trace/bpf_trace.c:409 [inline]
bpf_trace_printk+0x1b9/0x1e0 kernel/trace/bpf_trace.c:392
bpf_prog_484c593dea3d67e5+0x3b/0x41
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_overflow_handler kernel/events/core.c:10822 [inline]
__perf_event_overflow+0x331/0x950 kernel/events/core.c:10921
perf_event_overflow kernel/events/core.c:11004 [inline]
perf_swevent_hrtimer+0x293/0x320 kernel/events/core.c:12424
__run_hrtimer kernel/time/hrtimer.c:2079 [inline]
__hrtimer_run_queues+0x1f8/0x540 kernel/time/hrtimer.c:2136
hrtimer_interrupt+0x27b/0x870 kernel/time/hrtimer.c:2255
local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1051 [inline]
__sysvec_apic_timer_interrupt+0x5f/0x1f0 arch/x86/kernel/apic/apic.c:1068
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0x6f/0x80 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
native_pause arch/x86/include/asm/vdso/processor.h:13 [inline]
delay_tsc+0x43/0xa0 arch/x86/lib/delay.c:76
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
__migrate_enable include/linux/sched.h:2458 [inline]
migrate_enable include/linux/sched.h:2517 [inline]
bpf_sk_lookup_run_v4 include/linux/filter.h:1894 [inline]
inet_lookup_run_sk_lookup+0x3a7/0x5f0 net/ipv4/inet_hashtables.c:453
__udp4_lib_lookup+0x883/0x8c0 net/ipv4/udp.c:707
sk_lookup+0x188/0x2d0 net/core/filter.c:7309
__bpf_skc_lookup+0x1c2/0x2e0 net/core/filter.c:7367
__bpf_sk_lookup net/core/filter.c:7407 [inline]
____bpf_tc_sk_lookup_udp net/core/filter.c:7557 [inline]
bpf_tc_sk_lookup_udp+0x9d/0xe0 net/core/filter.c:7550
bpf_prog_95065b2cf55c0447+0x39/0x4c
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_test_run+0x29b/0x620 net/bpf/test_run.c:422
bpf_prog_test_run_skb+0xaa1/0x11d0 net/bpf/test_run.c:1226
bpf_prog_test_run+0x21b/0x360 kernel/bpf/syscall.c:4860
__sys_bpf+0x914/0xc50 kernel/bpf/syscall.c:6478
__do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
__x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

write to 0xffff888103b1ebf8 of 2 bytes by task 3551 on cpu 1:
__migrate_enable include/linux/sched.h:2458 [inline]
migrate_enable include/linux/sched.h:2517 [inline]
bpf_sk_lookup_run_v4 include/linux/filter.h:1894 [inline]
inet_lookup_run_sk_lookup+0x3a7/0x5f0 net/ipv4/inet_hashtables.c:453
__udp4_lib_lookup+0x883/0x8c0 net/ipv4/udp.c:707
sk_lookup+0x188/0x2d0 net/core/filter.c:7309
__bpf_skc_lookup+0x1c2/0x2e0 net/core/filter.c:7367
__bpf_sk_lookup net/core/filter.c:7407 [inline]
____bpf_tc_sk_lookup_udp net/core/filter.c:7557 [inline]
bpf_tc_sk_lookup_udp+0x9d/0xe0 net/core/filter.c:7550
bpf_prog_95065b2cf55c0447+0x39/0x4c
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_test_run+0x29b/0x620 net/bpf/test_run.c:422
bpf_prog_test_run_skb+0xaa1/0x11d0 net/bpf/test_run.c:1226
bpf_prog_test_run+0x21b/0x360 kernel/bpf/syscall.c:4860
__sys_bpf+0x914/0xc50 kernel/bpf/syscall.c:6478
__do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
__x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 3551 Comm: syz.0.14 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
==================================================================
BUG: KCSAN: data-race in inet_lookup_run_sk_lookup / tracing_gen_ctx_irq_test

read to 0xffff888103b1ebf8 of 2 bytes by interrupt 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_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
trace_event_raw_event_bpf_trace_printk+0x9d/0x190 kernel/trace/bpf_trace.h:11
__do_trace_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
trace_bpf_trace_printk kernel/trace/bpf_trace.h:11 [inline]
____bpf_trace_printk kernel/trace/bpf_trace.c:409 [inline]
bpf_trace_printk+0x1b9/0x1e0 kernel/trace/bpf_trace.c:392
bpf_prog_484c593dea3d67e5+0x3b/0x41
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_overflow_handler kernel/events/core.c:10822 [inline]
__perf_event_overflow+0x331/0x950 kernel/events/core.c:10921
perf_event_overflow kernel/events/core.c:11004 [inline]
perf_swevent_hrtimer+0x293/0x320 kernel/events/core.c:12424
__run_hrtimer kernel/time/hrtimer.c:2079 [inline]
__hrtimer_run_queues+0x1f8/0x540 kernel/time/hrtimer.c:2136
hrtimer_interrupt+0x27b/0x870 kernel/time/hrtimer.c:2255
local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1051 [inline]
__sysvec_apic_timer_interrupt+0x5f/0x1f0 arch/x86/kernel/apic/apic.c:1068
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0x6f/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
__migrate_disable include/linux/sched.h:2490 [inline]
migrate_disable include/linux/sched.h:2512 [inline]
bpf_sk_lookup_run_v4 include/linux/filter.h:1894 [inline]
inet_lookup_run_sk_lookup+0x14a/0x5f0 net/ipv4/inet_hashtables.c:453
__udp4_lib_lookup+0x883/0x8c0 net/ipv4/udp.c:707
sk_lookup+0x188/0x2d0 net/core/filter.c:7309
__bpf_skc_lookup+0x1c2/0x2e0 net/core/filter.c:7367
__bpf_sk_lookup net/core/filter.c:7407 [inline]
____bpf_tc_sk_lookup_udp net/core/filter.c:7557 [inline]
bpf_tc_sk_lookup_udp+0x9d/0xe0 net/core/filter.c:7550
bpf_prog_95065b2cf55c0447+0x39/0x4c
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_test_run+0x29b/0x620 net/bpf/test_run.c:422
bpf_prog_test_run_skb+0xaa1/0x11d0 net/bpf/test_run.c:1226
bpf_prog_test_run+0x21b/0x360 kernel/bpf/syscall.c:4860
__sys_bpf+0x914/0xc50 kernel/bpf/syscall.c:6478
__do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
__x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

write to 0xffff888103b1ebf8 of 2 bytes by task 3551 on cpu 1:
__migrate_disable include/linux/sched.h:2490 [inline]
migrate_disable include/linux/sched.h:2512 [inline]
bpf_sk_lookup_run_v4 include/linux/filter.h:1894 [inline]
inet_lookup_run_sk_lookup+0x14a/0x5f0 net/ipv4/inet_hashtables.c:453
__udp4_lib_lookup+0x883/0x8c0 net/ipv4/udp.c:707
sk_lookup+0x188/0x2d0 net/core/filter.c:7309
__bpf_skc_lookup+0x1c2/0x2e0 net/core/filter.c:7367
__bpf_sk_lookup net/core/filter.c:7407 [inline]
____bpf_tc_sk_lookup_udp net/core/filter.c:7557 [inline]
bpf_tc_sk_lookup_udp+0x9d/0xe0 net/core/filter.c:7550
bpf_prog_95065b2cf55c0447+0x39/0x4c
bpf_dispatcher_nop_func include/linux/bpf.h:1547 [inline]
__bpf_prog_run include/linux/filter.h:813 [inline]
bpf_prog_run include/linux/filter.h:820 [inline]
bpf_test_run+0x29b/0x620 net/bpf/test_run.c:422
bpf_prog_test_run_skb+0xaa1/0x11d0 net/bpf/test_run.c:1226
bpf_prog_test_run+0x21b/0x360 kernel/bpf/syscall.c:4860
__sys_bpf+0x914/0xc50 kernel/bpf/syscall.c:6478
__do_sys_bpf kernel/bpf/syscall.c:6582 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6579 [inline]
__x64_sys_bpf+0x69/0x80 kernel/bpf/syscall.c:6579
x64_sys_call+0xf26/0x2550 arch/x86/include/generated/asm/syscalls_64.h:322
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 3551 Comm: syz.0.14 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================
syz.0.14 (3551) used greatest stack depth: 11024 bytes left


---
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