The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [syzbot] [net?] KCSAN: data-race in fq_pie_reset / pie_calculate_probability
@ 2026-11-23 18:14 syzbot
  2026-11-23 18:25 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2026-11-23 18:14 UTC (permalink / raw)
  To: davem, edumazet, horms, jhs, jiri, kuba, linux-kernel, netdev,
	pabeni, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    b6a9fa34ce41 Linux 7.4-rc4
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=118e58e9580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
dashboard link: https://syzkaller.appspot.com/bug?extid=00f5a4ef4bcb8f4d19f1
compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1cd533522ae8/disk-b6a9fa34.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/19d6c1c369e3/vmlinux-b6a9fa34.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dfb541770724/bzImage-b6a9fa34.xz

AI-generated root cause summary:
During qdisc teardown in `dev_shutdown()` -> `qdisc_put()` ->
`__qdisc_destroy()`, `qdisc_reset()` calls `fq_pie_reset()` without holding any
qdisc lock and before `fq_pie_destroy()` stops `q->adapt_timer`. Moreover,
`shutdown_scheduler_queue()` has already replaced `dev_queue->qdisc_sleeping`
with `&noop_qdisc`, so `fq_pie_timer()`'s call to
`qdisc_lock(qdisc_root_sleeping(sch))` acquires `noop_qdisc`'s lock rather than
`sch`'s lock. As a result, `fq_pie_timer()` -> `pie_calculate_probability()`
runs concurrently with `fq_pie_reset()`, racing on `pie_vars_init()` writes to
`flow->vars` (specifically `vars->accu_prob` and `vars->avg_dq_rate`).

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

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

==================================================================
BUG: KCSAN: data-race in fq_pie_reset / pie_calculate_probability

write to 0xffff88811d293640 of 8 bytes by task 13 on cpu 1:
 pie_vars_init include/net/pie.h:103 [inline]
 fq_pie_reset+0x11e/0x1d0 net/sched/sch_fq_pie.c:552
 qdisc_reset+0x51/0x2e0 net/sched/sch_generic.c:1118
 __qdisc_destroy+0x60/0x220 net/sched/sch_generic.c:1157
 qdisc_put net/sched/sch_generic.c:1189 [inline]
 dev_shutdown+0x2e0/0x390 net/sched/sch_generic.c:1558
 unregister_netdevice_many_notify+0x999/0x15e0 net/core/dev.c:12761
 unregister_netdevice_many+0x19/0x20 net/core/dev.c:12845
 ops_exit_rtnl_list net/core/net_namespace.c:188 [inline]
 ops_undo_list+0x21d/0x410 net/core/net_namespace.c:249
 cleanup_net+0x38d/0x5e0 net/core/net_namespace.c:713
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
 worker_thread+0x56c/0x770 kernel/workqueue.c:3659
 kthread+0x248/0x2a0 kernel/kthread.c:436
 ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

write to 0xffff88811d293640 of 8 bytes by interrupt on cpu 0:
 pie_vars_init include/net/pie.h:103 [inline]
 pie_calculate_probability+0x425/0x4c0 net/sched/sch_pie.c:417
 fq_pie_timer+0xf6/0x1d0 net/sched/sch_fq_pie.c:403
 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
 __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:123 [inline]
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
 _raw_spin_unlock_irqrestore+0x1a/0x30 kernel/locking/spinlock.c:221
 free_frozen_page_commit+0x223/0x3a0 mm/page_alloc.c:2909
 free_unref_folios+0x8c0/0x980 mm/page_alloc.c:3099
 folios_put_refs+0x2cd/0x320 mm/folio.c:1065
 folios_put include/linux/mm.h:2429 [inline]
 __folio_batch_release+0x8e/0xb0 mm/folio.c:1125
 folio_batch_release include/linux/folio_batch.h:101 [inline]
 truncate_inode_pages_range+0x287/0x780 mm/truncate.c:452
 truncate_inode_pages mm/truncate.c:530 [inline]
 truncate_inode_pages_final+0x68/0x80 mm/truncate.c:565
 ext4_evict_inode+0x459/0xea0 fs/ext4/inode.c:273
 evict+0x301/0x570 fs/inode.c:829
 iput_final fs/inode.c:2036 [inline]
 iput+0x44f/0x5d0 fs/inode.c:2085
 dentry_unlink_inode+0x29a/0x2b0 fs/dcache.c:510
 dentry_kill+0x135/0x4f0 fs/dcache.c:857
 finish_dput+0x16/0x1d0 fs/dcache.c:1032
 dput+0x43/0x50 fs/dcache.c:1073
 __fput+0x45c/0x660 fs/file_table.c:520
 ____fput+0x1c/0x30 fs/file_table.c:541
 task_work_run+0x145/0x1a0 kernel/task_work.c:233
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0x4a7/0x1530 kernel/exit.c:980
 do_group_exit+0xfe/0x140 kernel/exit.c:1123
 get_signal+0xc49/0xd30 kernel/signal.c:3113
 arch_do_signal_or_restart+0x96/0x480 arch/x86/kernel/signal.c:337
 __exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
 exit_to_user_mode_loop+0x161/0x940 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
 do_syscall_64+0x23b/0x3a0 arch/x86/entry/syscall_64.c:107
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 6734 Comm: syz.1.1114 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 syzkaller@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [syzbot] [net?] KCSAN: data-race in fq_pie_reset / pie_calculate_probability
  2026-11-23 18:14 [syzbot] [net?] KCSAN: data-race in fq_pie_reset / pie_calculate_probability syzbot
