syzbot


KCSAN: data-race in key_garbage_collector / key_gc_timer_func

Status: moderation: reported on 2024/05/19 06:19
Subsystems: keyrings lsm
[Documentation on labels]
Reported-by: syzbot+50734439fade48eabef6@syzkaller.appspotmail.com
First crash: 26d, last: 26d

Sample crash report:
==================================================================
BUG: KCSAN: data-race in key_garbage_collector / key_gc_timer_func

write to 0xffffffff861dddd0 of 8 bytes by interrupt on cpu 0:
 key_gc_timer_func+0x15/0x60 security/keys/gc.c:98
 call_timer_fn+0x3a/0x300 kernel/time/timer.c:1792
 expire_timers kernel/time/timer.c:1843 [inline]
 __run_timers kernel/time/timer.c:2417 [inline]
 __run_timer_base+0x417/0x640 kernel/time/timer.c:2428
 run_timer_base kernel/time/timer.c:2437 [inline]
 run_timer_softirq+0x31/0x70 kernel/time/timer.c:2447
 handle_softirqs+0xc8/0x290 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu kernel/softirq.c:637 [inline]
 irq_exit_rcu+0x3e/0x90 kernel/softirq.c:649
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
 sysvec_apic_timer_interrupt+0x73/0x80 arch/x86/kernel/apic/apic.c:1043
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
 kcsan_setup_watchpoint+0x404/0x410 kernel/kcsan/core.c:705
 native_save_fl arch/x86/include/asm/irqflags.h:32 [inline]
 arch_local_save_flags arch/x86/include/asm/irqflags.h:67 [inline]
 arch_local_irq_save arch/x86/include/asm/irqflags.h:103 [inline]
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
 _raw_spin_lock_irqsave+0x3c/0xb0 kernel/locking/spinlock.c:162
 prepare_to_wait_exclusive+0x23/0xb0 kernel/sched/wait.c:250
 io_cqring_wait io_uring/io_uring.c:2491 [inline]
 __do_sys_io_uring_enter io_uring/io_uring.c:3291 [inline]
 __se_sys_io_uring_enter+0xe25/0x15a0 io_uring/io_uring.c:3183
 __x64_sys_io_uring_enter+0x78/0x90 io_uring/io_uring.c:3183
 x64_sys_call+0x263/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:427
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffffffff861dddd0 of 8 bytes by task 13015 on cpu 1:
 key_schedule_gc security/keys/gc.c:61 [inline]
 key_garbage_collector+0x6ab/0x900 security/keys/gc.c:284
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0x483/0x9a0 kernel/workqueue.c:3312
 worker_thread+0x526/0x730 kernel/workqueue.c:3393
 kthread+0x1d1/0x210 kernel/kthread.c:389
 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: 0x000000006649999f -> 0x7fffffffffffffff

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 13015 Comm: kworker/1:7 Not tainted 6.9.0-syzkaller-08995-g0450d2083be6 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: events key_garbage_collector
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/19 06:18 upstream 0450d2083be6 c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in key_garbage_collector / key_gc_timer_func
* Struck through repros no longer work on HEAD.