Linux Security Modules development
 help / color / mirror / Atom feed
* Re: [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9)
       [not found] <673fdc18.050a0220.363a1b.012c.GAE@google.com>
@ 2026-11-24  4:45 ` syzbot
  2026-11-24  6:00   ` net: act_gate bug. was: " Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2026-11-24  4:45 UTC (permalink / raw)
  To: akpm, andrii, ast, bpf, brauner, daniel, jack, jmorris,
	linux-fsdevel, linux-kernel, linux-mm, linux-security-module,
	netdev, paul, penguin-kernel, serge, syzkaller-bugs, takedakn,
	tomoyo-users_en, viro

syzbot has found a reproducer for the following issue on:

HEAD commit:    3896ae4adf5f tun: complete the zerocopy buffer of packets ..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=16305bbe580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d44b06612b68f56
dashboard link: https://syzkaller.appspot.com/bug?extid=b6f8640465bdf47ca708
compiler:       Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1740f363580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11305bbe580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ca6f81eb80f4/disk-3896ae4a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e88582fee6d7/vmlinux-3896ae4a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a978638f7ba7/bzImage-3896ae4a.xz

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

rcu: INFO: rcu_preempt self-detected stall on CPU
rcu: 	0-....: (10499 ticks this GP) idle=f474/1/0x4000000000000000 softirq=18751/18751 fqs=4770
rcu: 	         hardirqs   softirqs   csw/system
rcu: 	 number:     5264          0            0
rcu: 	cputime:      138      52351           25   ==> 52490(ms)
rcu: 	(t=10500 jiffies g=18789 q=10129 ncpus=2)
CPU: 0 UID: 0 PID: 5837 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x47/0x80 kernel/locking/spinlock.c:221
Code: f7 e8 3d d4 99 f5 f7 c3 00 02 00 00 74 05 e8 10 79 c6 f5 9c 58 a9 00 02 00 00 75 29 f7 c3 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> c4 c4 8a f5 65 48 8b 05 8c 0d d7 08 48 85 c0 74 18 5b 41 5e e9
RSP: 0018:ffffc90000007e18 EFLAGS: 00000206
RAX: 0000000000000002 RBX: 0000000000000287 RCX: 0000000000000101
RDX: 0000000000000003 RSI: ffffffff8e6a85cd RDI: 0000000000000001
RBP: ffff88807ed35538 R08: ffffffff91be1bbf R09: 1ffffffff237c377
R10: dffffc0000000000 R11: fffffbfff237c378 R12: ffff8880b8228600
R13: ffffffff89fd0480 R14: ffff8880b8228600 R15: 1ffff1101704514a
FS:  000055557acc5500(0000) GS:ffff8881233ff000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005612e0743768 CR3: 0000000077760000 CR4: 00000000003526f0
Call Trace:
 <IRQ>
 __run_hrtimer kernel/time/hrtimer.c:2075 [inline]
 __hrtimer_run_queues+0x2bf/0xa10 kernel/time/hrtimer.c:2136
 hrtimer_run_softirq+0x1e3/0x2e0 kernel/time/hrtimer.c:2153
 handle_softirqs+0x265/0x8d0 kernel/softirq.c:669
 __do_softirq kernel/softirq.c:703 [inline]
 invoke_softirq kernel/softirq.c:542 [inline]
 __irq_exit_rcu+0xc6/0x220 kernel/softirq.c:786
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:809
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:lock_acquire+0x232/0x350 kernel/locking/lockdep.c:5947
Code: ff ff ff e8 50 07 64 0a f7 44 24 10 00 02 00 00 0f 84 38 ff ff ff 65 48 8b 05 12 e1 3d 13 48 3b 44 24 50 75 33 fb 48 83 c4 58 <5b> 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc 48 8d 3d 37 27 1d
RSP: 0018:ffffc9000326f700 EFLAGS: 00000296
RAX: 3c7ff0ca9698f600 RBX: 0000000000000000 RCX: 0000000000000046
RDX: 000000000e8f2ff9 RSI: ffffffff8e936150 RDI: ffffffff8c8e9880
RBP: ffff8880281e8000 R08: ffffffff817889cf R09: 0000000000000000
R10: ffffc9000326f838 R11: ffffffff81b3b880 R12: ffffffff9015a2e0
R13: 0000000000000002 R14: 0000000000000000 R15: 0000000000000246
 rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
 rcu_read_lock include/linux/rcupdate.h:849 [inline]
 class_rcu_constructor include/linux/rcupdate.h:1216 [inline]
 unwind_next_frame+0xac/0x2550 arch/x86/kernel/unwind_orc.c:495
 arch_stack_walk+0x11b/0x150 arch/x86/kernel/stacktrace.c:25
 stack_trace_save+0xa9/0x100 kernel/stacktrace.c:122
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3f/0x90 mm/kasan/common.c:79
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:599
 poison_slab_object mm/kasan/common.c:267 [inline]
 __kasan_slab_free+0x70/0x90 mm/kasan/common.c:299
 kasan_slab_free include/linux/kasan.h:239 [inline]
 slab_free_hook mm/slub.c:2780 [inline]
 slab_free mm/slub.c:6637 [inline]
 kfree+0x1c7/0x650 mm/slub.c:6930
 tomoyo_path_number_perm+0x4ba/0x5f0 security/tomoyo/file.c:741
 security_file_ioctl+0xc3/0x2a0 security/security.c:2534
 __do_sys_ioctl fs/ioctl.c:592 [inline]
 __se_sys_ioctl+0x47/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2e4e9a91ab
Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00
RSP: 002b:00007fffff379100 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f2e4e9a91ab
RDX: 00007fffff379160 RSI: 0000000000008933 RDI: 0000000000000005
RBP: 00007f2e4ea394f3 R08: 0000000000000000 R09: 00007fffff379470
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003
R13: 00007f2e4f764620 R14: 0000000000000006 R15: 0000000000000000
 </TASK>