@ 2026-11-23 18:25 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2026-11-23 18:25 UTC (permalink / raw)
  To: syzbot, Kyle Zeng
  Cc: davem, horms, jhs, jiri, kuba, linux-kernel, netdev, pabeni,
	syzkaller-bugs

Le lun. 23 nov. 2026 à 19:14, syzbot
<syzbot+00f5a4ef4bcb8f4d19f1@syzkaller.appspotmail.com> a écrit :
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    b6a9fa34ce41 Linux 7.4-rc4
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=118e58e9580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=886d2ddd2d6b664e
> dashboard link: https://syzkaller.appspot.com/bug?extid=00f5a4ef4bcb8f4d19f1
> compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/1cd533522ae8/disk-b6a9fa34.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/19d6c1c369e3/vmlinux-b6a9fa34.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/dfb541770724/bzImage-b6a9fa34.xz
>
> AI-generated root cause summary:
> During qdisc teardown in `dev_shutdown()` -> `qdisc_put()` ->
> `__qdisc_destroy()`, `qdisc_reset()` calls `fq_pie_reset()` without holding any
> qdisc lock and before `fq_pie_destroy()` stops `q->adapt_timer`. Moreover,
> `shutdown_scheduler_queue()` has already replaced `dev_queue->qdisc_sleeping`
> with `&noop_qdisc`, so `fq_pie_timer()`'s call to
> `qdisc_lock(qdisc_root_sleeping(sch))` acquires `noop_qdisc`'s lock rather than
> `sch`'s lock. As a result, `fq_pie_timer()` -> `pie_calculate_probability()`
> runs concurrently with `fq_pie_reset()`, racing on `pie_vars_init()` writes to
> `flow->vars` (specifically `vars->accu_prob` and `vars->avg_dq_rate`).
>

This analysis is correct.

For fq_pie this particular race is harmless: the qdisc is being
destroyed, flow->vars is not read again, and q->flows is freed only
after timer_delete_sync() in fq_pie_destroy().

It is however one instance of a more general problem: __qdisc_destroy()
calls qdisc_reset() without the lock that the sfq, red, pie, fq_pie and
dualpi2 timers take, and these timers are only stopped later in
->destroy(). With sfq this is a real use-after-free since commit
47e8dbb6e763 ("net/sched: do not reset queues in graft operations").

This was discussed in:

https://lore.kernel.org/netdev/20261106161455.2412769-1-edumazet@kernel.org/
https://lore.kernel.org/netdev/20261110044450.51921-1-kylebot@openai.com/

Kyle's v2 takes the tree lock around the final qdisc_reset() and routes
shutdown_scheduler_queue() through dev_graft_qdisc(), which should cover
this report. It needs a respin, as Jakub requested.

Kyle, when you repost, please add:

Reported-by: syzbot+00f5a4ef4bcb8f4d19f1@syzkaller.appspotmail.com

Thanks.


