BUG: soft lockup in gate_timer_func
Subsystems (3)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 21d6ac051080 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=10a50679580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15911a25580000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
watchdog: BUG: soft lockup - CPU#1 stuck for 3s! [syz-executor291:5020] Modules linked in: irq event stamp: 4562887 hardirqs last enabled at (4562886): [<ffff800080557c84>] seqcount_lockdep_reader_access+0x7c/0xf8 include/linux/seqlock.h:75 hardirqs last disabled at (4562887): [<ffff80008690b4b4>] __el1_irq arch/arm64/kernel/entry-common.c:527 [inline] hardirqs last disabled at (4562887): [<ffff80008690b4b4>] el1_interrupt+0x28/0x60 arch/arm64/kernel/entry-common.c:543 softirqs last enabled at (14246): [<ffff800084c0e6c4>] __alloc_skb+0x1c0/0x610 net/core/skbuff.c:698 softirqs last disabled at (14249): [<ffff8000800204c0>] __do_softirq+0x14/0x20 kernel/softirq.c:656 CPU: 1 UID: 0 PID: 5020 Comm: syz-executor291 Not tainted syzkaller #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026 pstate: 43400005 (nZcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:76 lr : seqcount_lockdep_reader_access+0xd4/0xf8 include/linux/seqlock.h:75
sp : ffff80008eb77ce0
x29: ffff80008eb77ce0 x28: 1fffe00034bbc63a x27: ffff80008e853110
x26: dfff800000000000 x25: ffff0000c1b62b80 x24: 1fffe0001ad59fa6
x23: dfff800000000000 x22: ffff0000c1b62bb0 x21: 0000000000000000
x20: ffff8000805580e8 x19: 00000000000000c0 x18: 0000000000000000
x17: ffff80008a7d6000 x16: 0000000000000002 x15: ffff80008a35fda0
x14: ffff80008a5d5e28 x13: 0000000000000001 x12: ffff0000d5af8000
x11: ffff80008a5d5e28 x10: 0000000000000003 x9 : 0000000000000101 x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000008 x3 : ffff800080557cd4 x2 : 0000000000000080 x1 : ffff0000d5af8000 x0 : 0000000000000000
Call trace: __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P) arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:75 (P) ktime_get+0x68/0x218 kernel/time/timekeeping.c:971 gate_get_time+0x1c/0xa4 net/sched/act_gate.c:23 gate_timer_func+0x1a8/0x390 net/sched/act_gate.c:101 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x314/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg+0xc8/0x17c net/socket.c:790 __sys_sendto+0x250/0x328 net/socket.c:2252 __do_sys_sendto net/socket.c:2259 [inline] __se_sys_sendto net/socket.c:2255 [inline] __arm64_sys_sendto+0xec/0x10c net/socket.c:2255 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140 el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0 skipped: idling at __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] NMI backtrace for cpu 0 skipped: idling at arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] NMI backtrace for cpu 0 skipped: idling at default_idle_call+0xd0/0xfc kernel/sched/idle.c:129
watchdog: BUG: soft lockup - CPU#1 stuck for 6s! [syz-executor291:5020] Modules linked in: irq event stamp: 9755971 hardirqs last enabled at (9755970): [<ffff800086930818>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] hardirqs last enabled at (9755970): [<ffff800086930818>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198 hardirqs last disabled at (9755971): [<ffff80008690b4b4>] __el1_irq arch/arm64/kernel/entry-common.c:527 [inline] hardirqs last disabled at (9755971): [<ffff80008690b4b4>] el1_interrupt+0x28/0x60 arch/arm64/kernel/entry-common.c:543 softirqs last enabled at (14246): [<ffff800084c0e6c4>] __alloc_skb+0x1c0/0x610 net/core/skbuff.c:698 softirqs last disabled at (14249): [<ffff8000800204c0>] __do_softirq+0x14/0x20 kernel/softirq.c:656 CPU: 1 UID: 0 PID: 5020 Comm: syz-executor291 Tainted: G L syzkaller #0 PREEMPT Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:179 [inline] pc : _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 lr : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] lr : _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198
sp : ffff80008eb77dc0
x29: ffff80008eb77dc0 x28: 1fffe00034bbc63a x27: ffff0001a5de31c0
x26: ffff0001a5de31d0 x25: ffff0000d6acfd38 x24: dfff800000000000
x23: 0000000000000001 x22: ffff800084ec6bfc x21: ffff0001a5de2d80
x20: ffff0001a5de2d80 x19: 0000000000000000 x18: 0000000000000000
x17: ffff80008a7d6000 x16: 0000000000000004 x15: ffff80008a35fda0
x14: 000000008030dda8 x13: 0000000000000001 x12: 0000000000000000
x11: ffff800080156070 x10: 0000000000000003 x9 : 0000000000000000 x8 : 00000000000000c0 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000008 x3 : ffff800080156118 x2 : 0000000000000000 x1 : ffff0000d5af8000 x0 : ffff80011d2fd000
Call trace: __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P) arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] (P) _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 (P) __run_hrtimer kernel/time/hrtimer.c:2028 [inline] __hrtimer_run_queues+0x22c/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg+0xc8/0x17c net/socket.c:790 __sys_sendto+0x250/0x328 net/socket.c:2252 __do_sys_sendto net/socket.c:2259 [inline] __se_sys_sendto net/socket.c:2255 [inline] __arm64_sys_sendto+0xec/0x10c net/socket.c:2255 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140 el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0 skipped: idling at __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] NMI backtrace for cpu 0 skipped: idling at arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] NMI backtrace for cpu 0 skipped: idling at default_idle_call+0xd0/0xfc kernel/sched/idle.c:129
watchdog: BUG: soft lockup - CPU#1 stuck for 9s! [syz-executor291:5020] Modules linked in: irq event stamp: 14939657 hardirqs last enabled at (14939656): [<ffff800086930818>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] hardirqs last enabled at (14939656): [<ffff800086930818>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198 hardirqs last disabled at (14939657): [<ffff80008690b4b4>] __el1_irq arch/arm64/kernel/entry-common.c:527 [inline] hardirqs last disabled at (14939657): [<ffff80008690b4b4>] el1_interrupt+0x28/0x60 arch/arm64/kernel/entry-common.c:543 softirqs last enabled at (14246): [<ffff800084c0e6c4>] __alloc_skb+0x1c0/0x610 net/core/skbuff.c:698 softirqs last disabled at (14249): [<ffff8000800204c0>] __do_softirq+0x14/0x20 kernel/softirq.c:656 CPU: 1 UID: 0 PID: 5020 Comm: syz-executor291 Tainted: G L syzkaller #0 PREEMPT Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:179 [inline] pc : _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 lr : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] lr : _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198
sp : ffff80008eb77dc0
x29: ffff80008eb77dc0 x28: 1fffe00034bbc63a x27: ffff0001a5de31c0
x26: ffff0001a5de31d0 x25: ffff0000d6acfd38 x24: dfff800000000000
x23: 0000000000000001 x22: ffff800084ec6bfc x21: ffff0001a5de2d80
x20: ffff0001a5de2d80 x19: 0000000000000000 x18: 0000000000000000
x17: ffff80008a7d6000 x16: 0000000000000004 x15: ffff80008a35fda0
x14: 000000008030dda8 x13: 0000000000000001 x12: 0000000000000000
x11: ffff800080156070 x10: 0000000000000003 x9 : 0000000000000000 x8 : 00000000000000c0 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000008 x3 : ffff800080156118 x2 : 0000000000000000 x1 : ffff0000d5af8000 x0 : ffff80011d2fd000
Call trace: __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P) arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] (P) _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 (P) __run_hrtimer kernel/time/hrtimer.c:2028 [inline] __hrtimer_run_queues+0x22c/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg+0xc8/0x17c net/socket.c:790 __sys_sendto+0x250/0x328 net/socket.c:2252 __do_sys_sendto net/socket.c:2259 [inline] __se_sys_sendto net/socket.c:2255 [inline] __arm64_sys_sendto+0xec/0x10c net/socket.c:2255 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140 el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0 skipped: idling at __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] NMI backtrace for cpu 0 skipped: idling at arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] NMI backtrace for cpu 0 skipped: idling at default_idle_call+0xd0/0xfc kernel/sched/idle.c:129
watchdog: BUG: soft lockup - CPU#1 stuck for 12s! [syz-executor291:5020] Modules linked in: irq event stamp: 20130019 hardirqs last enabled at (20130018): [<ffff800086930818>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] hardirqs last enabled at (20130018): [<ffff800086930818>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198 hardirqs last disabled at (20130019): [<ffff80008690b4b4>] __el1_irq arch/arm64/kernel/entry-common.c:527 [inline] hardirqs last disabled at (20130019): [<ffff80008690b4b4>] el1_interrupt+0x28/0x60 arch/arm64/kernel/entry-common.c:543 softirqs last enabled at (14246): [<ffff800084c0e6c4>] __alloc_skb+0x1c0/0x610 net/core/skbuff.c:698 softirqs last disabled at (14249): [<ffff8000800204c0>] __do_softirq+0x14/0x20 kernel/softirq.c:656 CPU: 1 UID: 0 PID: 5020 Comm: syz-executor291 Tainted: G L syzkaller #0 PREEMPT Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:179 [inline] pc : _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 lr : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] lr : _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:198
sp : ffff80008eb77dc0
x29: ffff80008eb77dc0 x28: 1fffe00034bbc63a x27: ffff0001a5de31c0
x26: ffff0001a5de31d0 x25: ffff0000d6acfd38 x24: dfff800000000000
x23: 0000000000000001 x22: ffff800084ec6bfc x21: ffff0001a5de2d80
x20: ffff0001a5de2d80 x19: 0000000000000000 x18: 0000000000000000
x17: ffff80008a7d6000 x16: 0000000000000004 x15: ffff80008a35fda0
x14: 000000008030dda8 x13: 0000000000000001 x12: 0000000000000000
x11: ffff800080156070 x10: 0000000000000003 x9 : 0000000000000000 x8 : 00000000000000c0 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000008 x3 : ffff800080156118 x2 : 0000000000000000 x1 : ffff0000d5af8000 x0 : ffff80011d2fd000
Call trace: __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P) arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:178 [inline] (P) _raw_spin_unlock_irqrestore+0x44/0x98 kernel/locking/spinlock.c:198 (P) __run_hrtimer kernel/time/hrtimer.c:2028 [inline] __hrtimer_run_queues+0x22c/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg+0xc8/0x17c net/socket.c:790 __sys_sendto+0x250/0x328 net/socket.c:2252 __do_sys_sendto net/socket.c:2259 [inline] __se_sys_sendto net/socket.c:2255 [inline] __arm64_sys_sendto+0xec/0x10c net/socket.c:2255 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140 el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0 skipped: idling at __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] NMI backtrace for cpu 0 skipped: idling at arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] NMI backtrace for cpu 0 skipped: idling at default_idle_call+0xd0/0xfc kernel/sched/idle.c:129
---
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 [email protected].
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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
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
#syz test
net/sched/act_gate.c +4 -3
@@ -88,7 +88,8 @@ static enum hrtimer_restart gate_timer_func(struct hrtimer *timer) gact->current_max_octets = next->maxoctets; gact->current_close_time =ktime_add_ns (gact->current_close_time, - next->interval); + next->interval <100 ? +100 : next->interval); close_time = gact->current_close_time;
@@ -101,10 +102,10 @@ static enum hrtimer_restart gate_timer_func(struct hrtimer *timer) now =gate_get_time (gact);if (ktime_after (now, close_time)) { -ktime_t cycle, base; +u64 cycle, base;u64 n; - cycle = p->tcfg_cycletime; + cycle = p->tcfg_cycletime >20 ?20 : p->tcfg_cycletime; base =ns_to_ktime (p->tcfg_basetime); n =div64_u64 (ktime_sub_ns (now, base), cycle); close_time =ktime_add_ns (base, (n +1 ) * cycle);
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=12e79a25580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=1653e679580000
Note: testing is done by a robot and is best-effort only.
#syz test
net/sched/act_gate.c +5 -1
@@ -178,6 +178,10 @@ static const struct nla_policy gate_policy[TCA_GATE_MAX + 1] = { [TCA_GATE_CLOCKID] = { .type = NLA_S32 }, }; +#ifndef __NET_TC_GATE_LIMIT +#define GATE_ENTRY_INTERVAL_MIN 100 +#endif +static int fill_gate_entry (struct nlattr **tb,struct tcfg_gate_entry *entry,struct netlink_ext_ack *extack) {
@@ -188,7 +192,7 @@ static int fill_gate_entry(struct nlattr **tb, struct tcfg_gate_entry *entry,if (tb[TCA_GATE_ENTRY_INTERVAL ]) interval =nla_get_u32 (tb[TCA_GATE_ENTRY_INTERVAL ]); -if (interval ==0 ) { +if (interval <GATE_ENTRY_INTERVAL_MIN ) {NL_SET_ERR_MSG (extack,"Invalid interval for schedule entry" );return -EINVAL ; }
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=11685a25580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=150076c6580000
Note: testing is done by a robot and is best-effort only.
#syz test
net/sched/act_gate.c +2 -0
@@ -501,6 +501,8 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } +if (cycletime >S64_MAX ) + cycletime =S64_MAX ; p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=10fc1679580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=17b73679580000
Note: testing is done by a robot and is best-effort only.
PATCH 1/1 net/sched: act_gate: Limit the max value for cycletime
In reply to syzbotIf the user passes a cycletime value of 0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle in gate_timer_func():
cycle = p->tcfg_cycletime; // overflow, cycle = -1
Since the local variable cycle is declared as ktime_t (i.e., s64), the assignment overflows.
This leads to an incorrect calculation of the close_time value. Ultimately, the new hrtimer expiry time becomes less than now, causing __hrtimer_run_queues() to execute the "timer callback" for an excessively long period, which triggers a soft lockup. [1]
Another factor is that the passed interval value is 1; while this accelerates the problematic progression of close_time, it is not the decisive factor in the issue described in [1].
When initializing cycletime, ensuring its value does not exceed S64_MAX guarantees that the hrtimer can correctly calculate a valid expiry time.
[1]
watchdog: BUG: soft lockup - CPU#1 stuck for 3s! [syz-executor291:5020] pc : seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:76 Call trace: arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:75 (P) ktime_get+0x68/0x218 kernel/time/timekeeping.c:971 gate_get_time+0x1c/0xa4 net/sched/act_gate.c:23 gate_timer_func+0x1a8/0x390 net/sched/act_gate.c:101 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x314/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline]
--- net/sched/act_gate.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/act_gate.c +2 -0
@@ -501,6 +501,8 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } +if (cycletime >S64_MAX ) + cycletime =S64_MAX ; p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerRe: [PATCH] net/sched: act_gate: Limit the max value for cycletime
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
---
net/sched: act_gate: Limit the max value for cycletime
The patch clamps a user supplied TCA_GATE_CYCLE_TIME to S64_MAX in tcf_gate_init() before storing it in p->tcfg_cycletime, so that the ktime_t (s64) arithmetic used to compute gate close times does not see a negative cycle. It is tagged as the fix for a syzbot soft lockup inside gate_timer_func().
net/sched/act_gate.c static int tcf_gate_init(struct net *net, struct nlattr *nla, · line 505
Quoted 10 lines
net/sched/act_gate.c +2
-0@@ -501,6 +501,8 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } +if (cycletime >S64_MAX ) + cycletime =S64_MAX ;
[Severity: High]
This isn't a bug introduced by this patch, since cycletime == S64_MAX combined with a non-zero basetime already wrapped before it, but does clamping to S64_MAX actually close the reported soft lockup?
The consumers do not use the cycle value on its own, they compute an absolute expiry as base + (n + 1) * cycle with plain signed ktime arithmetic:
net/sched/act_gate.c:gate_get_start_time() {
...
cycle = param->tcfg_cycletime;
n = div64_u64(ktime_sub_ns(now, base), cycle);
*start = ktime_add_ns(base, (n + 1) * cycle);
}With cycle == S64_MAX and any non-zero basetime that is not in the future, div64_u64(now - base, S64_MAX) is 0, so the addition is base + S64_MAX and wraps negative (for a basetime of 1000 ns, start becomes S64_MIN + 1000). gate_start_timer() then takes min_t(ktime_t, start, expires) and arms the timer with that past absolute value in HRTIMER_MODE_ABS_SOFT.
gate_timer_func() recomputes the same wrapped value on every invocation:
net/sched/act_gate.c:gate_timer_func() {
...
if (ktime_after(now, close_time)) {
cycle = p->tcfg_cycletime;
base = ns_to_ktime(p->tcfg_basetime);
n = div64_u64(ktime_sub_ns(now, base), cycle);
close_time = ktime_add_ns(base, (n + 1) * cycle);
}
...
hrtimer_set_expires(&gact->hitimer, close_time);
...
return HRTIMER_RESTART;
}Since the expiry never advances past now, doesn't __hrtimer_run_queues() keep re-running the callback in the same softirq pass, reproducing the watchdog trace quoted in the changelog? Only basetime == 0 self-corrects, because 0 + S64_MAX stays positive, which would explain why the syzbot reproducer no longer trips; adding a base-time of 1000 appears to trip it again.
Two follow-on effects of that loop: gate_timer_func() re-takes gact->tcf_lock on every iteration, and hrtimer_cancel() in tcf_gate_cleanup() (and on the replace path in tcf_gate_init()) can never see the perpetually re-armed timer dequeued, so the params and entry list are never handed to call_rcu(&p->rcu, tcf_gate_params_free_rcu).
Note also that TCA_GATE_BASE_TIME is read with a plain nla_get_u64() and gate_policy declares it as unrestricted NLA_U64, so any basetime/cycletime pair whose sum exceeds S64_MAX wraps the same way, for example cycletime = 2^62 with basetime = 3 * 2^62. Would bounding the computed expiry instead (basetime + cycletime <= KTIME_MAX), or rejecting the input in a narrower range as sch_taprio does, be a better fit?
Related to this, the changelog says:
When initializing cycletime, ensuring its value does not exceed S64_MAX guarantees that the hrtimer can correctly calculate a valid expiry time.
Given the wrap in base + (n + 1) * cycle above, is that guarantee accurate for non-zero basetime?
[Severity: Medium]
Should an out-of-range cycle time be rejected rather than silently rewritten?
gate_policy declares the attribute with no range restriction:
[TCA_GATE_CYCLE_TIME] = { .type = NLA_U64 },and tcf_gate_dump() echoes the stored value back in the same attribute:
if (nla_put_u64_64bit(skb, TCA_GATE_CYCLE_TIME, p->tcfg_cycletime, TCA_GATE_PAD))
so a request with cycle-time 0xffffffffffffffff now succeeds, while a subsequent dump reports S64_MAX. There is no -EINVAL, no NL_SET_BAD_ATTR and no extack message on that path.
A later replace that omits the attribute also inherits the rewritten value:
net/sched/act_gate.c:tcf_gate_init() {
...
if (!err && !tb[TCA_GATE_CYCLE_TIME])
cycletime = cur_p->tcfg_cycletime;
...
}Every other invalid input in this file is rejected with -EINVAL plus extack (interval == 0 in fill_gate_entry(), bad clockid in gate_clock_resolve(), empty entry list), and the same knob in sch_taprio is rejected rather than clamped:
net/sched/sch_taprio.c:parse_taprio_schedule() {
...
if (cycle < 0 || cycle > INT_MAX) {
NL_SET_ERR_MSG(extack, "'cycle_time' is too big");
return -EINVAL;
}
...
}The branch immediately above the new check cannot exceed S64_MAX, since intervals are non-zero u32 values and roughly 2^31 entries would be needed, so the check only covers the user supplied attribute. Could it move to the parse stage and return -EINVAL with NL_SET_BAD_ATTR on TCA_GATE_CYCLE_TIME instead?
Quoted 3 lines
net/sched/act_gate.c +0
-0p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Signature · 1 line
pw-bot: cr
PATCH v2 1/1 net/sched: act_gate: Limit the max value for cycletime
If the user passes a cycletime value of 0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle in gate_timer_func():
cycle = p->tcfg_cycletime; // overflow, cycle = -1
Since the local variable cycle is declared as ktime_t (i.e., s64), the assignment overflows.
This leads to an incorrect calculation of the close_time value. Ultimately, the new hrtimer expiry time becomes less than now, causing __hrtimer_run_queues() to execute the "timer callback" for an excessively long period, which triggers a soft lockup. [1]
Another factor is that the passed interval value is 1; while this accelerates the problematic progression of close_time, it is not the decisive factor in the issue described in [1].
When initializing cycletime, ensuring its value does not exceed INT_MAX guarantees that the hrtimer can correctly calculate a valid expiry time.
[1]
watchdog: BUG: soft lockup - CPU#1 stuck for 3s! [syz-executor291:5020] pc : seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:76 Call trace: arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:75 (P) ktime_get+0x68/0x218 kernel/time/timekeeping.c:971 gate_get_time+0x1c/0xa4 net/sched/act_gate.c:23 gate_timer_func+0x1a8/0x390 net/sched/act_gate.c:101 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x314/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline]
---
v1 -> v2: return -EINVAL with NL_SET_BAD_ATTR
net/sched/act_gate.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/sched/act_gate.c +8 -0
@@ -501,6 +501,14 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + +if (cycletime <0 || cycletime >INT_MAX ) { +NL_SET_ERR_MSG (extack,"'cycle_time' is too big" ); + err = -EINVAL ; +spin_unlock_bh (&gact->tcf_lock); + goto err_free; + } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Signature · 1 line
2.43.0
Jamal Hadi Salim
maintainerRe: [PATCH v2] net/sched: act_gate: Limit the max value for cycletime
Quoted 9 lines · Edward Adam Davis
If the user passes a cycletime value of
0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle ingate_timer_func():cycle =
p->tcfg_cycletime; // overflow, cycle = -1Since the local variable cycle is declared as
ktime_t(i.e., s64), the assignment overflows.
Review the sashiko feedback. At least two of those concerns look legit and need to be addressed:
1) complaint about timer disarm on replace 2) INT_MAX being too narrow
cheers,
jamal
Quoted 80 lines
This leads to an incorrect calculation of the
close_timevalue. Ultimately, the new hrtimer expiry time becomes less than now, causing__hrtimer_run_queues()to execute the "timer callback" for an excessively long period, which triggers a soft lockup. [1]Another factor is that the passed interval value is 1; while this accelerates the problematic progression of
close_time, it is not the decisive factor in the issue described in [1].When initializing cycletime, ensuring its value does not exceed
INT_MAXguarantees that the hrtimer can correctly calculate a valid expiry time.[1]
watchdog: BUG: soft lockup - CPU#1 stuck for 3s! [syz-executor291:5020] pc : seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:76 Call trace: arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:75 (P) ktime_get+0x68/0x218 kernel/time/timekeeping.c:971 gate_get_time+0x1c/0xa4 net/sched/act_gate.c:23 gate_timer_func+0x1a8/0x390 net/sched/act_gate.c:101 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x314/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline]Fixes a51c328df310 ("net: qos: introduce a gate control flow action")Reported-by [email protected]Tested-by [email protected]Signed-off-by Edward Adam Davis <[email protected]>---
v1 -> v2: return-EINVALwithNL_SET_BAD_ATTRnet/sched/act_gate.c | 8 ++++++++ 1 file changed, 8 insertions(+)net/sched/act_gate.c +8
-1@@ -501,6 +501,14 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + +if (cycletime <0 || cycletime >INT_MAX ) { +NL_SET_ERR_MSG (extack,"'cycle_time' is too big" ); + err = -EINVAL ; +spin_unlock_bh (&gact->tcf_lock); + goto err_free; + } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext; --2.43.0
Re: [PATCH v2] net/sched: act_gate: Limit the max value for cycletime
Quoted 7 lines · Jamal Hadi Salim
Quoted 6 lines · Edward Adam Davis
If the user passes a cycletime value of
0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle ingate_timer_func():cycle =
p->tcfg_cycletime; // overflow, cycle = -1
Quoted 7 lines
Quoted 3 lines
Since the local variable cycle is declared as
ktime_t(i.e., s64), the assignment overflows.Review the sashiko feedback. At least two of those concerns look legit and need to be addressed:
1) complaint about timer disarm on replace 2)INT_MAXbeing too narrow
I haven't received any feedback regarding sashiko, and I didn't quite understand the points made in item 1); could you please provide more details?
Regarding item 2), if INT_MAX is too narrow, do you have a suitable value to recommend? S64_MAX?
cheers,
Edward
Jamal Hadi Salim
maintainerRe: [PATCH v2] net/sched: act_gate: Limit the max value for cycletime
Quoted 13 lines · Edward Adam Davis
Quoted 11 lines · Jamal Hadi Salim
Quoted 9 lines · Edward Adam Davis
If the user passes a cycletime value of
0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle ingate_timer_func():cycle =
p->tcfg_cycletime; // overflow, cycle = -1Since the local variable cycle is declared as
ktime_t(i.e., s64), the assignment overflows.
Quoted 6 lines
Quoted 3 lines
Review the sashiko feedback. At least two of those concerns look legit and need to be addressed:
1) complaint about timer disarm on replace 2)INT_MAXbeing too narrowI haven't received any feedback regarding sashiko, and I didn't quite understand the points made in item 1); could you please provide more details?
You should always look at patchwork for reviews from the AIs - i just happened to have cycles and peeked and even my responses are best effort. Some maintainers forward AI reviews on a best-effort basis (Jakub forwarded you the v1 review), so you may end up getting radio silence if nobody has time. So, going forward, the first line of defense is to look at patchwork 24 hours + after you post your patch. Address those by sending a new version or rebut them on the list.
Quoted 2 lines
Regarding item 2), if
INT_MAXis too narrow, do you have a suitable value to recommend?S64_MAX?
Handwave: The safe bound is one that keeps base + cycletime <= KTIME_MAX. To be verbose per sashiko:
cycletime is an unrestricted NLA_U64 consumed as ktime_t (s64). A 200 s cycle time does not overflow any s64 arithmetic, but your v2 rejects it. tdc test a721 (tools/testing/selftests/tc-testing/tc-tests/actions/gate.json) uses cycle-time 200000000000ns and expects success; your v2 breaks it. sch_taprio uses INT_MAX but its semantics/tests differ. S64_MAX is the actual overflow boundary (U64_MAX is what makes the s64 go negative); but even S64_MAX + a non-zero basetime wraps in base + (n+1)*cycle
Quoted 3 lines
cheers,
Edward
Re: [PATCH v2] net/sched: act_gate: Limit the max value for cycletime
Quoted 31 lines · Jamal Hadi Salim
Quoted 13 lines · Edward Adam Davis
Quoted 11 lines · Jamal Hadi Salim
Quoted 9 lines · Edward Adam Davis
If the user passes a cycletime value of
0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle ingate_timer_func():cycle =
p->tcfg_cycletime; // overflow, cycle = -1Since the local variable cycle is declared as
ktime_t(i.e., s64), the assignment overflows.Quoted 6 lines
Quoted 3 lines
Review the sashiko feedback. At least two of those concerns look legit and need to be addressed:
1) complaint about timer disarm on replace 2)INT_MAXbeing too narrowI haven't received any feedback regarding sashiko, and I didn't quite understand the points made in item 1); could you please provide more details?
You should always look at patchwork for reviews from the AIs - i just happened to have cycles and peeked and even my responses are best effort. Some maintainers forward AI reviews on a best-effort basis (Jakub forwarded you the v1 review), so you may end up getting radio silence if nobody has time. So, going forward, the first line of defense is to look at patchwork 24 hours + after you post your patch. Address those by sending a new version or rebut them on the list.
Quoted 2 lines
Regarding item 2), if
INT_MAXis too narrow, do you have a suitable value to recommend?S64_MAX?
Quoted 10 lines
Handwave: The safe bound is one that keeps base + cycletime <=
KTIME_MAX. To be verbose per sashiko:
cycletime is an unrestrictedNLA_U64consumed asktime_t(s64). A 200 s cycle time does not overflow any s64 arithmetic, but your v2 rejects it. tdc test a721 (tools/testing/selftests/tc-testing/tc-tests/actions/gate.json) uses cycle-time 200000000000ns and expects success; your v2 breaks it.sch_tapriousesINT_MAXbut its semantics/tests differ.S64_MAXis the actual overflow boundary (U64_MAXis what makes the s64 go negative); but evenS64_MAX+ a non-zero basetime wraps in base + (n+1)*cycle
Got it, thanks.
BR,
Edward
PATCH v3 1/1 net/sched: act_gate: Limit the max value for cycletime
If the user passes a cycletime value of 0xFFFFFFFFFFFFFFFFULL, an overflow occurs during the assignment of cycle in gate_timer_func():
cycle = p->tcfg_cycletime; // overflow, cycle = -1
Since the local variable cycle is declared as ktime_t (i.e., s64), the assignment overflows.
This leads to an incorrect calculation of the close_time value. Ultimately, the new hrtimer expiry time becomes less than now, causing __hrtimer_run_queues() to execute the "timer callback" for an excessively long period, which triggers a soft lockup. [1]
Another factor is that the passed interval value is 1; while this accelerates the problematic progression of close_time, it is not the decisive factor in the issue described in [1].
Modify the cycletime range in the policy to (0, S64_MAX), when parsing cycletime, ensuring its value does not exceed S64_MAX guarantees that the hrtimer can correctly calculate a valid expiry time.
[1]
watchdog: BUG: soft lockup - CPU#1 stuck for 3s! [syz-executor291:5020] pc : seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:76 Call trace: arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P) seqcount_lockdep_reader_access+0xd8/0xf8 include/linux/seqlock.h:75 (P) ktime_get+0x68/0x218 kernel/time/timekeeping.c:971 gate_get_time+0x1c/0xa4 net/sched/act_gate.c:23 gate_timer_func+0x1a8/0x390 net/sched/act_gate.c:101 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x314/0xbe0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x15c/0x21c kernel/time/hrtimer.c:2113 handle_softirqs+0x2ec/0xd98 kernel/softirq.c:622 __do_softirq+0x14/0x20 kernel/softirq.c:656 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78 call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83 invoke_softirq kernel/softirq.c:503 [inline] __irq_exit_rcu+0x1ac/0x428 kernel/softirq.c:735 irq_exit_rcu+0x14/0x84 kernel/softirq.c:752 __el1_irq arch/arm64/kernel/entry-common.c:531 [inline] el1_interrupt+0x40/0x60 arch/arm64/kernel/entry-common.c:543 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:548 el1h_64_irq+0x6c/0x70 arch/arm64/kernel/entry.S:586 __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:26 [inline] (P) arch_local_irq_enable arch/arm64/include/asm/irqflags.h:48 [inline] (P) __local_bh_enable_ip+0x1f0/0x35c kernel/softirq.c:455 (P) local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x1c8/0x610 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xb8/0x690 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x740/0x850 net/core/sock.c:3012 unix_dgram_sendmsg+0x434/0x1078 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline]
---
v1 -> v2: return -EINVAL with NL_SET_BAD_ATTR
v2 -> v3: using policy to limit cycletime range
net/sched/act_gate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/sched/act_gate.c +8 -1
@@ -166,13 +166,19 @@ static const struct nla_policy entry_policy[TCA_GATE_ENTRY_MAX + 1] = { [TCA_GATE_ENTRY_MAX_OCTETS] = { .type = NLA_S32 }, }; +static const struct netlink_range_validation_signed gate_cycle_time_range = { + .min =0 , + .max =S64_MAX , +}; +static const struct nla_policy gate_policy[TCA_GATE_MAX +1 ] = { [TCA_GATE_PARMS ] =NLA_POLICY_EXACT_LEN (sizeof (struct tc_gate )), [TCA_GATE_PRIORITY ] = { .type =NLA_S32 }, [TCA_GATE_ENTRY_LIST ] = { .type =NLA_NESTED }, [TCA_GATE_BASE_TIME ] = { .type =NLA_U64 }, - [TCA_GATE_CYCLE_TIME ] = { .type =NLA_U64 }, + [TCA_GATE_CYCLE_TIME ] = +NLA_POLICY_FULL_RANGE_SIGNED (NLA_S64 , &gate_cycle_time_range), [TCA_GATE_CYCLE_TIME_EXT ] = { .type =NLA_U64 }, [TCA_GATE_FLAGS ] = { .type =NLA_U32 }, [TCA_GATE_CLOCKID ] = { .type =NLA_S32 },
@@ -501,6 +507,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerRe: [PATCH v3] net/sched: act_gate: Limit the max value for cycletime
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
---
net/sched: act_gate: Limit the max value for cycletime
This changes the act_gate netlink policy so that TCA_GATE_CYCLE_TIME is validated with NLA_POLICY_FULL_RANGE_SIGNED(NLA_S64) against a range of 0 to S64_MAX, with the intent of preventing an s64 overflow in gate_timer_func() that led to a soft lockup reported by syzbot.
A couple of questions on the changelog and on the diff below.
Quoted 3 lines
Modify the cycletime range in the policy to (0,
S64_MAX), when parsing cycletime, ensuring its value does not exceedS64_MAXguarantees that the hrtimer can correctly calculate a valid expiry time.
[Severity: Low]
Should this read [0, S64_MAX] instead of (0, S64_MAX)?
gate_cycle_time_range uses .min = 0 and the range check in nla_validate_int_range_signed() is inclusive, so a cycletime of 0 is still accepted, and it keeps its special meaning in tcf_gate_init():
if (!cycletime) {
struct tcfg_gate_entry *entry;
ktime_t cycle = 0;
list_for_each_entry(entry, &p->entries, list)
cycle = ktime_add_ns(cycle, entry->interval);
cycletime = cycle;
}As written, the open interval wording suggests 0 is now rejected, which a backporter might rely on.
Quoted 12 lines
net/sched/act_gate.c +4
-0@@ -166,13 +166,19 @@ static const struct nla_policy entry_policy[TCA_GATE_ENTRY_MAX + 1] = { [TCA_GATE_ENTRY_MAX_OCTETS] = { .type = NLA_S32 }, }; +static const struct netlink_range_validation_signed gate_cycle_time_range = { + .min =0 , + .max =S64_MAX , +};
net/sched/act_gate.c static const struct nla_policy entry_policy[TCA_GATE_ENTRY_MAX + 1] = { · line 181
Quoted 10 lines
net/sched/act_gate.c +3
-1+static const struct nla_policy gate_policy[TCA_GATE_MAX +1 ] = { [TCA_GATE_PARMS ] =NLA_POLICY_EXACT_LEN (sizeof (struct tc_gate )), [TCA_GATE_PRIORITY ] = { .type =NLA_S32 }, [TCA_GATE_ENTRY_LIST ] = { .type =NLA_NESTED }, [TCA_GATE_BASE_TIME ] = { .type =NLA_U64 }, - [TCA_GATE_CYCLE_TIME ] = { .type =NLA_U64 }, + [TCA_GATE_CYCLE_TIME ] = +NLA_POLICY_FULL_RANGE_SIGNED (NLA_S64 , &gate_cycle_time_range),
[Severity: High]
Does capping cycletime at S64_MAX actually remove the soft lockup?
The expiry is not computed from cycletime alone. In gate_get_start_time():
base = ns_to_ktime(param->tcfg_basetime);
now = gate_get_time(gact);
if (ktime_after(base, now)) {
*start = base;
return;
}
cycle = param->tcfg_cycletime;
n = div64_u64(ktime_sub_ns(now, base), cycle);
*start = ktime_add_ns(base, (n + 1) * cycle);TCA_GATE_BASE_TIME is left as { .type = NLA_U64 } with no range, so with basetime = 1 and cycletime = S64_MAX (both accepted by the new policy) n becomes 0 and the addition is 1 + (2^63 - 1), which wraps to S64_MIN since ktime_add_ns() is plain 64-bit addition.
gate_start_timer() only clamps downward:
start = min_t(ktime_t, start, expires); hrtimer_start(&gact->hitimer, start, HRTIMER_MODE_ABS_SOFT);
so the wrapped negative value is armed as an absolute expiry in the past. The catch-up branch of gate_timer_func() then recomputes the same value on every invocation:
if (ktime_after(now, close_time)) {
ktime_t cycle, base;
u64 n;
cycle = p->tcfg_cycletime;
base = ns_to_ktime(p->tcfg_basetime);
n = div64_u64(ktime_sub_ns(now, base), cycle);
close_time = ktime_add_ns(base, (n + 1) * cycle);
}
...
hrtimer_set_expires(&gact->hitimer, close_time);
...
return HRTIMER_RESTART;which looks like the same "gate_timer_func in hrtimer_run_softirq" pattern from the report, reachable via RTM_NEWACTION with basetime = 1, cycletime = S64_MAX and one entry with a non-zero interval. A wide band of policy-legal pairs wraps the same way, for example cycletime = S64_MAX - 10 with basetime = 10^12.
Would bounding the whole base + (n + 1) * cycle arithmetic be needed here, the way sch_taprio.c does it?
static const struct netlink_range_validation_signed taprio_cycle_time_range = {
.min = 0,
.max = INT_MAX,
};Signature · 1 line
pw-bot: cr
Jakub Kicinski
maintainerRe: [PATCH v3] net/sched: act_gate: Limit the max value for cycletime
In reply to Edward Adam Davisnet/sched/act_gate.c static const struct nla_policy entry_policy[TCA_GATE_ENTRY_MAX + 1] = { · line 181
Quoted 9 lines · On Tue, 25 Aug 2026 20:13:02 +0800 Edward Adam Davis wrote:
static const struct
nla_policygate_policy[TCA_GATE_MAX + 1] = {net/sched/act_gate.c +2
-1[TCA_GATE_PARMS] = NLA_POLICY_EXACT_LEN(sizeof(struct tc_gate)), [TCA_GATE_PRIORITY] = { .type = NLA_S32 }, [TCA_GATE_ENTRY_LIST] = { .type = NLA_NESTED }, [TCA_GATE_BASE_TIME] = { .type = NLA_U64 }, - [TCA_GATE_CYCLE_TIME] = { .type = NLA_U64 }, + [TCA_GATE_CYCLE_TIME ] = + NLA_POLICY_FULL_RANGE_SIGNED(NLA_S64, &gate_cycle_time_range),
Why are you changing the type of the attr? S64_MAX is perfectly fine as range for NLA_U64
net/sched/act_gate.c static int tcf_gate_init(struct net *net, struct nlattr *nla, · line 512
Quoted 10 lines
net/sched/act_gate.c +1
-0[TCA_GATE_CYCLE_TIME_EXT] = { .type = NLA_U64 }, [TCA_GATE_FLAGS] = { .type = NLA_U32 }, [TCA_GATE_CLOCKID] = { .type = NLA_S32 },@@ -501,6 +507,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Unrelated noise, please pay more attention.
#syz test
net/sched/act_gate.c +8 -0
@@ -501,6 +501,14 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + +if (cycletime <0 || cycletime >INT_MAX ) { +NL_SET_ERR_MSG (extack,"'cycle_time' is too big" ); + err = -EINVAL ; +spin_unlock_bh (&gact->tcf_lock); + goto err_free; + } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=11264625580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=13e8d179580000
Note: testing is done by a robot and is best-effort only.
#syz test
net/sched/act_gate.c +8 -1
@@ -166,13 +166,19 @@ static const struct nla_policy entry_policy[TCA_GATE_ENTRY_MAX + 1] = { [TCA_GATE_ENTRY_MAX_OCTETS] = { .type = NLA_S32 }, }; +static const struct netlink_range_validation_signed act_gate_cycle_time_range = { + .min =0 , + .max =S64_MAX , +}; +static const struct nla_policy gate_policy[TCA_GATE_MAX +1 ] = { [TCA_GATE_PARMS ] =NLA_POLICY_EXACT_LEN (sizeof (struct tc_gate )), [TCA_GATE_PRIORITY ] = { .type =NLA_S32 }, [TCA_GATE_ENTRY_LIST ] = { .type =NLA_NESTED }, [TCA_GATE_BASE_TIME ] = { .type =NLA_U64 }, - [TCA_GATE_CYCLE_TIME ] = { .type =NLA_U64 }, + [TCA_GATE_CYCLE_TIME ] = +NLA_POLICY_FULL_RANGE_SIGNED (NLA_S64 , &act_gate_cycle_time_range), [TCA_GATE_CYCLE_TIME_EXT ] = { .type =NLA_U64 }, [TCA_GATE_FLAGS ] = { .type =NLA_U32 }, [TCA_GATE_CLOCKID ] = { .type =NLA_S32 },
@@ -501,6 +507,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla, cycle =ktime_add_ns (cycle, entry->interval); cycletime = cycle; } + p->tcfg_cycletime = cycletime; p->tcfg_cycletime_ext = cycletime_ext;
Signature · 1 line
2.43.0
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 68f892e9 Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=142d1415580000 kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3 dashboard link: https://syzkaller.appspot.com/bug?extid=0054fed3dc9085390f51 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=16807979580000
Note: testing is done by a robot and is best-effort only.