sched: DL replenish lagged too much

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

* net: act_gate bug. was: [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9)
  2026-11-24  4:45 ` [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9) syzbot
@ 2026-11-24  6:00   ` Alexei Starovoitov
  2026-11-24  6:11     ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Alexei Starovoitov @ 2026-11-24  6:00 UTC (permalink / raw)
  To: syzbot, akpm, andrii, bpf, brauner, daniel, jack, jmorris,
	linux-fsdevel, linux-kernel, linux-mm, linux-security-module,
	netdev, paul, penguin-kernel, serge, syzkaller-bugs, takedakn,
	jhs, netdev, tomoyo-users_en, viro

On Mon, Nov 23, 2026 at 08:45 PM syzbot <syzbot+b6f8640465bdf47ca708@syzkaller.appspotmail.com> wrote:
> rcu: 	         hardirqs   softirqs   csw/system
> rcu: 	 number:     5264          0            0
> rcu: 	cputime:      138      52351           25   ==> 52490(ms)

It's not tomoyo, mm or bpf. Looks like act_gate.
Zero new softirqs in 52 sec, so one hrtimer_run_softirq() doesn't return.

> RBP: ffff88807ed35538 R08: ffffffff91be1bbf R09: 1ffffffff237c377
> R10: dffffc0000000000 R11: fffffbfff237c378 R12: ffff8880b8228600
> R13: ffffffff89fd0480 R14: ffff8880b8228600 R15: 1ffff1101704514a

The registers with lockdep struct sizes:

  reg       value             points to
  --------  ----------------  --------------------------------------
  R14       ffff8880b8228600  cpu_base
  R15 << 3  ffff8880b8228a50  clock_base[HRTIMER_BASE_TAI_SOFT].seq
  RBP       ffff88807ed35538  kmalloc-512 + 0x138, tcf_gate->hitimer

act_gate has the only soft hrtimer that can be on CLOCK_TAI.
bpf_timer_init() rejects that clock.

TCA_GATE_CYCLE_TIME is an unchecked u64. In gate_timer_func():

  n = div64_u64(ktime_sub_ns(now, base), cycle);
  close_time = ktime_add_ns(base, (n + 1) * cycle);

With base = 0 and cycle = U64_MAX, n is 0 and close_time is -1.
The timer restarts in the past and __hrtimer_run_queues() runs it again.
It's there since
commit a51c328df310 ("net: qos: introduce a gate control flow action").

Jamal,
taprio's INT_MAX limit doesn't fit. tdc uses cycle-time of 600 sec.
The diff saturates the sum instead.
Here is a potential fix:

diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
index 711cf24..5422d60 100644
--- a/net/sched/act_gate.c
+++ b/net/sched/act_gate.c
@@ -45,8 +45,9 @@ static void gate_get_start_time(struct tcf_gate *gact,
 				const struct tcf_gate_params *param,
 				ktime_t *start)
 {
-	ktime_t now, base, cycle;
-	u64 n;
+	u64 cycle = param->tcfg_cycletime;
+	ktime_t now, base;
+	u64 rem;
 
 	base = ns_to_ktime(param->tcfg_basetime);
 	now = gate_get_time(gact);
@@ -56,10 +57,9 @@ static void gate_get_start_time(struct tcf_gate *gact,
 		return;
 	}
 
-	cycle = param->tcfg_cycletime;
-
-	n = div64_u64(ktime_sub_ns(now, base), cycle);
-	*start = ktime_add_ns(base, (n + 1) * cycle);
+	/* cycle is an unchecked u64, the sum must not wrap into the past */
+	div64_u64_rem(ktime_sub(now, base), cycle, &rem);
+	*start = ktime_add_safe(now, cycle - rem);
 }
 
 static void gate_start_timer(struct tcf_gate *gact, ktime_t start)
@@ -107,15 +107,8 @@ 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 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);
-	}
+	if (ktime_after(now, close_time))
+		gate_get_start_time(gact, p, &close_time);
 
 	gact->next_entry = next;
 

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

* Re: net: act_gate bug. was: [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9)
  2026-11-24  6:00   ` net: act_gate bug. was: " Alexei Starovoitov
@ 2026-11-24  6:11     ` sashiko-bot
  0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-24  6:11 UTC (permalink / raw)
  To: Alexei Starovoitov, syzbot, akpm, andrii, bpf, brauner, daniel,
	jack, jmorris, linux-mm, linux-security-module, paul,
	penguin-kernel, serge, syzkaller-bugs, takedakn, jhs, viro

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] net/sched: act_gate: missing Signed-off-by trailer in commit
  message
- [Low] net/sched: act_gate: missing Fixes trailer in commit message
--

commit 1dfca74c316eb54b3672929b3411874232eb4ee7
Author: Alexei Starovoitov <ast@kernel.org>

> net: act_gate bug. was: [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9)
>
> On Mon, Nov 23, 2026 at 08:45 PM syzbot <syzbot+b6f8640465bdf47ca708@syzkaller.appspotmail.com> wrote:
> > rcu:           hardirqs   softirqs   csw/system
> > rcu:   number:     5264          0            0
> > rcu:  cputime:      138      52351           25   ==> 52490(ms)
>
> It's not tomoyo, mm or bpf. Looks like act_gate.
> Zero new softirqs in 52 sec, so one hrtimer_run_softirq() doesn't return.
>
> > RBP: ffff88807ed35538 R08: ffffffff91be1bbf R09: 1ffffffff237c377
> > R10: dffffc0000000000 R11: fffffbfff237c378 R12: ffff8880b8228600
> > R13: ffffffff89fd0480 R14: ffff8880b8228600 R15: 1ffff1101704514a
>
> The registers with lockdep struct sizes:
>
>   reg       value             points to
>   --------  ----------------  --------------------------------------
>   R14       ffff8880b8228600  cpu_base
>   R15 << 3  ffff8880b8228a50  clock_base[HRTIMER_BASE_TAI_SOFT].seq
>   RBP       ffff88807ed35538  kmalloc-512 + 0x138, tcf_gate->hitimer
>
> act_gate has the only soft hrtimer that can be on CLOCK_TAI.
> bpf_timer_init() rejects that clock.
>
> TCA_GATE_CYCLE_TIME is an unchecked u64. In gate_timer_func():
>
>   n = div64_u64(ktime_sub_ns(now, base), cycle);
>   close_time = ktime_add_ns(base, (n + 1) * cycle);
>
> With base = 0 and cycle = U64_MAX, n is 0 and close_time is -1.
> The timer restarts in the past and __hrtimer_run_queues() runs it again.
> It's there since
> commit a51c328df310 ("net: qos: introduce a gate control flow action").
>
> Jamal,
> taprio's INT_MAX limit doesn't fit. tdc uses cycle-time of 600 sec.
> The diff saturates the sum instead.
> Here is a potential fix:

[Severity: High]
The commit message is missing a Signed-off-by: trailer.

[Severity: Low]
Since this fixes an infinite softirq loop when TCA_GATE_CYCLE_TIME overflows
the timer expiration timestamp, should this include a Fixes: trailer?

  Fixes: a51c328df310 ("net: qos: introduce a gate control flow action")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/DN37NBGPJJG9.2DSVDCKS3UYTV@gmail.com?part=1

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

end of thread, other threads:[~2026-11-24  6:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <673fdc18.050a0220.363a1b.012c.GAE@google.com>
2026-11-24  4:45 ` [syzbot] [tomoyo?] [mm?] INFO: rcu detected stall in security_file_ioctl (9) syzbot
2026-11-24  6:00   ` net: act_gate bug. was: " Alexei Starovoitov
2026-11-24  6:11     ` sashiko-bot

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