> full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=00f5a4ef4bcb8f4d19f1
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+00f5a4ef4bcb8f4d19f1@syzkaller.appspotmail.com
>
> ==================================================================
> BUG: KCSAN: data-race in fq_pie_reset / pie_calculate_probability
>
> write to 0xffff88811d293640 of 8 bytes by task 13 on cpu 1:
>  pie_vars_init include/net/pie.h:103 [inline]
>  fq_pie_reset+0x11e/0x1d0 net/sched/sch_fq_pie.c:552
>  qdisc_reset+0x51/0x2e0 net/sched/sch_generic.c:1118
>  __qdisc_destroy+0x60/0x220 net/sched/sch_generic.c:1157
>  qdisc_put net/sched/sch_generic.c:1189 [inline]
>  dev_shutdown+0x2e0/0x390 net/sched/sch_generic.c:1558
>  unregister_netdevice_many_notify+0x999/0x15e0 net/core/dev.c:12761
>  unregister_netdevice_many+0x19/0x20 net/core/dev.c:12845
>  ops_exit_rtnl_list net/core/net_namespace.c:188 [inline]
>  ops_undo_list+0x21d/0x410 net/core/net_namespace.c:249
>  cleanup_net+0x38d/0x5e0 net/core/net_namespace.c:713
>  process_one_work kernel/workqueue.c:3495 [inline]
>  process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
>  worker_thread+0x56c/0x770 kernel/workqueue.c:3659
>  kthread+0x248/0x2a0 kernel/kthread.c:436
>  ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
>
> write to 0xffff88811d293640 of 8 bytes by interrupt on cpu 0:
>  pie_vars_init include/net/pie.h:103 [inline]
>  pie_calculate_probability+0x425/0x4c0 net/sched/sch_pie.c:417
>  fq_pie_timer+0xf6/0x1d0 net/sched/sch_fq_pie.c:403
>  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
>  __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:123 [inline]
>  __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
>  _raw_spin_unlock_irqrestore+0x1a/0x30 kernel/locking/spinlock.c:221
>  free_frozen_page_commit+0x223/0x3a0 mm/page_alloc.c:2909
>  free_unref_folios+0x8c0/0x980 mm/page_alloc.c:3099
>  folios_put_refs+0x2cd/0x320 mm/folio.c:1065
>  folios_put include/linux/mm.h:2429 [inline]
>  __folio_batch_release+0x8e/0xb0 mm/folio.c:1125
>  folio_batch_release include/linux/folio_batch.h:101 [inline]
>  truncate_inode_pages_range+0x287/0x780 mm/truncate.c:452
>  truncate_inode_pages mm/truncate.c:530 [inline]
>  truncate_inode_pages_final+0x68/0x80 mm/truncate.c:565
>  ext4_evict_inode+0x459/0xea0 fs/ext4/inode.c:273
>  evict+0x301/0x570 fs/inode.c:829
>  iput_final fs/inode.c:2036 [inline]
>  iput+0x44f/0x5d0 fs/inode.c:2085
>  dentry_unlink_inode+0x29a/0x2b0 fs/dcache.c:510
>  dentry_kill+0x135/0x4f0 fs/dcache.c:857
>  finish_dput+0x16/0x1d0 fs/dcache.c:1032
>  dput+0x43/0x50 fs/dcache.c:1073
>  __fput+0x45c/0x660 fs/file_table.c:520
>  ____fput+0x1c/0x30 fs/file_table.c:541
>  task_work_run+0x145/0x1a0 kernel/task_work.c:233
>  exit_task_work include/linux/task_work.h:40 [inline]
>  do_exit+0x4a7/0x1530 kernel/exit.c:980
>  do_group_exit+0xfe/0x140 kernel/exit.c:1123
>  get_signal+0xc49/0xd30 kernel/signal.c:3113
>  arch_do_signal_or_restart+0x96/0x480 arch/x86/kernel/signal.c:337
>  __exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
>  exit_to_user_mode_loop+0x161/0x940 kernel/entry/common.c:101
>  __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
>  syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
>  syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline]
>  do_syscall_64+0x23b/0x3a0 arch/x86/entry/syscall_64.c:107
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Reported by Kernel Concurrency Sanitizer on:
> CPU: 0 UID: 0 PID: 6734 Comm: syz.1.1114 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 syzkaller@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 18:14 [syzbot] [net?] KCSAN: data-race in fq_pie_reset / pie_calculate_probability syzbot
2026-11-23 18:25 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox