| 0/0 |
2026/08/09 09:15 |
flow |
assessment-security |
6m
Results: map[DenialOfService:true Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Root Cause Analysis:**
The bug report indicates an RCU stall where the `rcu_preempt` kthread is starved
of CPU time for a long period (1648 jiffies). The stack trace for CPU 1 shows
that it is constantly processing network softirqs (`NET_RX_SOFTIRQ`) triggered
by the timer interrupt (`sysvec_apic_timer_interrupt`), which interrupted a user
task performing a socket read (`tcp_recvmsg` -> `_copy_to_iter`).
The kernel log repeatedly prints:
`bridge0: received packet on veth0 with own address as source address
(addr:aa:aa:aa:aa:aa:19, vlan:0)`
This message (emitted by `br_fdb_update` in the bridge code) is a classic
symptom of a **packet loop** at the Layer 2/Layer 3 boundary.
When a packet loop is created (e.g., bridging a `veth` interface to itself or
creating a routing loop between namespaces), packets are continuously received,
routed, and transmitted without being dropped. This causes a "softirq storm".
Although `net_rx_action` has a budget (usually 300 packets or 2ms) and yields to
prevent soft lockups, the Linux softirq design will re-invoke `__do_softirq()`
on every timer interrupt return if the interrupted task hasn't exhausted its CFS
timeslice (`need_resched()` is false). Because the interrupted task
(`tcp_recvmsg`) gets very little actual CPU time, its virtual runtime increases
very slowly, preventing it from being preempted by CFS. Consequently, normal
priority kthreads like `rcu_preempt` and `ksoftirqd` are completely starved of
CPU time. The starvation of `rcu_preempt` prevents RCU grace periods from
completing, leading to the reported RCU stall and potential OOM (as RCU
callbacks accumulate).
**Security Impact:**
* **Exploitable:** False. This is a resource exhaustion issue (CPU time and
softirq processing). There is no memory corruption, out-of-bounds access, or
information leak that could be leveraged for privilege escalation or arbitrary
code execution.
* **Denial of Service (DoS):** True. The softirq storm starves critical kernel
threads, leading to RCU stalls, system unresponsiveness, and eventually OOM or a
kernel panic (if `panic_on_rcu_stall` is configured).
* **Accessible From Unprivileged Processes:** False. Creating bridges, `veth`
pairs, and configuring routing rules requires `CAP_NET_ADMIN`. A standard
unprivileged process on the host cannot do this.
* **Accessible From User Namespaces:** True. An unprivileged user can create a
new user namespace and a new network namespace. Within this namespace, they gain
`CAP_NET_ADMIN` and can freely create bridges, `veth` devices, and routing rules
to intentionally construct a packet loop and trigger the DoS against the host
system. Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/08/09 09:15 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/08/09 09:15 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/ab831c5afa3b96adfab9e3e8fdf4b69fc7dd87fb]
|
| 3/1 |
2026/08/09 09:15 |
action |
kernel-builder |
0m
Results: map[KernelObj:/app/workdir/cache/build/7188977e0aa0a2e3eed7ca3be126f5532b24701b]
|
| 4/1 |
2026/08/09 09:15 |
action |
codesearch-prepare |
0m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/08/09 09:16 |
agent |
expert |
5m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
rcu: Tasks blocked on level-0 rcu_node (CPUs 0-1): P5644/1:b..l P6704/1:b..l P5620/1:b..l
rcu: (detected by 1, t=10503 jiffies, g=50145, q=553 ncpus=2)
task:syz-executor state:R running task stack:22552 pid:5620 tgid:5620 ppid:5615 task_flags:0x400140 flags:0x00080000
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x17d9/0x56c0 kernel/sched/core.c:7234
preempt_schedule_common+0x82/0xd0 kernel/sched/core.c:7413
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:169 [inline]
_raw_spin_unlock+0x3f/0x50 kernel/locking/spinlock.c:190
spin_unlock include/linux/spinlock.h:390 [inline]
copy_pte_range mm/memory.c:1347 [inline]
copy_pmd_range+0x4e08/0x5880 mm/memory.c:1408
copy_pud_range mm/memory.c:1445 [inline]
copy_p4d_range mm/memory.c:1469 [inline]
copy_page_range+0xc26/0x1250 mm/memory.c:1555
dup_mmap+0xf21/0x1d90 mm/mmap.c:1840
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e3e/0x4390 kernel/fork.c:2289
kernel_clone+0x2d7/0x940 kernel/fork.c:2748
__do_sys_clone kernel/fork.c:2889 [inline]
__se_sys_clone kernel/fork.c:2873 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2873
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff9863c6b52
RSP: 002b:00007ffd6c1e43b0 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007ffd6c1e43b0 RCX: 00007ff9863c6b52
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007ffd6c1e453c R08: 0000000000000000 R09: 0000000000000001
R10: 00005555629457d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 000000000004fe7e R15: 00007ffd6c1e4590
</TASK>
task:syz-executor state:R running task stack:22416 pid:6704 tgid:6704 ppid:6695 task_flags:0x400140 flags:0x00080000
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x17d9/0x56c0 kernel/sched/core.c:7234
preempt_schedule_common+0x82/0xd0 kernel/sched/core.c:7413
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:169 [inline]
_raw_spin_unlock+0x3f/0x50 kernel/locking/spinlock.c:190
spin_unlock include/linux/spinlock.h:390 [inline]
copy_pte_range mm/memory.c:1347 [inline]
copy_pmd_range+0x4e08/0x5880 mm/memory.c:1408
copy_pud_range mm/memory.c:1445 [inline]
copy_p4d_range mm/memory.c:1469 [inline]
copy_page_range+0xc26/0x1250 mm/memory.c:1555
dup_mmap+0xf21/0x1d90 mm/mmap.c:1840
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e3e/0x4390 kernel/fork.c:2289
kernel_clone+0x2d7/0x940 kernel/fork.c:2748
__do_sys_clone kernel/fork.c:2889 [inline]
__se_sys_clone kernel/fork.c:2873 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2873
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f35ef5c6b52
RSP: 002b:00007ffd74cd0d30 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007ffd74cd0d30 RCX: 00007f35ef5c6b52
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007ffd74cd0ebc R08: 0000000000000000 R09: 0000000000000001
R10: 000055556c52a7d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 000000000004fe59 R15: 00007ffd74cd0f10
</TASK>
task:syz-executor state:R running task stack:21960 pid:5644 tgid:5644 ppid:5616 task_flags:0x400140 flags:0x00080000
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x17d9/0x56c0 kernel/sched/core.c:7234
preempt_schedule_common+0x82/0xd0 kernel/sched/core.c:7413
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:169 [inline]
_raw_spin_unlock+0x3f/0x50 kernel/locking/spinlock.c:190
spin_unlock include/linux/spinlock.h:390 [inline]
copy_pte_range mm/memory.c:1347 [inline]
copy_pmd_range+0x4e08/0x5880 mm/memory.c:1408
copy_pud_range mm/memory.c:1445 [inline]
copy_p4d_range mm/memory.c:1469 [inline]
copy_page_range+0xc26/0x1250 mm/memory.c:1555
dup_mmap+0xf21/0x1d90 mm/mmap.c:1840
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e3e/0x4390 kernel/fork.c:2289
kernel_clone+0x2d7/0x940 kernel/fork.c:2748
__do_sys_clone kernel/fork.c:2889 [inline]
__se_sys_clone kernel/fork.c:2873 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2873
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc3481c6b52
RSP: 002b:00007ffd9942cbc0 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007ffd9942cbc0 RCX: 00007fc3481c6b52
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007ffd9942cd4c R08: 0000000000000000 R09: 0000000000000001
R10: 000055555ce4c7d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 000000000004ff21 R15: 00007ffd9942cda0
</TASK>
rcu: rcu_preempt kthread starved for 1648 jiffies! g50145 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x0 ->cpu=1
rcu: Unless rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior.
rcu: RCU grace-period kthread stack dump:
task:rcu_preempt state:R running task stack:27496 pid:16 tgid:16 ppid:2 task_flags:0x208040 flags:0x00080000
Call Trace:
<TASK>
context_switch kernel/sched/core.c:5510 [inline]
__schedule+0x17d9/0x56c0 kernel/sched/core.c:7234
__schedule_loop kernel/sched/core.c:7311 [inline]
schedule+0x164/0x2b0 kernel/sched/core.c:7326
schedule_timeout+0x152/0x2c0 kernel/time/sleep_timeout.c:99
rcu_gp_fqs_loop+0x30c/0x11f0 kernel/rcu/tree.c:2123
rcu_gp_kthread+0x9e/0x2b0 kernel/rcu/tree.c:2325
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
rcu: Stack dump where RCU GP kthread last ran:
CPU: 1 UID: 0 PID: 5606 Comm: sshd-session Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:__in6_dev_get include/net/addrconf.h:348 [inline]
RIP: 0010:ip6_ignore_linkdown+0x29/0x140 include/net/addrconf.h:457
Code: 90 55 41 56 53 48 89 fb 49 be 00 00 00 00 00 fc ff df e8 2a 0a 48 f7 48 81 c3 c0 00 00 00 48 89 d8 48 c1 e8 03 42 80 3c 30 00 <74> 08 48 89 df e8 2d a3 b5 f7 48 8b 1b e8 05 42 52 01 89 c5 31 ff
RSP: 0018:ffffc90000a080b8 EFLAGS: 00000246
RAX: 1ffff110069db818 RBX: ffff888034edc0c0 RCX: ffff88803591dd00
RDX: 0000000000000100 RSI: 0000000000000000 RDI: ffff888034edc000
RBP: 1ffff1100fa1c199 R08: ffffc90000a083e0 R09: ffffc90000a083f0
R10: dffffc0000000000 R11: fffff5200014104a R12: 0000000000000003
R13: ffff88807d0e0cc8 R14: dffffc0000000000 R15: 0000000000000001
FS: 00007f2dd3e09300(0000) GS:ffff88812504b000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffc28efebb0 CR3: 000000007796a000 CR4: 0000000000350ef0
Call Trace:
<IRQ>
find_match+0x9c/0xb40 net/ipv6/route.c:783
__find_rr_leaf+0x243/0x740 net/ipv6/route.c:872
find_rr_leaf net/ipv6/route.c:893 [inline]
rt6_select net/ipv6/route.c:937 [inline]
fib6_table_lookup+0x3c6/0xae0 net/ipv6/route.c:2255
ip6_pol_route+0x229/0x14d0 net/ipv6/route.c:2292
pol_lookup_func include/net/ip6_fib.h:669 [inline]
__fib6_rule_action net/ipv6/fib6_rules.c:240 [inline]
fib6_rule_action+0x9d7/0xc00 net/ipv6/fib6_rules.c:278
fib_rules_lookup+0x770/0xeb0 net/core/fib_rules.c:340
fib6_rule_lookup+0x1a0/0x730 net/ipv6/fib6_rules.c:115
ip6_route_input_lookup net/ipv6/route.c:2363 [inline]
ip6_route_input+0x78d/0xb20 net/ipv6/route.c:2666
ip6_rcv_finish+0x141/0x280 net/ipv6/ip6_input.c:117
NF_HOOK+0x336/0x3c0 include/linux/netfilter.h:318
__netif_receive_skb_one_core net/core/dev.c:6212 [inline]
__netif_receive_skb net/core/dev.c:6325 [inline]
process_backlog+0x774/0x1860 net/core/dev.c:6676
__napi_poll+0xaa/0x330 net/core/dev.c:7735
napi_poll net/core/dev.c:7798 [inline]
net_rx_action+0x61d/0xf50 net/core/dev.c:7955
handle_softirqs+0x225/0x840 kernel/softirq.c:622
__do_softirq kernel/softirq.c:656 [inline]
invoke_softirq kernel/softirq.c:496 [inline]
__irq_exit_rcu+0xca/0x220 kernel/softirq.c:735
irq_exit_rcu+0x9/0x30 kernel/softirq.c:752
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:__might_fault+0xcf/0x130 mm/memory.c:7292
Code: 03 00 00 4c 8d 35 00 00 00 00 4c 89 ff 31 f6 31 d2 b9 01 00 00 00 41 b8 01 00 00 00 45 31 c9 41 56 e8 d5 d4 86 ff 48 83 c4 08 <43> 80 7c 25 00 00 74 08 48 89 df e8 41 ba 18 00 bf b8 03 00 00 48
RSP: 0018:ffffc900036873a8 EFLAGS: 00000282
RAX: e21d31b93456f200 RBX: ffff88803591e2c0 RCX: 0000000000000046
RDX: 000000002b78ce32 RSI: ffffffff8e4b425c RDI: ffffffff8c4bdd80
RBP: 00000000000000c4 R08: ffffffff821bf13f R09: 0000000000000000
R10: 0000000000000000 R11: ffff88807b4d7678 R12: dffffc0000000000
R13: 1ffff11006b23c58 R14: ffffffff821bf13f R15: ffff88807b4d7678
_copy_to_iter+0xf9/0x1810 lib/iov_iter.c:196
copy_to_iter include/linux/uio.h:220 [inline]
simple_copy_to_iter net/core/datagram.c:521 [inline]
__skb_datagram_iter+0xf8/0x980 net/core/datagram.c:402
skb_copy_datagram_iter+0xb5/0x240 net/core/datagram.c:535
skb_copy_datagram_msg include/linux/skbuff.h:4244 [inline]
tcp_recvmsg_locked+0xf79/0x3800 net/ipv4/tcp.c:2840
tcp_recvmsg+0x203/0x7f0 net/ipv4/tcp.c:2944
sock_recvmsg_nosec net/socket.c:1128 [inline]
sock_recvmsg+0x166/0x1e0 net/socket.c:1148
sock_read_iter+0x22a/0x2f0 net/socket.c:1217
new_sync_read fs/read_write.c:493 [inline]
vfs_read+0x595/0xa80 fs/read_write.c:574
ksys_read+0x150/0x270 fs/read_write.c:716
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2dd36a7407
Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff420d02a0 EFLAGS: 00000202 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f2dd3e09300 RCX: 00007f2dd36a7407
RDX: 0000000000040000 RSI: 00007f2dd3da4010 RDI: 0000000000000004
RBP: 00007fff420d0350 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 0000000000000004 R14: 000055deb09a95f0 R15: 0000000000000004
</TASK>
net_ratelimit: 3430 callbacks suppressed
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)
Reply: Based on the analysis of the bug report and the kernel source code, here is the assessment of the vulnerability:
**Root Cause Analysis:**
The bug report indicates an RCU stall where the `rcu_preempt` kthread is starved of CPU time for a long period (1648 jiffies). The stack trace for CPU 1 shows that it is constantly processing network softirqs (`NET_RX_SOFTIRQ`) triggered by the timer interrupt (`sysvec_apic_timer_interrupt`), which interrupted a user task performing a socket read (`tcp_recvmsg` -> `_copy_to_iter`).
The kernel log repeatedly prints:
`bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)`
This message (emitted by `br_fdb_update` in the bridge code) is a classic symptom of a **packet loop** at the Layer 2/Layer 3 boundary.
When a packet loop is created (e.g., bridging a `veth` interface to itself or creating a routing loop between namespaces), packets are continuously received, routed, and transmitted without being dropped. This causes a "softirq storm". Although `net_rx_action` has a budget (usually 300 packets or 2ms) and yields to prevent soft lockups, the Linux softirq design will re-invoke `__do_softirq()` on every timer interrupt return if the interrupted task hasn't exhausted its CFS timeslice (`need_resched()` is false). Because the interrupted task (`tcp_recvmsg`) gets very little actual CPU time, its virtual runtime increases very slowly, preventing it from being preempted by CFS. Consequently, normal priority kthreads like `rcu_preempt` and `ksoftirqd` are completely starved of CPU time. The starvation of `rcu_preempt` prevents RCU grace periods from completing, leading to the reported RCU stall and potential OOM (as RCU callbacks accumulate).
**Security Impact:**
* **Exploitable:** False. This is a resource exhaustion issue (CPU time and softirq processing). There is no memory corruption, out-of-bounds access, or information leak that could be leveraged for privilege escalation or arbitrary code execution.
* **Denial of Service (DoS):** True. The softirq storm starves critical kernel threads, leading to RCU stalls, system unresponsiveness, and eventually OOM or a kernel panic (if `panic_on_rcu_stall` is configured).
* **Accessible From Unprivileged Processes:** False. Creating bridges, `veth` pairs, and configuring routing rules requires `CAP_NET_ADMIN`. A standard unprivileged process on the host cannot do this.
* **Accessible From User Namespaces:** True. An unprivileged user can create a new user namespace and a new network namespace. Within this namespace, they gain `CAP_NET_ADMIN` and can freely create bridges, `veth` devices, and routing rules to intentionally construct a packet loop and trigger the DoS against the host system.
|
| 6/2 |
2026/08/09 09:16 |
llm |
expert |
0m
Model:
Tokens:
input: 12935
output: 24
thoughts: 713
Thoughts: **RCU Stall Investigation**
Okay, here's what's running through my mind as I look at this RCU stall report. We have an RCU preempt stall, with tasks blocked on CPUs 0 and 1. The key tasks involved are hanging in the `copy_page_range` code path, specifically at the `preempt_schedule_thunk` point, which leads to `__schedule`. Initially, I was thinking spinlock contention, but the trace clearly shows these tasks are getting preempted. Aha, and the RCU grace period (GP) kthread is starved for a significant chunk of time, 1648 jiffies. That's a red flag.
Now, what is CPU 1 doing? The call trace tells the story: it's deep within the networking stack. Itβs in a softirq, processing packets. Weβre seeing a trace: `__in6_dev_get` all the way through to `sysvec_apic_timer_interrupt`. This shows the CPU handling network traffic. It seems to be repeatedly processing packets.
And then, this log message catches my eye: `bridge0: received packet on veth0 with own address as source address (addr:aa:aa:aa:aa:aa:19, vlan:0)`. This message is repeated several times, it shouts "packet loop"! This is probably coming from something like `br_handle_frame` or a similar bridge function.
Itβs possible that the network packet handling is starving the RCU kthread, but it's more likely this looping behavior on the bridge is causing the problem. A bridge packet loop would explain the high network load on CPU 1, and the resulting RCU stall. We've got a bridge, and we are seeing packets, that are received from the bridge itself! That would stall everything out and could easily cause the RCU stall. Time to dive into the bridge code and see whatβs going on with that `veth0` interface and why a packet is being looped back in. We need to confirm this loop and see how to get out of it, or what's sending the traffic in the first place.
|
| 7/2 |
2026/08/09 09:16 |
tool |
grepper |
0m
Args: map[Expression:received packet on .* with own address as source address]
Results: map[Output:net/bridge/br_fdb.c=973=void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
--
net/bridge/br_fdb.c-986- if (net_ratelimit())
net/bridge/br_fdb.c:987: br_warn(br, "received packet on %s with own address as source address (addr:%pM, vlan:%u)\n",
net/bridge/br_fdb.c-988- source->dev->name, addr, vid);
]
|
| 8/2 |
2026/08/09 09:16 |
llm |
expert |
0m
Model:
Tokens:
input: 14299
output: 38
thoughts: 92
Thoughts: **Debugging a Potential RCU Stall**
Okay, so `br_fdb_update` is spitting out this message, which is a red flag. My immediate concern is a potential packet loop, as that's a common trigger for RCU stalls. Let's dig deeper. The stack trace on CPU 1 is intriguing, showing `ip6_route_input` and `fib6_rule_lookup`. Now, is it an infinite loop within `fib6_rule_lookup` itself, or is the problem downstream in `fib_rules_lookup`? I need to focus on the latter; let's check `fib_rules_lookup` first to get a better handle on the situation.
|
| 9/2 |
2026/08/09 09:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/fib_rules.c Name:fib_rules_lookup]
Results: map[SourceCode: 313: int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
314: int flags, struct fib_lookup_arg *arg)
315: {
316: struct fib_rule *rule;
317: int err;
318:
319: rcu_read_lock();
320:
321: list_for_each_entry_rcu(rule, &ops->rules_list, list) {
322: jumped:
323: if (!fib_rule_match(rule, ops, fl, flags, arg))
324: continue;
325:
326: if (rule->action == FR_ACT_GOTO) {
327: struct fib_rule *target;
328:
329: target = rcu_dereference(rule->ctarget);
330: if (target == NULL) {
331: continue;
332: } else {
333: rule = target;
334: goto jumped;
335: }
336: } else if (rule->action == FR_ACT_NOP)
337: continue;
338: else
339: err = INDIRECT_CALL_MT(ops->action,
340: fib6_rule_action,
341: fib4_rule_action,
342: rule, fl, flags, arg);
343:
344: if (!err && ops->suppress && INDIRECT_CALL_MT(ops->suppress,
345: fib6_rule_suppress,
346: fib4_rule_suppress,
347: rule, flags, arg))
348: continue;
349:
350: if (err != -EAGAIN) {
351: if ((arg->flags & FIB_LOOKUP_NOREF) ||
352: likely(fib_rule_get_safe(rule))) {
353: arg->rule = rule;
354: goto out;
355: }
356: break;
357: }
358: }
359:
360: err = -ESRCH;
361: out:
362: rcu_read_unlock();
363:
364: return err;
365: }
SourceFile:net/core/fib_rules.c]
|
| 10/2 |
2026/08/09 09:16 |
llm |
expert |
0m
Model:
Tokens:
input: 15308
output: 35
thoughts: 569
Thoughts: **Debugging a Persistent Network Issue**
Okay, so I'm seeing a performance issue, and it seems network-related. I was initially worried about a looping issue within `fib_rules_lookup` due to `FR_ACT_GOTO` actions, but that doesn't appear to be the direct cause because `fib_rule_match` is correctly invoked. The stack trace is pointing towards a normal route lookup through the IPv6 route lookup process. The flow is typical, which has me stumped: I'm seeing `find_match`, `__find_rr_leaf`, `find_rr_leaf`, `rt6_select`, `fib6_table_lookup`, `ip6_pol_route`, `pol_lookup_func`, `__fib6_rule_action`, `fib6_rule_action`, and finally, the now suspect `fib_rules_lookup`. This looks like a standard lookup.
But, why the slowness? Could it be a packet loop? If a packet is looping, then `net_rx_action`'s budget exhaustion could be the culprit because it keeps processing until its budget is consumed. Let's look at this: `process_backlog` -> `__netif_receive_skb` -> `ip6_rcv_finish` -> `ip6_route_input` -> `fib6_rule_lookup`. Now, if the loop is happening in a bridge configuration, the packet would be sent out a port and then received again. The log entry about `bridge0` receiving a packet on `veth0` with its own MAC address as the source is pretty telling! That's a classic symptom of a loop!
The bridge is receiving a packet with its own MAC as the source, which indicates a packet is sent out a veth interface and looped back in, but wait... `process_backlog` processes the backlog, and if there's a loop, it could be flooding the system, leading to RCU stalls. So, is this a kernel bug, or just a network misconfiguration? Packet loops are generally misconfigurations, but if an unprivileged user can *cause* an RCU stall through this loop, then it's a DoS vulnerability.
Can an unprivileged user set this up? Can they create a bridge and a veth pair within a user namespace and then craft the loop? The answer is yes. Now, the stack trace also shows `__might_fault` in `_copy_to_iter` from `tcp_recvmsg`. That's interesting, and CPU 1 is in softirq. Does this imply that the RCU stall is happening because CPU 1 is stuck in softirq for an extended period?
But wait, `net_rx_action` has a budget (typically 300 packets) and a time limit (2 jiffies). It *should* yield, so why wouldn't it? I need to check `process_backlog` to understand what's happening.
|
| 11/2 |
2026/08/09 09:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:process_backlog]
Results: map[SourceCode:6654: static int process_backlog(struct napi_struct *napi, int quota)
6655: {
6656: struct softnet_data *sd = container_of(napi, struct softnet_data, backlog);
6657: bool again = true;
6658: int work = 0;
6659:
6660: /* Check if we have pending ipi, its better to send them now,
6661: * not waiting net_rx_action() end.
6662: */
6663: if (sd_has_rps_ipi_waiting(sd)) {
6664: local_irq_disable();
6665: net_rps_action_and_irq_enable(sd);
6666: }
6667:
6668: napi->weight = READ_ONCE(net_hotdata.dev_rx_weight);
6669: while (again) {
6670: struct sk_buff *skb;
6671:
6672: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6673: while ((skb = __skb_dequeue(&sd->process_queue))) {
6674: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6675: rcu_read_lock();
6676: __netif_receive_skb(skb);
6677: rcu_read_unlock();
6678: if (++work >= quota) {
6679: rps_input_queue_head_add(sd, work);
6680: return work;
6681: }
6682:
6683: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6684: }
6685: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6686:
6687: backlog_lock_irq_disable(sd);
6688: if (skb_queue_empty(&sd->input_pkt_queue)) {
6689: /*
6690: * Inline a custom version of __napi_complete().
6691: * only current cpu owns and manipulates this napi,
6692: * and NAPI_STATE_SCHED is the only possible flag set
6693: * on backlog.
6694: * We can use a plain write instead of clear_bit(),
6695: * and we dont need an smp_mb() memory barrier.
6696: */
6697: napi->state &= NAPIF_STATE_THREADED;
6698: again = false;
6699: } else {
6700: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6701: skb_queue_splice_tail_init(&sd->input_pkt_queue,
6702: &sd->process_queue);
6703: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6704: }
6705: backlog_unlock_irq_enable(sd);
6706: }
6707:
6708: if (work)
6709: rps_input_queue_head_add(sd, work);
6710: return work;
6711: }
SourceFile:net/core/dev.c]
|
| 12/2 |
2026/08/09 09:16 |
llm |
expert |
0m
Model:
Tokens:
input: 17521
output: 36
thoughts: 73
Thoughts: Here's my understanding of the packet processing flow, focusing on the key limits:
**Packet Processing Flow and Quota**
Okay, so I've been tracing the packet processing mechanism and I've zeroed in on the key points. `process_backlog` is the core function I'm interested in here, and it seems to be the one that actually chews through packets. The important thing to note is that it returns when a certain amount of work, which they've termed `work`, meets or exceeds `quota`. This `quota` limit is being passed in, and that's where things get interesting.
I see that `__napi_poll` is the function that provides this `quota`. I need to track where that's coming from. Alright, so `__napi_poll` gets its `quota` directly from `napi->weight`. Now, that `weight` field. From what I'm looking at in the codebase, the default value there is typically 64. So that clarifies it. In most cases, it processes a maximum of 64 packets per call. This value is what seems to limit how much work is done each time.
Then, to put it all together. The function `net_rx_action` is the function that is responsible for calling `__napi_poll`, which starts this whole process.
|
| 13/2 |
2026/08/09 09:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:net_rx_action]
Results: map[SourceCode:7916: static __latent_entropy void net_rx_action(void)
7917: {
7918: struct softnet_data *sd = this_cpu_ptr(&softnet_data);
7919: unsigned long time_limit = jiffies +
7920: usecs_to_jiffies(READ_ONCE(net_hotdata.netdev_budget_usecs));
7921: struct bpf_net_context __bpf_net_ctx, *bpf_net_ctx;
7922: int budget = READ_ONCE(net_hotdata.netdev_budget);
7923: LIST_HEAD(list);
7924: LIST_HEAD(repoll);
7925:
7926: bpf_net_ctx = bpf_net_ctx_set(&__bpf_net_ctx);
7927: start:
7928: sd->in_net_rx_action = true;
7929: local_irq_disable();
7930: list_splice_init(&sd->poll_list, &list);
7931: local_irq_enable();
7932:
7933: for (;;) {
7934: struct napi_struct *n;
7935:
7936: skb_defer_free_flush();
7937:
7938: if (list_empty(&list)) {
7939: if (list_empty(&repoll)) {
7940: sd->in_net_rx_action = false;
7941: barrier();
7942: /* We need to check if ____napi_schedule()
7943: * had refilled poll_list while
7944: * sd->in_net_rx_action was true.
7945: */
7946: if (!list_empty(&sd->poll_list))
7947: goto start;
7948: if (!sd_has_rps_ipi_waiting(sd))
7949: goto end;
7950: }
7951: break;
7952: }
7953:
7954: n = list_first_entry(&list, struct napi_struct, poll_list);
7955: budget -= napi_poll(n, &repoll);
7956:
7957: /* If softirq window is exhausted then punt.
7958: * Allow this to run for 2 jiffies since which will allow
7959: * an average latency of 1.5/HZ.
7960: */
7961: if (unlikely(budget <= 0 ||
7962: time_after_eq(jiffies, time_limit))) {
7963: /* Pairs with READ_ONCE() in softnet_seq_show() */
7964: WRITE_ONCE(sd->time_squeeze, sd->time_squeeze + 1);
7965: break;
7966: }
7967: }
7968:
7969: local_irq_disable();
7970:
7971: list_splice_tail_init(&sd->poll_list, &list);
7972: list_splice_tail(&repoll, &list);
7973: list_splice(&list, &sd->poll_list);
7974: if (!list_empty(&sd->poll_list))
7975: __raise_softirq_irqoff(NET_RX_SOFTIRQ);
7976: else
7977: sd->in_net_rx_action = false;
7978:
7979: net_rps_action_and_irq_enable(sd);
7980: end:
7981: bpf_net_ctx_clear(bpf_net_ctx);
7982: }
SourceFile:net/core/dev.c]
|
| 14/2 |
2026/08/09 09:16 |
llm |
expert |
0m
Model:
Tokens:
input: 19000
output: 37
thoughts: 72
Thoughts: Here's my take on the process, thinking through it as an expert would:
**Network Packet Reception Flow**
Okay, so `net_rx_action` is the workhorse here, chugging through incoming network packets. I see it's set up with some sensible limits. It's designed to handle a chunk of packets, specifically up to `netdev_budget`, which is set to 300 in this case, or it has a time budget of `netdev_budget_usecs`, 2000 microseconds, to complete this job. It's a pragmatic approach β we don't want this routine hogging the CPU indefinitely.
The key thing is that if either of those limits β packet count or time β is reached *before* all the work is done, it's designed to break out. Instead of processing everything in one go, it gracefully exits and raises `NET_RX_SOFTIRQ` again. That's crucial. Raising the soft interrupt schedules it to be handled later. So, the kernel scheduler can then return to `__do_softirq` and eventually handle the remaining packets. It's a nice design that allows the system to remain responsive, and not get bogged down processing all the packets at once. That's a classic and efficient technique for dealing with potentially unbounded bursts of incoming traffic. Clever.
|
| 15/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:__do_softirq]
Results: map[SourceCode: 654: asmlinkage __visible void __softirq_entry __do_softirq(void)
655: {
656: handle_softirqs(false);
657: }
SourceFile:kernel/softirq.c]
|
| 16/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 19485
output: 36
thoughts: 11
Thoughts: Okay, here's my attempt at summarizing the thought process, as if I were thinking it:
**Diving into `handle_softirqs`**
Right, let's take a look at `handle_softirqs`. I need to refresh my understanding of how this crucial function operates. It's the core of soft interrupt handling, so pinpointing the flow and any potential bottlenecks is key. I'll need to remember the interrupt context, how the softirq vectors are processed, and the interactions with the scheduler. I'll mentally map the code in my head, focusing on things like the `irq_work` mechanism, any lock contention that might arise, and potential race conditions. I'm going to want to verify the atomic operations used to protect shared data structures and ensure they are all correctly implemented. Any potential issues with nested softirq calls are of particular interest. Let's see how well it scales under load, the interrupt latency. I want to look at where the priorities are set and how the system responds to changing load conditions. Essentially, I'm thinking about the entire softirq processing chain and mentally simulating how it behaves under varying circumstances.
|
| 17/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:handle_softirqs]
Results: map[SourceCode: 579: static void handle_softirqs(bool ksirqd)
580: {
581: unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
582: unsigned long old_flags = current->flags;
583: int max_restart = MAX_SOFTIRQ_RESTART;
584: struct softirq_action *h;
585: bool in_hardirq;
586: __u32 pending;
587: int softirq_bit;
588:
589: /*
590: * Mask out PF_MEMALLOC as the current task context is borrowed for the
591: * softirq. A softirq handled, such as network RX, might set PF_MEMALLOC
592: * again if the socket is related to swapping.
593: */
594: current->flags &= ~PF_MEMALLOC;
595:
596: pending = local_softirq_pending();
597:
598: softirq_handle_begin();
599: in_hardirq = lockdep_softirq_start();
600: account_softirq_enter(current);
601:
602: restart:
603: /* Reset the pending bitmask before enabling irqs */
604: set_softirq_pending(0);
605:
606: local_irq_enable();
607:
608: h = softirq_vec;
609:
610: while ((softirq_bit = ffs(pending))) {
611: unsigned int vec_nr;
612: int prev_count;
613:
614: h += softirq_bit - 1;
615:
616: vec_nr = h - softirq_vec;
617: prev_count = preempt_count();
618:
619: kstat_incr_softirqs_this_cpu(vec_nr);
620:
621: trace_softirq_entry(vec_nr);
622: h->action();
623: trace_softirq_exit(vec_nr);
624: if (unlikely(prev_count != preempt_count())) {
625: pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
626: vec_nr, softirq_to_name[vec_nr], h->action,
627: prev_count, preempt_count());
628: preempt_count_set(prev_count);
629: }
630: h++;
631: pending >>= softirq_bit;
632: }
633:
634: if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd)
635: rcu_softirq_qs();
636:
637: local_irq_disable();
638:
639: pending = local_softirq_pending();
640: if (pending) {
641: if (time_before(jiffies, end) && !need_resched() &&
642: --max_restart)
643: goto restart;
644:
645: wakeup_softirqd();
646: }
647:
648: account_softirq_exit(current);
649: lockdep_softirq_end(in_hardirq);
650: softirq_handle_end();
651: current_restore_flags(old_flags, PF_MEMALLOC);
652: }
SourceFile:kernel/softirq.c]
|
| 18/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 20884
output: 36
thoughts: 297
Thoughts: **My Analysis of SoftIRQ Processing and Potential RCU Stalls**
Okay, let's break this down. The `handle_softirqs` function is clearly designed to be efficient. It attempts to process softirqs within a defined time window (`MAX_SOFTIRQ_TIME` of 2ms) or a maximum number of retries (`MAX_SOFTIRQ_RESTART` of 10). If either limit is exceeded, it seems to be designed to yield control, waking up `ksoftirqd` to handle the remaining work. The fact that it returns immediately after exceeding the time limit tells me that this is interruptible processing, designed to ensure that the interrupt processing does not hog the CPU.
Now, that's where things get interesting. The code indicates that after `handle_softirqs` returns, it's returning to the call stack that takes it back to the interrupted context via `__irq_exit_rcu`, which calls `irq_exit_rcu` and finally `sysvec_apic_timer_interrupt`. This all goes back to the initial context, and in this specific case, it's `__might_fault` within `_copy_to_iter`. That's where I get a bit of a head scratch.
Why would we see an RCU stall if we're interrupting into a context and returning back? I'm now thinking about the scenario where `_copy_to_iter` is running in a loop and, potentially, it is being interrupted constantly by softirqs, to the point of starvation. So the softirq processing itself, as the text says, is not likely to be the cause of the RCU stall.
But then, if `ksoftirqd` is running, then softirqs are processed in its context, not the context of the interrupt return path, right? So, then why are we seeing a stall in `_copy_to_iter`?
Aha, wait a minute, the code inside `irq_exit_rcu` only processes softirqs if `!in_interrupt() && local_softirq_pending()`. If `ksoftirqd` is running, `local_softirq_pending()` could still be set. But, wouldn't `invoke_softirq` check if `ksoftirqd` is already running and avoid double-processing? That is the crux of the problem - why is it returning and then, potentially, causing an RCU stall? What is `local_softirq_pending()` reporting?
|
| 19/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:invoke_softirq]
Results: map[SourceCode: 487: static inline void invoke_softirq(void)
488: {
489: if (!force_irqthreads() || !__this_cpu_read(ksoftirqd)) {
490: #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
491: /*
492: * We can safely execute softirq on the current stack if
493: * it is the irq stack, because it should be near empty
494: * at this stage.
495: */
496: __do_softirq();
497: #else
498: /*
499: * Otherwise, irq_exit() is called on the task stack that can
500: * be potentially deep already. So call softirq in its own stack
501: * to prevent from any overrun.
502: */
503: do_softirq_own_stack();
504: #endif
505: } else {
506: wakeup_softirqd();
507: }
508: }
SourceFile:kernel/softirq.c]
|
| 20/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 22104
output: 39
thoughts: 84
Thoughts: Here's my thought process, distilled:
**SoftIRQ Execution Flow: Deep Dive**
Okay, let me trace this through. So, `invoke_softirq`... right, that function is the gateway, it's the thing that triggers softirq processing. It's only bypassed if `force_irqthreads()` is set to true, which I believe is specifically for PREEMPT_RT. That means, in the standard case, `__do_softirq` is being called on *every single interrupt return* if there are any softirqs pending. That's a lot of overhead if it were to do a bunch of checks and so on.
Now, where is `invoke_softirq` getting called from? Ah, that's it - it's being called from `__irq_exit_rcu`. So, `__irq_exit_rcu` is the point where the CPU is exiting the interrupt handler context, and that's when it checks for and, if necessary, triggers the execution of any pending softirqs via `invoke_softirq`. Got it.
|
| 21/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:__irq_exit_rcu]
Results: map[SourceCode: 720: static inline void __irq_exit_rcu(void)
721: {
722: #ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
723: local_irq_disable();
724: #else
725: lockdep_assert_irqs_disabled();
726: #endif
727: account_hardirq_exit(current);
728: preempt_count_sub(HARDIRQ_OFFSET);
729: if (!in_interrupt() && local_softirq_pending()) {
730: /*
731: * If we left hrtimers unarmed, make sure to arm them now,
732: * before enabling interrupts to run SoftIRQ.
733: */
734: hrtimer_rearm_deferred();
735: invoke_softirq();
736: }
737:
738: if (IS_ENABLED(CONFIG_IRQ_FORCED_THREADING) && force_irqthreads() &&
739: local_timers_pending_force_th() && !(in_nmi() | in_hardirq()))
740: wake_timersd();
741:
742: tick_irq_exit();
743: }
SourceFile:kernel/softirq.c]
|
| 22/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 22857
output: 34
thoughts: 435
Thoughts: **RCU Stall Analysis During Interrupt Handling**
Okay, let's break this down. My initial observation is that `__do_softirq` is returning early, either due to hitting `MAX_SOFTIRQ_TIME` or `MAX_SOFTIRQ_RESTART`, and it's calling `wakeup_softirqd()`. Then, `__irq_exit_rcu` completes. The CPU then switches back to the interrupted task, which in this case is `_copy_to_iter`. That's where it gets interesting...
If the interrupted task is *running*, why am I seeing an RCU stall? My initial thought is the task is running in the kernel and may be preempted, which makes more sense.
The RCU stall message reveals critical information: "Tasks blocked on level-0 rcu_node (CPUs 0-1): P5644/1:b..l P6704/1:b..l P5620/1:b..l". It clearly identifies that tasks are blocked on RCU node. The "b..l" indicates they are blocked. These tasks are `syz-executor` processes.
The stack traces reveal they are currently in `copy_page_range` -> `spin_unlock` -> `preempt_schedule_common` -> `__schedule`. Ah, they are being preempted! The critical part is that they are being preempted, not while *holding* the spinlock (because `spin_unlock` releases it before preemption can occur), but *after* the spinlock has been released, but *before* the task is scheduled. This makes more sense because `spin_unlock` decrements `preempt_count`, and `preempt_schedule_common` is only called if `preempt_count` becomes 0 and `TIF_NEED_RESCHED` is set. If they are preempted, then they *must* be on the runqueue.
So, the next question is *why* they are blocking the RCU grace period? The thought is they are preempted while within an RCU read-side critical section, but `copy_page_range` *doesn't* call `rcu_read_lock()`. Wait a minute, but `dup_mmap` *does* hold `mmap_write_lock()`... does it hold an RCU read lock too? Let me check `copy_page_range` more thoroughly...
|
| 23/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/memory.c Name:copy_page_range]
Results: map[SourceCode:1506: int
1507: copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma)
1508: {
1509: pgd_t *src_pgd, *dst_pgd;
1510: unsigned long addr = src_vma->vm_start;
1511: unsigned long end = src_vma->vm_end;
1512: struct mm_struct *dst_mm = dst_vma->vm_mm;
1513: struct mm_struct *src_mm = src_vma->vm_mm;
1514: struct mmu_notifier_range range;
1515: unsigned long next;
1516: bool is_cow;
1517: int ret;
1518:
1519: if (!vma_needs_copy(dst_vma, src_vma))
1520: return 0;
1521:
1522: if (is_vm_hugetlb_page(src_vma))
1523: return copy_hugetlb_page_range(dst_mm, src_mm, dst_vma, src_vma);
1524:
1525: /*
1526: * We need to invalidate the secondary MMU mappings only when
1527: * there could be a permission downgrade on the ptes of the
1528: * parent mm. And a permission downgrade will only happen if
1529: * is_cow_mapping() returns true.
1530: */
1531: is_cow = is_cow_mapping(src_vma->vm_flags);
1532:
1533: if (is_cow) {
1534: mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE,
1535: 0, src_mm, addr, end);
1536: mmu_notifier_invalidate_range_start(&range);
1537: /*
1538: * Disabling preemption is not needed for the write side, as
1539: * the read side doesn't spin, but goes to the mmap_lock.
1540: *
1541: * Use the raw variant of the seqcount_t write API to avoid
1542: * lockdep complaining about preemptibility.
1543: */
1544: vma_assert_write_locked(src_vma);
1545: raw_write_seqcount_begin(&src_mm->write_protect_seq);
1546: }
1547:
1548: ret = 0;
1549: dst_pgd = pgd_offset(dst_mm, addr);
1550: src_pgd = pgd_offset(src_mm, addr);
1551: do {
1552: next = pgd_addr_end(addr, end);
1553: if (pgd_none_or_clear_bad(src_pgd))
1554: continue;
1555: if (unlikely(copy_p4d_range(dst_vma, src_vma, dst_pgd, src_pgd,
1556: addr, next))) {
1557: ret = -ENOMEM;
1558: break;
1559: }
1560: } while (dst_pgd++, src_pgd++, addr = next, addr != end);
1561:
1562: if (is_cow) {
1563: raw_write_seqcount_end(&src_mm->write_protect_seq);
1564: mmu_notifier_invalidate_range_end(&range);
1565: }
1566: return ret;
1567: }
SourceFile:mm/memory.c]
|
| 24/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 24916
output: 36
thoughts: 399
Thoughts: **RCU Grace Period Starvation: A Deep Dive**
Okay, so `copy_page_range` is being preempted, which isn't ideal, but the real mystery is why the `rcu_preempt` kthread is starving. The log says it's been starved for a significant time β 1648 jiffies! And it's on CPU 1, which is running a softirq (network processing) and then going back to `_copy_to_iter`. Hmmm, if CPU 1 is *constantly* tied up processing softirqs, it might never actually get around to scheduling the `rcu_preempt` kthread.
But wait, `handle_softirqs` is supposed to limit softirq processing to 2ms or 10 restarts, and then wake up `ksoftirqd`. If `ksoftirqd` is awake, it *should* get scheduled, right? Except, `ksoftirqd` has normal priority β SCHED_OTHER.
Now I'm thinking about interrupts. If CPU 1 is slammed with interrupts, `sysvec_apic_timer_interrupt` will run. And if `ksoftirqd` is running, `invoke_softirq` *shouldn't* call `__do_softirq` because `__this_cpu_read(ksoftirqd)` would be true, right? No, wait a second. `invoke_softirq` checks `!__this_cpu_read(ksoftirqd)`. And `__this_cpu_read(ksoftirqd)` returns the pointer to the `ksoftirqd` task for this CPU. It's *always* non-NULL once initialized... wait, no. It returns the task pointer.
Okay, I need to check `invoke_softirq` one more time. Let's see...
|
| 25/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:invoke_softirq]
Results: map[SourceCode: 487: static inline void invoke_softirq(void)
488: {
489: if (!force_irqthreads() || !__this_cpu_read(ksoftirqd)) {
490: #ifdef CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK
491: /*
492: * We can safely execute softirq on the current stack if
493: * it is the irq stack, because it should be near empty
494: * at this stage.
495: */
496: __do_softirq();
497: #else
498: /*
499: * Otherwise, irq_exit() is called on the task stack that can
500: * be potentially deep already. So call softirq in its own stack
501: * to prevent from any overrun.
502: */
503: do_softirq_own_stack();
504: #endif
505: } else {
506: wakeup_softirqd();
507: }
508: }
SourceFile:kernel/softirq.c]
|
| 26/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 23358
output: 38
thoughts: 0
|
| 27/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv6/route.c Name:ip6_pol_route]
Results: map[SourceCode:2273: struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
2274: int oif, struct flowi6 *fl6,
2275: const struct sk_buff *skb, int flags)
2276: {
2277: struct fib6_result res = {};
2278: struct rt6_info *rt = NULL;
2279: bool have_oif_match;
2280: int strict = 0;
2281:
2282: WARN_ON_ONCE((flags & RT6_LOOKUP_F_DST_NOREF) &&
2283: !rcu_read_lock_held());
2284:
2285: strict |= flags & RT6_LOOKUP_F_IFACE;
2286: strict |= flags & RT6_LOOKUP_F_IGNORE_LINKSTATE;
2287: if (READ_ONCE(net->ipv6.devconf_all->forwarding) == 0)
2288: strict |= RT6_LOOKUP_F_REACHABLE;
2289:
2290: rcu_read_lock();
2291:
2292: fib6_table_lookup(net, table, oif, fl6, &res, strict);
2293: if (res.f6i == net->ipv6.fib6_null_entry)
2294: goto out;
2295:
2296: have_oif_match = fl6->flowi6_iif == LOOPBACK_IFINDEX &&
2297: oif == res.nh->fib_nh_dev->ifindex;
2298: fib6_select_path(net, &res, fl6, oif, have_oif_match, skb, strict);
2299:
2300: /*Search through exception table */
2301: rt = rt6_find_cached_rt(&res, &fl6->daddr, &fl6->saddr);
2302: if (rt) {
2303: goto out;
2304: } else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) &&
2305: !res.nh->fib_nh_gw_family)) {
2306: /* Create a RTF_CACHE clone which will not be
2307: * owned by the fib6 tree. It is for the special case where
2308: * the daddr in the skb during the neighbor look-up is different
2309: * from the fl6->daddr used to look-up route here.
2310: */
2311: rt = ip6_rt_cache_alloc(&res, &fl6->daddr, NULL);
2312:
2313: if (rt) {
2314: /* 1 refcnt is taken during ip6_rt_cache_alloc().
2315: * As rt6_uncached_list_add() does not consume refcnt,
2316: * this refcnt is always returned to the caller even
2317: * if caller sets RT6_LOOKUP_F_DST_NOREF flag.
2318: */
2319: rt6_uncached_list_add(rt);
2320: rcu_read_unlock();
2321:
2322: return rt;
2323: }
2324: } else {
2325: /* Get a percpu copy */
2326: local_bh_disable();
2327: rt = rt6_get_pcpu_route(&res);
2328:
2329: if (!rt)
2330: rt = rt6_make_pcpu_route(net, &res);
2331:
2332: local_bh_enable();
2333: }
2334: out:
2335: if (!rt)
2336: rt = net->ipv6.ip6_null_entry;
2337: if (!(flags & RT6_LOOKUP_F_DST_NOREF))
2338: ip6_hold_safe(net, &rt);
2339: rcu_read_unlock();
2340:
2341: return rt;
2342: }
SourceFile:net/ipv6/route.c]
|
| 28/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 27348
output: 36
thoughts: 306
Thoughts: **Softirq Processing: A Deep Dive**
Okay, let me break this down. My initial thought is about how `invoke_softirq` works. Specifically, that check: `if (!force_irqthreads() || !__this_cpu_read(ksoftirqd))`. Since we're not using PREEMPT_RT or `threadirqs`, `force_irqthreads()` is false. Therefore, the first part of the conditional `!force_irqthreads()` is always true. This means that, no matter what, `__do_softirq()` is always called.
Now, if `__do_softirq()` *always* gets called, then `handle_softirqs` is responsible for the actual processing. But `handle_softirqs` has a critical limitation: it caps the processing time to 2 ms or 10 restarts. If that limit is reached, it calls `wakeup_softirqd()`.
So, `handle_softirqs` returns, then `__irq_exit_rcu` returns. The CPU goes back to whatever task was interrupted. But, and here's the kicker: If that task is running and interrupts are enabled, the next interrupt *will* happen. If that interrupt is, say, a timer interrupt or a network interrupt... `__irq_exit_rcu` will be called *again*, which, in turn, will call `invoke_softirq`, which will trigger `__do_softirq`, which will process those softirqs *again*! It's a loop!
The real question, though, is what happens when `ksoftirqd` is running? Does `handle_softirqs` *still* handle softirqs? I should probably go back and re-examine `handle_softirqs` more closely.
|
| 29/2 |
2026/08/09 09:17 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:handle_softirqs]
Results: map[SourceCode: 579: static void handle_softirqs(bool ksirqd)
580: {
581: unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
582: unsigned long old_flags = current->flags;
583: int max_restart = MAX_SOFTIRQ_RESTART;
584: struct softirq_action *h;
585: bool in_hardirq;
586: __u32 pending;
587: int softirq_bit;
588:
589: /*
590: * Mask out PF_MEMALLOC as the current task context is borrowed for the
591: * softirq. A softirq handled, such as network RX, might set PF_MEMALLOC
592: * again if the socket is related to swapping.
593: */
594: current->flags &= ~PF_MEMALLOC;
595:
596: pending = local_softirq_pending();
597:
598: softirq_handle_begin();
599: in_hardirq = lockdep_softirq_start();
600: account_softirq_enter(current);
601:
602: restart:
603: /* Reset the pending bitmask before enabling irqs */
604: set_softirq_pending(0);
605:
606: local_irq_enable();
607:
608: h = softirq_vec;
609:
610: while ((softirq_bit = ffs(pending))) {
611: unsigned int vec_nr;
612: int prev_count;
613:
614: h += softirq_bit - 1;
615:
616: vec_nr = h - softirq_vec;
617: prev_count = preempt_count();
618:
619: kstat_incr_softirqs_this_cpu(vec_nr);
620:
621: trace_softirq_entry(vec_nr);
622: h->action();
623: trace_softirq_exit(vec_nr);
624: if (unlikely(prev_count != preempt_count())) {
625: pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
626: vec_nr, softirq_to_name[vec_nr], h->action,
627: prev_count, preempt_count());
628: preempt_count_set(prev_count);
629: }
630: h++;
631: pending >>= softirq_bit;
632: }
633:
634: if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd)
635: rcu_softirq_qs();
636:
637: local_irq_disable();
638:
639: pending = local_softirq_pending();
640: if (pending) {
641: if (time_before(jiffies, end) && !need_resched() &&
642: --max_restart)
643: goto restart;
644:
645: wakeup_softirqd();
646: }
647:
648: account_softirq_exit(current);
649: lockdep_softirq_end(in_hardirq);
650: softirq_handle_end();
651: current_restore_flags(old_flags, PF_MEMALLOC);
652: }
SourceFile:kernel/softirq.c]
|
| 30/2 |
2026/08/09 09:17 |
llm |
expert |
0m
Model:
Tokens:
input: 29193
output: 37
thoughts: 280
Thoughts: **Analyzing Potential Preemption Issues**
Okay, so I'm digging into this code and trying to understand why `rcu_preempt` is starved. Let's see... `irq_exit_rcu` only calls `invoke_softirq` when `local_softirq_pending()` is true. Got it. But hold on, if `ksoftirqd` is awake, it *should* be on the runqueue. And if `need_resched()` is set, `handle_softirqs` breaks the loop and calls `wakeup_softirqd()`. So, then `__irq_exit_rcu` finishes, and since `need_resched()` is true, when the interrupt returns to kernel space with preemption enabled, it *should* preempt the current task and schedule `ksoftirqd`!
Wait a minute... `_copy_to_iter` is preemptible, right? Yep, it is. So, it *should* schedule `ksoftirqd`. Then *why* is `rcu_preempt` being starved? `rcu_preempt` is a kthread; it's got normal priority. `ksoftirqd` *also* has normal priority when it's running. But the logs show that `rcu_preempt` is starved for a whopping 1648 jiffies!
Okay, think... if there's a continuous packet loop, `ksoftirqd` could be running constantly. But doesn't `ksoftirqd` yield? I thought so. Alright, I'm going to check the code in `run_ksoftirqd` now. This is where the issue must be.
|
| 31/2 |
2026/08/09 09:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:run_ksoftirqd]
Results: map[SourceCode:1068: static void run_ksoftirqd(unsigned int cpu)
1069: {
1070: ksoftirqd_run_begin();
1071: if (local_softirq_pending()) {
1072: /*
1073: * We can safely run softirq on inline stack, as we are not deep
1074: * in the task stack here.
1075: */
1076: handle_softirqs(true);
1077: ksoftirqd_run_end();
1078: cond_resched();
1079: return;
1080: }
1081: ksoftirqd_run_end();
1082: }
SourceFile:kernel/softirq.c]
|
| 32/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 30108
output: 34
thoughts: 323
Thoughts: **RCU Stall Analysis During Process Cloning**
Okay, so `run_ksoftirqd` is calling `handle_softirqs(true)` which then calls `cond_resched()`. That means it's explicitly yielding the CPU, making it ripe for other tasks to run, including `rcu_preempt`. But wait, why am I seeing this RCU stall message then? It's telling me: `rcu: Tasks blocked on level-0 rcu_node (CPUs 0-1): P5644/1:b..l P6704/1:b..l P5620/1:b..l`. Right, the grace period is waiting! It's blocked on tasks 5644, 6704, and 5620 to exit their RCU read-side critical sections.
And the `b..l` status indicator? Blocked! They're *blocked* inside an RCU read-side critical section, meaning they've been preempted! That's a classic deadlock situation if not handled correctly. But where are they getting preempted? Let's trace it out. The stack traces for those processes are identical: `copy_page_range` -> `dup_mmap` -> `dup_mm` -> `copy_process` -> `kernel_clone` -> `__do_sys_clone`. They're being preempted inside `copy_page_range`, and this is associated with a `clone` system call. Now the million dollar question: does `copy_page_range` ever hold an `rcu_read_lock()`? Let's dive into `copy_pte_range` and see. This seems like the key to understanding the RCU stall.
|
| 33/2 |
2026/08/09 09:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/memory.c Name:copy_pte_range]
Results: map[SourceCode:1223: static int
1224: copy_pte_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
1225: pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
1226: unsigned long end)
1227: {
1228: struct mm_struct *dst_mm = dst_vma->vm_mm;
1229: struct mm_struct *src_mm = src_vma->vm_mm;
1230: pte_t *orig_src_pte, *orig_dst_pte;
1231: pte_t *src_pte, *dst_pte;
1232: pmd_t dummy_pmdval;
1233: pte_t ptent;
1234: spinlock_t *src_ptl, *dst_ptl;
1235: int progress, max_nr, ret = 0;
1236: int rss[NR_MM_COUNTERS];
1237: softleaf_t entry = softleaf_mk_none();
1238: struct folio *prealloc = NULL;
1239: int nr;
1240:
1241: again:
1242: progress = 0;
1243: init_rss_vec(rss);
1244:
1245: /*
1246: * copy_pmd_range()'s prior pmd_none_or_clear_bad(src_pmd), and the
1247: * error handling here, assume that exclusive mmap_lock on dst and src
1248: * protects anon from unexpected THP transitions; with shmem and file
1249: * protected by mmap_lock-less collapse skipping areas with anon_vma
1250: * (whereas vma_needs_copy() skips areas without anon_vma). A rework
1251: * can remove such assumptions later, but this is good enough for now.
1252: */
1253: dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
1254: if (!dst_pte) {
1255: ret = -ENOMEM;
1256: goto out;
1257: }
1258:
1259: /*
1260: * We already hold the exclusive mmap_lock, the copy_pte_range() and
1261: * retract_page_tables() are using vma->anon_vma to be exclusive, so
1262: * the PTE page is stable, and there is no need to get pmdval and do
1263: * pmd_same() check.
1264: */
1265: src_pte = pte_offset_map_rw_nolock(src_mm, src_pmd, addr, &dummy_pmdval,
1266: &src_ptl);
1267: if (!src_pte) {
1268: pte_unmap_unlock(dst_pte, dst_ptl);
1269: /* ret == 0 */
1270: goto out;
1271: }
1272: spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
1273: orig_src_pte = src_pte;
1274: orig_dst_pte = dst_pte;
1275: lazy_mmu_mode_enable();
1276:
1277: do {
1278: nr = 1;
1279:
1280: /*
1281: * We are holding two locks at this point - either of them
1282: * could generate latencies in another task on another CPU.
1283: */
1284: if (progress >= 32) {
1285: progress = 0;
1286: if (need_resched() ||
1287: spin_needbreak(src_ptl) || spin_needbreak(dst_ptl))
1288: break;
1289: }
1290: ptent = ptep_get(src_pte);
1291: if (pte_none(ptent)) {
1292: progress++;
1293: continue;
1294: }
1295: if (unlikely(!pte_present(ptent))) {
1296: ret = copy_nonpresent_pte(dst_mm, src_mm,
1297: dst_pte, src_pte,
1298: dst_vma, src_vma,
1299: addr, rss);
1300: if (ret == -EIO) {
1301: entry = softleaf_from_pte(ptep_get(src_pte));
1302: break;
1303: } else if (ret == -EBUSY) {
1304: break;
1305: } else if (!ret) {
1306: progress += 8;
1307: continue;
1308: }
1309: ptent = ptep_get(src_pte);
1310: VM_WARN_ON_ONCE(!pte_present(ptent));
1311:
1312: /*
1313: * Device exclusive entry restored, continue by copying
1314: * the now present pte.
1315: */
1316: WARN_ON_ONCE(ret != -ENOENT);
1317: }
1318: /* copy_present_ptes() will clear `*prealloc' if consumed */
1319: max_nr = (end - addr) / PAGE_SIZE;
1320: ret = copy_present_ptes(dst_vma, src_vma, dst_pte, src_pte,
1321: ptent, addr, max_nr, rss, &prealloc);
1322: /*
1323: * If we need a pre-allocated page for this pte, drop the
1324: * locks, allocate, and try again.
1325: * If copy failed due to hwpoison in source page, break out.
1326: */
1327: if (unlikely(ret == -EAGAIN || ret == -EHWPOISON))
1328: break;
1329: if (unlikely(prealloc)) {
1330: /*
1331: * pre-alloc page cannot be reused by next time so as
1332: * to strictly follow mempolicy (e.g., alloc_page_vma()
1333: * will allocate page according to address). This
1334: * could only happen if one pinned pte changed.
1335: */
1336: folio_put(prealloc);
1337: prealloc = NULL;
1338: }
1339: nr = ret;
1340: progress += 8 * nr;
1341: } while (dst_pte += nr, src_pte += nr, addr += PAGE_SIZE * nr,
1342: addr != end);
1343:
1344: lazy_mmu_mode_disable();
1345: pte_unmap_unlock(orig_src_pte, src_ptl);
1346: add_mm_rss_vec(dst_mm, rss);
1347: pte_unmap_unlock(orig_dst_pte, dst_ptl);
1348: cond_resched();
1349:
1350: if (ret == -EIO) {
1351: VM_WARN_ON_ONCE(!entry.val);
1352: if (swap_retry_table_alloc(entry, GFP_KERNEL) < 0) {
1353: ret = -ENOMEM;
1354: goto out;
1355: }
1356: entry.val = 0;
1357: } else if (ret == -EBUSY || unlikely(ret == -EHWPOISON)) {
1358: goto out;
1359: } else if (ret == -EAGAIN) {
1360: prealloc = folio_prealloc(src_mm, src_vma, addr, false);
1361: if (!prealloc)
1362: return -ENOMEM;
1363: } else if (ret < 0) {
1364: VM_WARN_ON_ONCE(1);
1365: }
1366:
1367: /* We've captured and resolved the error. Reset, try again. */
1368: ret = 0;
1369:
1370: if (addr != end)
1371: goto again;
1372: out:
1373: if (unlikely(prealloc))
1374: folio_put(prealloc);
1375: return ret;
1376: }
SourceFile:mm/memory.c]
|
| 34/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 33331
output: 42
thoughts: 113
Thoughts: **Unraveling a Potential Race Condition in the Memory Management Subsystem**
Okay, so I'm digging into this code path, and things are starting to crystallize. It looks like `pte_unmap_unlock` is ultimately calling `spin_unlock`, which then flows into `_raw_spin_unlock`. And here's the kicker: if `need_resched()` is set, it's going to hit `preempt_schedule_common`. That's standard, that's what I'd expect. But hold on... something feels off. `pte_unmap_unlock` itself *doesn't* appear to be holding an `rcu_read_lock()`. That's a red flag. Now, is `pte_offset_map_rw_nolock` is being used to read/write memory while rcu is enabled? Because if so, there's a potential race condition there. Gotta dive into `pte_offset_map_rw_nolock` itself and make sure there's some kind of synchronization to deal with potential RCU-related issues.
|
| 35/2 |
2026/08/09 09:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/pgtable-generic.c Name:pte_offset_map_rw_nolock]
Results: map[SourceCode: 323: pte_t *pte_offset_map_rw_nolock(struct mm_struct *mm, pmd_t *pmd,
324: unsigned long addr, pmd_t *pmdvalp,
325: spinlock_t **ptlp)
326: {
327: pte_t *pte;
328:
329: VM_WARN_ON_ONCE(!pmdvalp);
330: pte = __pte_offset_map(pmd, addr, pmdvalp);
331: if (likely(pte))
332: *ptlp = pte_lockptr(mm, pmdvalp);
333: return pte;
334: }
SourceFile:mm/pgtable-generic.c]
|
| 36/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 33955
output: 38
thoughts: 12
Thoughts: Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert:
**Navigating the Page Table Walk**
Alright, before diving into anything too complex, let's take a quick look at `__pte_offset_map`. I need to refresh my mental model of how the page table walk is being handled in this particular situation. Knowing exactly *where* we are in the PTE traversal is crucial. We need to confirm how the mapping is happening at this level of indirection. This function, in its current state, holds the key to understanding that. I want to refresh my memory on any particular architectural considerations around this area. Getting the exact function called will help me get to the core of the issue, and, hopefully, help me understand any potential problems.
|
| 37/2 |
2026/08/09 09:18 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:mm/pgtable-generic.c Name:__pte_offset_map]
Results: map[SourceCode: 285: pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp)
286: {
287: unsigned long irqflags;
288: pmd_t pmdval;
289:
290: rcu_read_lock();
291: irqflags = pmdp_get_lockless_start();
292: pmdval = pmdp_get_lockless(pmd);
293: pmdp_get_lockless_end(irqflags);
294:
295: if (pmdvalp)
296: *pmdvalp = pmdval;
297: if (unlikely(pmd_none(pmdval) || !pmd_present(pmdval)))
298: goto nomap;
299: if (unlikely(pmd_trans_huge(pmdval)))
300: goto nomap;
301: if (unlikely(pmd_bad(pmdval))) {
302: pmd_clear_bad(pmd);
303: goto nomap;
304: }
305: return __pte_map(&pmdval, addr);
306: nomap:
307: rcu_read_unlock();
308: return NULL;
309: }
SourceFile:mm/pgtable-generic.c]
|
| 38/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 34600
output: 37
thoughts: 76
Thoughts: Okay, here's my understanding, tailored for an expert audience:
**Analyzing the RCU Locking in PTE Mapping and Unmapping**
Right, so I see `__pte_offset_map` is using `rcu_read_lock()` β interesting. That means the data it's accessing is protected under Read-Copy-Update, as expected. And it *returns* with that lock held. That's a critical detail for tracking the full lifecycle of the lock.
Then, the complementary function, `pte_unmap_unlock`, comes into play. It makes sense that `pte_unmap_unlock` calls `pte_unmap`, which, crucially, *also* calls `rcu_read_unlock()`. This means the lock is properly released after the operation, preventing deadlocks or any other race conditions.
I'm making a mental note of this. I'll need to double-check the exact mechanics within `pte_unmap_unlock` and `pte_unmap`, ensuring there's no subtle interaction or potential for incorrect lock usage. This is a common pattern, but it always warrants a quick confirmation, especially in kernel-level memory management. Gotta drill down into the implementation details and ensure everything is clean.
|
| 39/2 |
2026/08/09 09:18 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:include/linux/mm.h Name:pte_unmap_unlock]
Results: map[SourceCode: SourceFile:]
|
| 40/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 35000
output: 22
thoughts: 34
Thoughts: Okay, here's my take on those thoughts, framed as my own:
**PTE Unmap/Unlock Hunt**
Alright, time to get this sorted. I need to dive into how the PTEs get unmapped and unlocked. Given the kernel context, my initial instinct is to zero in on the core memory management code. I'm going to start by searching for `pte_unmap_unlock`. Given that it's a fundamental operation, it's likely defined or at least heavily involved in either the generic page table code, probably `mm/pgtable-generic.c`, or the core memory management header, `include/linux/mm.h`. I'll start there and see what I can find. Itβs usually a good bet to quickly identify the crucial files to examine when dealing with PTEs.
|
| 41/2 |
2026/08/09 09:18 |
tool |
grepper |
0m
Args: map[Expression:define pte_unmap_unlock]
Results: map[Output:include/linux/mm.h=3842=pte_t *pte_offset_map_rw_nolock(struct mm_struct *mm, pmd_t *pmd,
--
include/linux/mm.h-3845-
include/linux/mm.h:3846:#define pte_unmap_unlock(pte, ptl) do { \
include/linux/mm.h-3847- spin_unlock(ptl); \
]
|
| 42/2 |
2026/08/09 09:18 |
llm |
expert |
0m
Model:
Tokens:
input: 35359
output: 22
thoughts: 771
Thoughts: **RCU Stall Analysis**
Okay, let's break this down. First, I see `pte_unmap_unlock` defined with a `spin_unlock` *before* `pte_unmap`. That's a key observation. `pte_unmap` calls `rcu_read_unlock`, meaning `rcu_read_lock` is still held when `spin_unlock` happens. My initial thought is, if `spin_unlock` triggers `preempt_schedule_common`, we could potentially preempt a task *while* it holds an `rcu_read_lock`.
That feels like a problem, but wait... if `CONFIG_PREEMPT_RCU` is enabled, then this is actually allowed! So, if the task gets preempted, it's added to the RCU node's blocked list (`b..l`). The grace period can't complete until that task resumes and calls `rcu_read_unlock`. Makes sense.
But here's the kicker: Why isn't the task resuming? The RCU stall message shows tasks blocked on level-0 rcu_node, and they're marked with `b..l`. It also mentions that CPU 1 is busy with softirqs and `_copy_to_iter`. Is CPU 0 also busy?
The stall message gives this: `Tasks blocked on level-0 rcu_node (CPUs 0-1): P5644/1:b..l P6704/1:b..l P5620/1:b..l`. The blocked tasks have the form `P5644/1:b..l`. The `/1` might be priority or cpu, but I need to figure out which.
So, back to the problem: the tasks are blocked. My intuition tells me that CPU 1 is the bottleneck because it is constantly running softirqs and `_copy_to_iter`, which is where the problem lies. But wait... `_copy_to_iter` is running in task context! This means that either the task running `_copy_to_iter` isn't being preempted, or it *is* preempting the blocked tasks. That's a critical distinction.
A stack trace on CPU 1 shows: `_copy_to_iter` -> `skb_copy_datagram_iter` -> `tcp_recvmsg` -> `sock_recvmsg` -> `vfs_read` -> `ksys_read`. Aha! This is a task doing a `read()` on a TCP socket! It's constantly interrupted by softirqs, which I think is where the problem starts.
Here's the puzzle: this task, the `read()` on the TCP socket, might not be making progress, but it's *still running*, or *it is preempting* other tasks!
Why doesn't the scheduler preempt this and run the blocked tasks? Could the `read()` task have a higher priority? Or maybe the blocked tasks are on CPU 0, and CPU 0 is also busy? I am not sure about this yet. And wait, the stall message gives the form `P5644/1:b..l`, and the blocked task is on CPU 1? Or is that `/1` related to the priority of something?
Need to consult the RCU stall documentation on that.
|
| 43/2 |
2026/08/09 09:19 |
tool |
grepper |
0m
Args: map[Expression:rcu_print_task_stall]
Results: map[Output:kernel/rcu/tree_stall.h=308=static int check_slow_task(struct task_struct *t, void *arg)
--
kernel/rcu/tree_stall.h-323- */
kernel/rcu/tree_stall.h:324:static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
kernel/rcu/tree_stall.h-325- __releases(rnp->lock)
--
kernel/rcu/tree_stall.h=374=static void rcu_print_detail_task_stall_rnp(struct rcu_node *rnp)
--
kernel/rcu/tree_stall.h-381- */
kernel/rcu/tree_stall.h:382:static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
kernel/rcu/tree_stall.h-383- __releases(rnp->lock)
--
kernel/rcu/tree_stall.h=630=static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
--
kernel/rcu/tree_stall.h-664- }
kernel/rcu/tree_stall.h:665: ndetected += rcu_print_task_stall(rnp, flags); // Releases rnp->lock.
kernel/rcu/tree_stall.h-666- lockdep_assert_irqs_disabled();
]
|
| 44/2 |
2026/08/09 09:19 |
llm |
expert |
0m
Model:
Tokens:
input: 37268
output: 42
thoughts: 27
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into the RCU Stall Detection**
Okay, time to get granular. I need to understand what's triggering this stall detection. My initial thought is to go right to the source code, so I'm heading directly to `kernel/rcu/tree_stall.h`. specifically, I'm checking the `rcu_print_task_stall` function. I anticipate this will be where the core logic resides for how the kernel identifies and reports these potentially problematic stalls. I'm expecting this is likely where the data is being checked, logs are being written, and any relevant debugging information is being gathered for the stall. Time to see what's really happening under the hood.
|
| 45/2 |
2026/08/09 09:19 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/rcu/tree_stall.h Name:rcu_print_task_stall]
Results: map[SourceCode: 320: /*
321: * Scan the current list of tasks blocked within RCU read-side critical
322: * sections, printing out the tid of each of the first few of them.
323: */
324: static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
325: __releases(rnp->lock)
326: {
327: int i = 0;
328: int ndetected = 0;
329: struct rcu_stall_chk_rdr rscr;
330: struct task_struct *t;
331: struct task_struct *ts[8];
332:
333: lockdep_assert_irqs_disabled();
334: if (!rcu_preempt_blocked_readers_cgp(rnp)) {
335: raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
336: return 0;
337: }
338: pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",
339: rnp->level, rnp->grplo, rnp->grphi);
340: t = list_entry(rnp->gp_tasks->prev,
341: struct task_struct, rcu_node_entry);
342: list_for_each_entry_continue(t, &rnp->blkd_tasks, rcu_node_entry) {
343: get_task_struct(t);
344: ts[i++] = t;
345: if (i >= ARRAY_SIZE(ts))
346: break;
347: }
348: raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
349: while (i) {
350: t = ts[--i];
351: if (task_call_func(t, check_slow_task, &rscr))
352: pr_cont(" P%d", t->pid);
353: else
354: pr_cont(" P%d/%d:%c%c%c%c",
355: t->pid, rscr.nesting,
356: ".b"[rscr.rs.b.blocked],
357: ".q"[rscr.rs.b.need_qs],
358: ".e"[rscr.rs.b.exp_hint],
359: ".l"[rscr.on_blkd_list]);
360: lockdep_assert_irqs_disabled();
361: put_task_struct(t);
362: ndetected++;
363: }
364: pr_cont("\n");
365: return ndetected;
366: }
SourceFile:kernel/rcu/tree_stall.h]
|
| 46/2 |
2026/08/09 09:19 |
llm |
expert |
0m
Model:
Tokens:
input: 38333
output: 38
thoughts: 4214
Thoughts: **Analyzing an RCU Stall Caused by a Softirq Storm**
Okay, so `P5644/1:b..l` tells me PID 5644 is blocked at nesting level 1, and the key thing here is the blocked status while holding `rcu_read_lock()`. I need to figure out why this task isn't being scheduled. The RCU stall message points to `rcu_preempt` on CPU 1 being starved. CPU 1 is busy, likely with softirqs, specifically processing `_copy_to_iter`, which is related to copying data, and this softirq processing is interrupting what should be a straightforward task.
I'm checking the stack trace and see a task doing `read()` on a TCP socket, and that the interrupt happened in `_copy_to_iter`. This TCP read task is running, suggesting it has higher priority, which is odd because `rcu_preempt` is a kthread, and should have the same normal priority as any user-space process.
CFS should schedule them fairly, but it's clearly not. 1648 jiffies is 1.6 seconds, and `rcu_preempt` is starved, indicating something is going very wrong with scheduling. Softirqs are taking almost 100% of the CPU, and the user-space `tcp_recvmsg` task is barely running. Ideally, if softirqs are maxing out a CPU, `ksoftirqd` should be woken up to handle them, allowing for more balanced CPU sharing. So `ksoftirqd`, `rcu_preempt`, and the user task should all share fairly, but `rcu_preempt` is still starved.
Looking at the softirq stack trace, I see a timer interrupt firing, interrupting `_copy_to_iter`. The timer interrupt triggers a softirq which is processing `net_rx_action` for network RX. Here's where it gets interesting: If `ksoftirqd` is running, then `invoke_softirq` should not call `__do_softirq`, but it does! Even when `ksoftirqd` is running, timer interrupts STILL call `__do_softirq()`. This means every timer interrupt processes softirqs for up to 2 ms! If the timer interrupt happens every 1 or 4 ms then `__do_softirq` will continuously process softirqs until it gets the time to complete them, causing the CPU to be stuck in timer interrupts and softirqs.
However, `handle_softirqs` checks if `need_resched()` is true; if true, the loop is broken, and `wakeup_softirqd` is called, enabling the scheduling of other tasks. If `need_resched()` is true, and the kernel pre-empts the task, then `ksoftirqd` should get CPU time. But even when `ksoftirqd` is running, timer interrupts call `__do_softirq()`!
`ksoftirqd` calls `handle_softirqs(true)` which DOES NOT disable bottom halves, which is the crux of the problem. If `ksoftirqd` is running, and a timer interrupt happens, the packet will get processed again, potentially. But, `rcu_preempt` is still starved because CFS will only pre-empt if the runtime of `tcp_recvmsg` exceeds `rcu_preempt` runtime. Since `tcp_recvmsg` barely runs, CFS doesn't pre-empt it.
If `CONFIG_IRQ_TIME_ACCOUNTING` is enabled, softirq time is NOT accounted as part of the task's runtime, which is likely the root of this. So `tcp_recvmsg`'s virtual runtime increases *very* slowly. This means `tcp_recvmsg` remains the leftmost task in the CFS rbtree, making sure that `rcu_preempt` never gets scheduled, and the RCU grace period can't complete. That's why the RCU stall occurs. It's an RCU stall caused by softirq processing (specifically, an extremely long softirq processing time).
This feels like a softirq storm, a packet loop causing 100% softirq CPU usage, which starves `rcu_preempt`.
Is this a kernel bug, or just a result of a packet loop? An unprivileged user can create a network namespace, a bridge, and a veth pair to loop packets. The log indicates packets are being received with the same source address as the bridge's own address, a clear sign of a loop.
The concern now is that an unprivileged user can create a packet loop that can
|
| 47/2 |
2026/08/09 09:19 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/fib_rules.c Name:fib_rules_lookup]
Results: map[SourceCode: 313: int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
314: int flags, struct fib_lookup_arg *arg)
315: {
316: struct fib_rule *rule;
317: int err;
318:
319: rcu_read_lock();
320:
321: list_for_each_entry_rcu(rule, &ops->rules_list, list) {
322: jumped:
323: if (!fib_rule_match(rule, ops, fl, flags, arg))
324: continue;
325:
326: if (rule->action == FR_ACT_GOTO) {
327: struct fib_rule *target;
328:
329: target = rcu_dereference(rule->ctarget);
330: if (target == NULL) {
331: continue;
332: } else {
333: rule = target;
334: goto jumped;
335: }
336: } else if (rule->action == FR_ACT_NOP)
337: continue;
338: else
339: err = INDIRECT_CALL_MT(ops->action,
340: fib6_rule_action,
341: fib4_rule_action,
342: rule, fl, flags, arg);
343:
344: if (!err && ops->suppress && INDIRECT_CALL_MT(ops->suppress,
345: fib6_rule_suppress,
346: fib4_rule_suppress,
347: rule, flags, arg))
348: continue;
349:
350: if (err != -EAGAIN) {
351: if ((arg->flags & FIB_LOOKUP_NOREF) ||
352: likely(fib_rule_get_safe(rule))) {
353: arg->rule = rule;
354: goto out;
355: }
356: break;
357: }
358: }
359:
360: err = -ESRCH;
361: out:
362: rcu_read_unlock();
363:
364: return err;
365: }
SourceFile:net/core/fib_rules.c]
|
| 48/2 |
2026/08/09 09:19 |
llm |
expert |
0m
Model:
Tokens:
input: 44340
output: 39
thoughts: 66
Thoughts: **Loop Detection in the Rule Engine**
Okay, so I'm focusing on these `GOTO` actions within the rule engine, specifically where `rule->action` is set to `FR_ACT_GOTO`. The key thing here is that a `GOTO` action allows us to jump execution directly to another rule. My immediate thought is, "can this create a loop?" I mean, could we end up in a situation where rule A jumps to rule B, and then rule B jumps *back* to rule A? That's the type of infinite loop I'm trying to avoid.
My gut reaction is that this could be a problematic edge case that should be addressed in the code. I need to figure out if `fib_nl_newrule` includes any mechanism for loop detection. Does it explicitly prevent these circular `GOTO` dependencies, or is this a potential vulnerability? I need to dig into that function and understand its behavior. The concern is pretty serious, so it needs to be understood.
|
| 49/2 |
2026/08/09 09:20 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/fib_rules.c Name:fib_nl_newrule]
Results: map[SourceCode:1000: static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
1001: struct netlink_ext_ack *extack)
1002: {
1003: return fib_newrule(sock_net(skb->sk), skb, nlh, extack, false);
1004: }
SourceFile:net/core/fib_rules.c]
|
| 50/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 44790
output: 37
thoughts: 0
|
| 51/2 |
2026/08/09 09:20 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/fib_rules.c Name:fib_newrule]
Results: map[SourceCode: 877: int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
878: struct netlink_ext_ack *extack, bool rtnl_held)
879: {
880: struct fib_rule *rule = NULL, *r, *last = NULL;
881: int err = -EINVAL, unresolved = 0;
882: struct fib_rules_ops *ops = NULL;
883: struct nlattr *tb[FRA_MAX + 1];
884: bool user_priority = false;
885: struct fib_rule_hdr *frh;
886:
887: frh = nlmsg_payload(nlh, sizeof(*frh));
888: if (!frh) {
889: NL_SET_ERR_MSG(extack, "Invalid msg length");
890: goto errout;
891: }
892:
893: ops = lookup_rules_ops(net, frh->family);
894: if (!ops) {
895: err = -EAFNOSUPPORT;
896: NL_SET_ERR_MSG(extack, "Rule family not supported");
897: goto errout;
898: }
899:
900: err = nlmsg_parse_deprecated(nlh, sizeof(*frh), tb, FRA_MAX,
901: fib_rule_policy, extack);
902: if (err < 0) {
903: NL_SET_ERR_MSG(extack, "Error parsing msg");
904: goto errout;
905: }
906:
907: err = fib_nl2rule(net, nlh, extack, ops, tb, &rule, &user_priority);
908: if (err)
909: goto errout;
910:
911: if (!rtnl_held)
912: rtnl_net_lock(net);
913:
914: err = fib_nl2rule_rtnl(rule, ops, tb, extack);
915: if (err)
916: goto errout_free;
917:
918: if ((nlh->nlmsg_flags & NLM_F_EXCL) &&
919: rule_exists(ops, frh, tb, rule)) {
920: err = -EEXIST;
921: goto errout_free;
922: }
923:
924: err = ops->configure(rule, skb, frh, tb, extack);
925: if (err < 0)
926: goto errout_free;
927:
928: err = call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule, ops,
929: extack);
930: if (err < 0)
931: goto errout_free;
932:
933: list_for_each_entry(r, &ops->rules_list, list) {
934: if (r->pref == rule->target) {
935: RCU_INIT_POINTER(rule->ctarget, r);
936: break;
937: }
938: }
939:
940: if (rcu_dereference_protected(rule->ctarget, 1) == NULL)
941: unresolved = 1;
942:
943: list_for_each_entry(r, &ops->rules_list, list) {
944: if (r->pref > rule->pref)
945: break;
946: last = r;
947: }
948:
949: if (last)
950: list_add_rcu(&rule->list, &last->list);
951: else
952: list_add_rcu(&rule->list, &ops->rules_list);
953:
954: if (ops->unresolved_rules) {
955: /*
956: * There are unresolved goto rules in the list, check if
957: * any of them are pointing to this new rule.
958: */
959: list_for_each_entry(r, &ops->rules_list, list) {
960: if (r->action == FR_ACT_GOTO &&
961: r->target == rule->pref &&
962: rtnl_dereference(r->ctarget) == NULL) {
963: rcu_assign_pointer(r->ctarget, rule);
964: if (--ops->unresolved_rules == 0)
965: break;
966: }
967: }
968: }
969:
970: if (rule->action == FR_ACT_GOTO)
971: ops->nr_goto_rules++;
972:
973: if (unresolved)
974: ops->unresolved_rules++;
975:
976: if (rule->tun_id)
977: ip_tunnel_need_metadata();
978:
979: fib_rule_get(rule);
980:
981: if (!rtnl_held)
982: rtnl_net_unlock(net);
983:
984: notify_rule_change(RTM_NEWRULE, rule, ops, nlh, NETLINK_CB(skb).portid);
985: fib_rule_put(rule);
986: flush_route_cache(ops);
987: rules_ops_put(ops);
988: return 0;
989:
990: errout_free:
991: if (!rtnl_held)
992: rtnl_net_unlock(net);
993: kfree(rule);
994: errout:
995: rules_ops_put(ops);
996: return err;
997: }
SourceFile:net/core/fib_rules.c]
|
| 52/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 46631
output: 38
thoughts: 145
Thoughts: **Loop Detection in `fib_rules_lookup`**
Okay, so I'm looking at this `fib_rules_lookup` function, specifically this section here:
```c
if (rule->action == FR_ACT_GOTO) {
struct fib_rule *target;
target = rcu_dereference(rule->ctarget);
if (target == NULL) {
continue;
} else {
rule = target;
goto jumped;
}
}
```
My mind immediately goes to a potential issue. If we have a rule A that's configured to `GOTO` rule B, and then rule B is configured to `GOTO` rule A, *we have a loop*. The function would just keep jumping back and forth forever. That's a classic infinite loop scenario.
The code checks for a NULL `target`, which would avoid a crash, but it doesn't *prevent* the loop. My question now is: is there any kind of loop detection implemented when we're actually *adding* the rules? Is there a sanity check to guard against a configuration like this, or do we rely on the user to never create such a circular dependency? I'll need to check the `fib_nl2rule` function. That's the likely place where such checks would be done, if they exist.
|
| 53/2 |
2026/08/09 09:20 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/fib_rules.c Name:fib_nl2rule]
Results: map[SourceCode: 573: static int fib_nl2rule(struct net *net, struct nlmsghdr *nlh,
574: struct netlink_ext_ack *extack,
575: struct fib_rules_ops *ops,
576: struct nlattr *tb[],
577: struct fib_rule **rule,
578: bool *user_priority)
579: {
580: struct fib_rule_hdr *frh = nlmsg_data(nlh);
581: struct fib_rule *nlrule = NULL;
582: int err = -EINVAL;
583:
584: if (frh->src_len)
585: if (!tb[FRA_SRC] ||
586: frh->src_len > (ops->addr_size * 8) ||
587: nla_len(tb[FRA_SRC]) != ops->addr_size) {
588: NL_SET_ERR_MSG(extack, "Invalid source address");
589: goto errout;
590: }
591:
592: if (frh->dst_len)
593: if (!tb[FRA_DST] ||
594: frh->dst_len > (ops->addr_size * 8) ||
595: nla_len(tb[FRA_DST]) != ops->addr_size) {
596: NL_SET_ERR_MSG(extack, "Invalid dst address");
597: goto errout;
598: }
599:
600: nlrule = kzalloc(ops->rule_size, GFP_KERNEL_ACCOUNT);
601: if (!nlrule) {
602: err = -ENOMEM;
603: goto errout;
604: }
605: refcount_set(&nlrule->refcnt, 1);
606: nlrule->fr_net = net;
607:
608: if (tb[FRA_PRIORITY]) {
609: nlrule->pref = nla_get_u32(tb[FRA_PRIORITY]);
610: *user_priority = true;
611: }
612:
613: nlrule->proto = nla_get_u8_default(tb[FRA_PROTOCOL], RTPROT_UNSPEC);
614:
615: if (tb[FRA_IIFNAME]) {
616: nlrule->iifindex = -1;
617: nla_strscpy(nlrule->iifname, tb[FRA_IIFNAME], IFNAMSIZ);
618: }
619:
620: if (tb[FRA_OIFNAME]) {
621: nlrule->oifindex = -1;
622: nla_strscpy(nlrule->oifname, tb[FRA_OIFNAME], IFNAMSIZ);
623: }
624:
625: if (tb[FRA_FWMARK]) {
626: nlrule->mark = nla_get_u32(tb[FRA_FWMARK]);
627: if (nlrule->mark)
628: /* compatibility: if the mark value is non-zero all bits
629: * are compared unless a mask is explicitly specified.
630: */
631: nlrule->mark_mask = 0xFFFFFFFF;
632: }
633:
634: if (tb[FRA_FWMASK])
635: nlrule->mark_mask = nla_get_u32(tb[FRA_FWMASK]);
636:
637: if (tb[FRA_TUN_ID])
638: nlrule->tun_id = nla_get_be64(tb[FRA_TUN_ID]);
639:
640: if (tb[FRA_L3MDEV] &&
641: fib_nl2rule_l3mdev(tb[FRA_L3MDEV], nlrule, extack) < 0)
642: goto errout_free;
643:
644: nlrule->action = frh->action;
645: nlrule->flags = frh->flags;
646: nlrule->table = frh_get_table(frh, tb);
647: if (tb[FRA_SUPPRESS_PREFIXLEN])
648: nlrule->suppress_prefixlen = nla_get_u32(tb[FRA_SUPPRESS_PREFIXLEN]);
649: else
650: nlrule->suppress_prefixlen = -1;
651:
652: if (tb[FRA_SUPPRESS_IFGROUP])
653: nlrule->suppress_ifgroup = nla_get_u32(tb[FRA_SUPPRESS_IFGROUP]);
654: else
655: nlrule->suppress_ifgroup = -1;
656:
657: if (tb[FRA_GOTO]) {
658: if (nlrule->action != FR_ACT_GOTO) {
659: NL_SET_ERR_MSG(extack, "Unexpected goto");
660: goto errout_free;
661: }
662:
663: nlrule->target = nla_get_u32(tb[FRA_GOTO]);
664: } else if (nlrule->action == FR_ACT_GOTO) {
665: NL_SET_ERR_MSG(extack, "Missing goto target for action goto");
666: goto errout_free;
667: }
668:
669: if (nlrule->l3mdev && nlrule->table) {
670: NL_SET_ERR_MSG(extack, "l3mdev and table are mutually exclusive");
671: goto errout_free;
672: }
673:
674: if (tb[FRA_UID_RANGE]) {
675: if (current_user_ns() != net->user_ns) {
676: err = -EPERM;
677: NL_SET_ERR_MSG(extack, "No permission to set uid");
678: goto errout_free;
679: }
680:
681: nlrule->uid_range = nla_get_kuid_range(tb);
682:
683: if (!uid_range_set(&nlrule->uid_range) ||
684: !uid_lte(nlrule->uid_range.start, nlrule->uid_range.end)) {
685: NL_SET_ERR_MSG(extack, "Invalid uid range");
686: goto errout_free;
687: }
688: } else {
689: nlrule->uid_range = fib_kuid_range_unset;
690: }
691:
692: if (tb[FRA_IP_PROTO])
693: nlrule->ip_proto = nla_get_u8(tb[FRA_IP_PROTO]);
694:
695: if (tb[FRA_SPORT_RANGE]) {
696: err = nla_get_port_range(tb[FRA_SPORT_RANGE],
697: &nlrule->sport_range);
698: if (err) {
699: NL_SET_ERR_MSG(extack, "Invalid sport range");
700: goto errout_free;
701: }
702: if (!fib_rule_port_is_range(&nlrule->sport_range))
703: nlrule->sport_mask = U16_MAX;
704: }
705:
706: if (tb[FRA_SPORT_MASK]) {
707: err = fib_nl2rule_port_mask(tb[FRA_SPORT_MASK],
708: &nlrule->sport_range,
709: &nlrule->sport_mask, extack);
710: if (err)
711: goto errout_free;
712: }
713:
714: if (tb[FRA_DPORT_RANGE]) {
715: err = nla_get_port_range(tb[FRA_DPORT_RANGE],
716: &nlrule->dport_range);
717: if (err) {
718: NL_SET_ERR_MSG(extack, "Invalid dport range");
719: goto errout_free;
720: }
721: if (!fib_rule_port_is_range(&nlrule->dport_range))
722: nlrule->dport_mask = U16_MAX;
723: }
724:
725: if (tb[FRA_DPORT_MASK]) {
726: err = fib_nl2rule_port_mask(tb[FRA_DPORT_MASK],
727: &nlrule->dport_range,
728: &nlrule->dport_mask, extack);
729: if (err)
730: goto errout_free;
731: }
732:
733: *rule = nlrule;
734:
735: return 0;
736:
737: errout_free:
738: kfree(nlrule);
739: errout:
740: return err;
741: }
SourceFile:net/core/fib_rules.c]
|
| 54/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 49855
output: 17
thoughts: 417
Thoughts: **Loop Detection in fib_rules: A Potential Vulnerability**
Okay, so I'm looking at this `fib_newrule` function and it's got this bit where it increments `ops->nr_goto_rules` if the action is `FR_ACT_GOTO`. That's fine. But then it resolves `rule->ctarget` by finding a rule with `r->pref == rule->target`. Now, my spidey-sense is tingling... if there are loops in these rules, `fib_rules_lookup` could end up in an infinite loop.
So, first thing I'm doing is checking `fib_rules_lookup` for some sort of loop counter. Nope. Just a `jumped:` label and a simple `goto jumped;`. That's⦠concerning.
This means if rule A has its `target` set to B, and rule B has its `target` set to A, we're in an infinite loop, aren't we? Let's break down how this could even happen. Say we create rule A with a `target` of B. If B doesn't exist yet, that's fine; it's unresolved. Then we create rule B, and its `target` is A. A *does* exist at this point, so B's `ctarget` gets set to A. Then B is added, and *boom* A's `ctarget` gets resolved to B. A points to B, B points to A. Perfect recipe for disaster.
Okay, let's see if `fib_newrule` somehow prevents this. This block here:
```c
list_for_each_entry(r, &ops->rules_list, list) {
if (r->pref == rule->target) {
RCU_INIT_POINTER(rule->ctarget, r);
break;
}
}
```
Yup, that's it. It just sets `ctarget` to the rule with the matching `pref`. No loop detection whatsoever.
Alright, time to get serious. I'm going to search for "loop" or "goto" in `net/core/fib_rules.c` to see if there are any other checks I'm missing. This could be a significant vulnerability.
|
| 55/2 |
2026/08/09 09:20 |
tool |
grepper |
0m
Args: map[Expression:loop.*goto]
Results: map[Output:include/linux/uaccess.h=734=static __always_inline void __scoped_user_rw_access_end(const void *p)
--
include/linux/uaccess.h-783- * The scope is internally implemented as a autoterminating nested for()
include/linux/uaccess.h:784: * loop, which can be left with 'return', 'break' and 'goto' at any
include/linux/uaccess.h-785- * point.
--
kernel/trace/trace_events.c=66=static int system_refcount_dec(struct event_subsystem *system)
--
kernel/trace/trace_events.c-70-
kernel/trace/trace_events.c:71:/* Double loops, do not use break, only goto's work */
kernel/trace/trace_events.c-72-#define do_for_each_event_file(tr, file) \
--
mm/page-writeback.c=2418=static struct folio *writeback_get_folio(struct address_space *mapping,
--
mm/page-writeback.c-2465- *
mm/page-writeback.c:2466: * Note: callers should not manually break out of the loop using break or goto
mm/page-writeback.c-2467- * but must keep calling writeback_iter() until it returns %NULL.
--
scripts/coccinelle/iterators/itnull.cocci-5-//# or in cases when the loop cursor is reassigned. The latter should only
scripts/coccinelle/iterators/itnull.cocci:6://# happen when the matched code is on the way to a loop exit (break, goto,
scripts/coccinelle/iterators/itnull.cocci-7-//# or return).
--
tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c=675=__naked void check_add_const(void)
tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c-676-{
tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c:677: /* typical LLVM generated loop with may_goto */
tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c-678- asm volatile (" \
]
|
| 56/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 51380
output: 18
thoughts: 25
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing Potential Recursive Issues**
Alright, let's dive in. My immediate concern when seeing `fib_nl2rule` and `fib_newrule` is whether these functions exhibit any form of loop detection. Given the nature of dealing with rules and likely some kind of iterative process, it's essential to ensure we aren't introducing any unintended infinite recursion or circular dependencies. I need to scrutinize the logic within those functions very carefully. The potential for a runaway loop in rule-based systems, especially those related to Fibonacci sequences, is a classic pitfall. We need to be proactive and make sure that we have strong mechanisms to prevent such scenarios from ever happening.
|
| 57/2 |
2026/08/09 09:20 |
tool |
grepper |
0m
Args: map[Expression:fib_newrule]
Results: map[Output:drivers/net/vrf.c=1460=static int vrf_fib_rule(const struct net_device *dev, __u8 family, bool add_it)
--
drivers/net/vrf.c-1498- if (add_it) {
drivers/net/vrf.c:1499: err = fib_newrule(dev_net(dev), skb, nlh, NULL, true);
drivers/net/vrf.c-1500- if (err == -EEXIST)
--
include/net/fib_rules.h=205=unsigned int fib_rules_seq_read(const struct net *net, int family);
include/net/fib_rules.h-206-
include/net/fib_rules.h:207:int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
include/net/fib_rules.h-208- struct netlink_ext_ack *extack, bool rtnl_held);
--
net/core/fib_rules.c=850=static const struct nla_policy fib_rule_policy[FRA_MAX + 1] = {
--
net/core/fib_rules.c-876-
net/core/fib_rules.c:877:int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
net/core/fib_rules.c-878- struct netlink_ext_ack *extack, bool rtnl_held)
--
net/core/fib_rules.c-997-}
net/core/fib_rules.c:998:EXPORT_SYMBOL_GPL(fib_newrule);
net/core/fib_rules.c-999-
net/core/fib_rules.c=1000=static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
--
net/core/fib_rules.c-1002-{
net/core/fib_rules.c:1003: return fib_newrule(sock_net(skb->sk), skb, nlh, extack, false);
net/core/fib_rules.c-1004-}
]
|
| 58/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 52159
output: 38
thoughts: 2049
Thoughts: **Analysis of the Network Routing Vulnerability**
Okay, here's the breakdown of what I've figured out. Initially, I was concerned about a potential infinite loop within `fib_rules_lookup`, specifically a scenario where a `GOTO` rule could create a circular dependency. However, after examining the code paths in `fib_nl2rule` and the interaction between `target` and `ctarget` in `fib_rules_lookup`, I determined that such a loop *could* be constructed. But that isn't where the problem is. I looked further.
My focus then shifted to how a route table lookup could cause significant delay. The key observation was the stack trace in the bug report which shows the path: `find_match` -> `__find_rr_leaf` -> `fib6_table_lookup`. This suggests a rule match which then triggers a table lookup, or just a slow table lookup. The log's mention of a packet being received with its own address as the source address, within a bridge (`bridge0`), immediately points to a packet loop, which would certainly cause repeated calls to the lookup function. I reasoned that this "packet loop" is *not* a "GOTO" loop in `fib_rules_lookup`.
I then considered why the packet isn't simply dropped due to the IPv6 Hop Limit (TTL) expiration. However, since the log shows the packet is bridged, the TTL might not be decremented, which explains the continued looping. I walked through the typical IPv6 routing path, `ip6_rcv_finish` -> `ip6_route_input` -> `fib6_rule_lookup` to `dst_input` and `ip6_forward`.
The stack trace indicates input path. But, on the input path (local delivery), `ip6_input` is called, which doesn't forward the packet. This doesn't explain how the packet could keep looping. The looping must be from another direction (forwarding).
This led me to consider multicast packets, which could be forwarded *and* delivered locally. However, forwarding *still* decrements the Hop Limit. So, how is a loop possible?
That's when it hit me: the root cause is likely a **bridge loop**, or more precisely a **broadcast storm** due to a bridged broadcast. If two bridges are connected, broadcast packets get duplicated and flood the network. STP (Spanning Tree Protocol) is disabled by default, making this a very real possibility. Such a broadcast storm would quickly consume CPU time in the softirq context, leading to RCU starvation and, ultimately, an RCU stall. That's the scenario described: an RCU stall with softirqs using 100% of the CPU. The logs even mention "rcu_preempt kthread gets sufficient CPU time, OOM is now expected behavior".
This broadcast storm is easily creatable by an unprivileged user within a *user namespace*. Such a user could create their own network namespace, instantiate bridges, connect them with veth pairs, and then unleash a broadcast storm. The system-wide effects are significant, as softirqs run on the main CPU, starving other tasks and leading to a global RCU stall. The system will likely crash if `panic_on_rcu_stall` is set, or at the very least experience a denial of service (DoS) due to the CPU saturation. Even without a crash, the RCU stall will lead to OOM as RCU callbacks accumulate without being executed.
So, this is a DoS, which *is* accessible to unprivileged processes through user namespaces, but *not* exploitable for privilege escalation. The vulnerability relies on the ability to create network bridge loops, which, without user namespaces, would likely require `CAP_NET_ADMIN` privileges. I've rechecked the stack trace and am confident that this is the best analysis.
|
| 59/2 |
2026/08/09 09:20 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv6/route.c Name:__find_rr_leaf]
Results: map[SourceCode: 829: static void __find_rr_leaf(struct fib6_info *f6i_start,
830: struct fib6_info *nomatch, u32 metric,
831: struct fib6_result *res, struct fib6_info **cont,
832: int oif, int strict, bool *do_rr, int *mpri)
833: {
834: struct fib6_info *f6i;
835:
836: for (f6i = f6i_start;
837: f6i && f6i != nomatch;
838: f6i = rcu_dereference(f6i->fib6_next)) {
839: bool matched = false;
840: struct fib6_nh *nh;
841:
842: if (cont && f6i->fib6_metric != metric) {
843: *cont = f6i;
844: return;
845: }
846:
847: if (fib6_check_expired(f6i))
848: continue;
849:
850: if (unlikely(f6i->nh)) {
851: struct fib6_nh_frl_arg arg = {
852: .flags = f6i->fib6_flags,
853: .oif = oif,
854: .strict = strict,
855: .mpri = mpri,
856: .do_rr = do_rr
857: };
858:
859: if (nexthop_is_blackhole(f6i->nh)) {
860: res->fib6_flags = RTF_REJECT;
861: res->fib6_type = RTN_BLACKHOLE;
862: res->f6i = f6i;
863: res->nh = nexthop_fib6_nh(f6i->nh);
864: return;
865: }
866: nexthop_for_each_fib6_nh(f6i->nh, rt6_nh_find_match,
867: &arg);
868: matched = !!arg.nh;
869: nh = arg.nh;
870: } else {
871: nh = f6i->fib6_nh;
872: if (find_match(nh, f6i->fib6_flags, oif, strict,
873: mpri, do_rr))
874: matched = true;
875: }
876: if (matched) {
877: res->f6i = f6i;
878: res->nh = nh;
879: res->fib6_flags = f6i->fib6_flags;
880: res->fib6_type = f6i->fib6_type;
881: }
882: }
883: }
SourceFile:net/ipv6/route.c]
|
| 60/2 |
2026/08/09 09:20 |
llm |
expert |
0m
Model:
Tokens:
input: 55975
output: 40
thoughts: 508
Thoughts: **Analyzing a Potential Infinite Loop in IPv6 Routing**
Okay, so I'm looking at this `__find_rr_leaf` function and immediately a red flag pops up. It's looping through `f6i = rcu_dereference(f6i->fib6_next)`, right? My gut says, "Could this list be circular?" If `fib6_next` somehow points back to a previous element, it'll get stuck in an endless loop!
Let's dig deeper. `fib6_next` is what links routes within the same fib6 node. It's a singly linked list. Routes are *inserted* when added, and *removed* when deleted. Any bug in the insertion or deletion logic could introduce a loop. Hmm, thatβs a scary thought.
Now, if it's an infinite loop in `__find_rr_leaf`, the CPU would be hogged by it, wouldnβt it? The stack trace indicates CPU 1 is in `__find_rr_leaf`. Is it *stuck* there, or is it just being *called* repeatedly? If it's truly stuck, `net_rx_action` would never finish! The budget of 2ms would be exceeded. But, *wait*, `net_rx_action` only checks the budget *after* processing a packet through `napi_poll`. And what does that do? Well, `napi_poll` goes through `process_backlog`, then `__netif_receive_skb`, then `ip6_rcv_finish`, then `ip6_route_input`, then `fib6_rule_lookup`, then `fib6_table_lookup`, and finally, *boom*, `__find_rr_leaf`. So if `__find_rr_leaf` *hangs*, then `napi_poll` will *never return*! Then `net_rx_action` wonβt return! And `handle_softirqs` is stuck! And the timer interrupt will never happen! And the CPU will be stuck in softirq at 100%! And *rcu_preempt* is starved!
Suddenly, all the symptoms click together! This is the perfect explanation of the issue! It all fits, if there is a circular linked list within the `fib6_next` data structure.
The CPU is literally stuck, right in the `__find_rr_leaf` function.
Okay, I need to understand exactly how these routes are added to the `fib6_next` list to see if a loop can be created. I need to understand how the linking happens.
|
| 61/2 |
2026/08/09 09:21 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv6/route.c Name:fib6_add_rt2node]
Results: map[SourceCode:1089: static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
1090: struct nl_info *info, struct netlink_ext_ack *extack,
1091: struct list_head *purge_list)
1092: {
1093: struct fib6_info *leaf = rcu_dereference_protected(fn->leaf,
1094: lockdep_is_held(&rt->fib6_table->tb6_lock));
1095: struct fib6_info *iter = NULL;
1096: struct fib6_info __rcu **ins;
1097: struct fib6_info __rcu **fallback_ins = NULL;
1098: int replace = (info->nlh &&
1099: (info->nlh->nlmsg_flags & NLM_F_REPLACE));
1100: int add = (!info->nlh ||
1101: (info->nlh->nlmsg_flags & NLM_F_CREATE));
1102: int found = 0;
1103: bool rt_can_ecmp = rt6_qualify_for_ecmp(rt);
1104: bool notify_sibling_rt = false;
1105: u16 nlflags = NLM_F_EXCL;
1106: int err;
1107:
1108: if (info->nlh && (info->nlh->nlmsg_flags & NLM_F_APPEND))
1109: nlflags |= NLM_F_APPEND;
1110:
1111: ins = &fn->leaf;
1112:
1113: for (iter = leaf; iter;
1114: iter = rcu_dereference_protected(iter->fib6_next,
1115: lockdep_is_held(&rt->fib6_table->tb6_lock))) {
1116: /*
1117: * Search for duplicates
1118: */
1119:
1120: if (iter->fib6_metric == rt->fib6_metric) {
1121: /*
1122: * Same priority level
1123: */
1124: if (info->nlh &&
1125: (info->nlh->nlmsg_flags & NLM_F_EXCL))
1126: return -EEXIST;
1127:
1128: nlflags &= ~NLM_F_EXCL;
1129: if (replace) {
1130: if (rt_can_ecmp == rt6_qualify_for_ecmp(iter)) {
1131: found++;
1132: break;
1133: }
1134: fallback_ins = fallback_ins ?: ins;
1135: goto next_iter;
1136: }
1137:
1138: if (rt6_duplicate_nexthop(iter, rt)) {
1139: if (rt->fib6_nsiblings)
1140: WRITE_ONCE(rt->fib6_nsiblings, 0);
1141: if (!(iter->fib6_flags & RTF_EXPIRES))
1142: return -EEXIST;
1143: if (!(rt->fib6_flags & RTF_EXPIRES)) {
1144: fib6_clean_expires(iter);
1145: fib6_may_remove_gc_list(info->nl_net, iter);
1146: } else {
1147: fib6_set_expires(iter, rt->expires);
1148: fib6_add_gc_list(iter);
1149: }
1150: if (!(rt->fib6_flags & (RTF_ADDRCONF | RTF_PREFIX_RT)) &&
1151: (iter->nh || !iter->fib6_nh->fib_nh_gw_family)) {
1152: iter->fib6_flags &= ~RTF_ADDRCONF;
1153: iter->fib6_flags &= ~RTF_PREFIX_RT;
1154: }
1155:
1156: if (rt->fib6_pmtu)
1157: fib6_metric_set(iter, RTAX_MTU,
1158: rt->fib6_pmtu);
1159: return -EEXIST;
1160: }
1161: /* If we have the same destination and the same metric,
1162: * but not the same gateway, then the route we try to
1163: * add is sibling to this route, increment our counter
1164: * of siblings, and later we will add our route to the
1165: * list.
1166: * Only static routes (which don't have flag
1167: * RTF_EXPIRES) are used for ECMPv6.
1168: *
1169: * To avoid long list, we only had siblings if the
1170: * route have a gateway.
1171: */
1172: if (rt_can_ecmp &&
1173: rt6_qualify_for_ecmp(iter))
1174: WRITE_ONCE(rt->fib6_nsiblings,
1175: rt->fib6_nsiblings + 1);
1176: }
1177:
1178: if (iter->fib6_metric > rt->fib6_metric)
1179: break;
1180:
1181: next_iter:
1182: ins = &iter->fib6_next;
1183: }
1184:
1185: if (fallback_ins && !found) {
1186: /* No matching route with same ecmp-able-ness found, replace
1187: * first matching route
1188: */
1189: ins = fallback_ins;
1190: iter = rcu_dereference_protected(*ins,
1191: lockdep_is_held(&rt->fib6_table->tb6_lock));
1192: found++;
1193: }
1194:
1195: /* Reset round-robin state, if necessary */
1196: if (ins == &fn->leaf)
1197: fn->rr_ptr = NULL;
1198:
1199: /* Link this route to others same route. */
1200: if (rt->fib6_nsiblings) {
1201: unsigned int fib6_nsiblings;
1202: struct fib6_info *sibling, *temp_sibling;
1203:
1204: /* Find the first route that have the same metric */
1205: sibling = leaf;
1206: notify_sibling_rt = true;
1207: while (sibling) {
1208: if (sibling->fib6_metric == rt->fib6_metric &&
1209: rt6_qualify_for_ecmp(sibling)) {
1210: list_add_tail_rcu(&rt->fib6_siblings,
1211: &sibling->fib6_siblings);
1212: break;
1213: }
1214: sibling = rcu_dereference_protected(sibling->fib6_next,
1215: lockdep_is_held(&rt->fib6_table->tb6_lock));
1216: notify_sibling_rt = false;
1217: }
1218: /* For each sibling in the list, increment the counter of
1219: * siblings. BUG() if counters does not match, list of siblings
1220: * is broken!
1221: */
1222: fib6_nsiblings = 0;
1223: list_for_each_entry_safe(sibling, temp_sibling,
1224: &rt->fib6_siblings, fib6_siblings) {
1225: WRITE_ONCE(sibling->fib6_nsiblings,
1226: sibling->fib6_nsiblings + 1);
1227: BUG_ON(sibling->fib6_nsiblings != rt->fib6_nsiblings);
1228: fib6_nsiblings++;
1229: }
1230: BUG_ON(fib6_nsiblings != rt->fib6_nsiblings);
1231: rcu_read_lock();
1232: rt6_multipath_rebalance(temp_sibling);
1233: rcu_read_unlock();
1234: }
1235:
1236: /*
1237: * insert node
1238: */
1239: if (!replace) {
1240: if (!add)
1241: pr_warn("NLM_F_CREATE should be set when creating new route\n");
1242:
1243: add:
1244: nlflags |= NLM_F_CREATE;
1245:
1246: /* The route should only be notified if it is the first
1247: * route in the node or if it is added as a sibling
1248: * route to the first route in the node.
1249: */
1250: if (!info->skip_notify_kernel &&
1251: (notify_sibling_rt || ins == &fn->leaf)) {
1252: enum fib_event_type fib_event;
1253:
1254: if (notify_sibling_rt)
1255: fib_event = FIB_EVENT_ENTRY_APPEND;
1256: else
1257: fib_event = FIB_EVENT_ENTRY_REPLACE;
1258: err = call_fib6_entry_notifiers(info->nl_net,
1259: fib_event, rt,
1260: extack);
1261: if (err) {
1262: struct fib6_info *sibling, *next_sibling;
1263:
1264: /* If the route has siblings, then it first
1265: * needs to be unlinked from them.
1266: */
1267: if (!rt->fib6_nsiblings)
1268: return err;
1269:
1270: list_for_each_entry_safe(sibling, next_sibling,
1271: &rt->fib6_siblings,
1272: fib6_siblings)
1273: WRITE_ONCE(sibling->fib6_nsiblings,
1274: sibling->fib6_nsiblings - 1);
1275: WRITE_ONCE(rt->fib6_nsiblings, 0);
1276: list_del_rcu(&rt->fib6_siblings);
1277: rcu_read_lock();
1278: rt6_multipath_rebalance(next_sibling);
1279: rcu_read_unlock();
1280: return err;
1281: }
1282: }
1283:
1284: rcu_assign_pointer(rt->fib6_next, iter);
1285: fib6_info_hold(rt);
1286: rcu_assign_pointer(rt->fib6_node, fn);
1287: rcu_assign_pointer(*ins, rt);
1288: if (!info->skip_notify)
1289: inet6_rt_notify(RTM_NEWROUTE, rt, info, nlflags);
1290: info->nl_net->ipv6.rt6_stats->fib_rt_entries++;
1291:
1292: if (!(fn->fn_flags & RTN_RTINFO)) {
1293: info->nl_net->ipv6.rt6_stats->fib_route_nodes++;
1294: fn->fn_flags |= RTN_RTINFO;
1295: }
1296:
1297: } else {
1298: int nsiblings;
1299:
1300: if (!found) {
1301: if (add)
1302: goto add;
1303: pr_warn("NLM_F_REPLACE set, but no existing node found!\n");
1304: return -ENOENT;
1305: }
1306:
1307: if (!info->skip_notify_kernel && ins == &fn->leaf) {
1308: err = call_fib6_entry_notifiers(info->nl_net,
1309: FIB_EVENT_ENTRY_REPLACE,
1310: rt, extack);
1311: if (err)
1312: return err;
1313: }
1314:
1315: fib6_info_hold(rt);
1316: rcu_assign_pointer(rt->fib6_node, fn);
1317: rt->fib6_next = iter->fib6_next;
1318: rcu_assign_pointer(*ins, rt);
1319: if (!info->skip_notify)
1320: inet6_rt_notify(RTM_NEWROUTE, rt, info, NLM_F_REPLACE);
1321: if (!(fn->fn_flags & RTN_RTINFO)) {
1322: info->nl_net->ipv6.rt6_stats->fib_route_nodes++;
1323: fn->fn_flags |= RTN_RTINFO;
1324: }
1325: nsiblings = iter->fib6_nsiblings;
1326: iter->fib6_node = NULL;
1327: list_add(&iter->purge_link, purge_list);
1328: if (rcu_access_pointer(fn->rr_ptr) == iter)
1329: fn->rr_ptr = NULL;
1330:
1331: if (nsiblings) {
1332: /* Replacing an ECMP route, remove all siblings */
1333: ins = &rt->fib6_next;
1334: iter = rcu_dereference_protected(*ins,
1335: lockdep_is_held(&rt->fib6_table->tb6_lock));
1336: while (iter) {
1337: if (iter->fib6_metric > rt->fib6_metric)
1338: break;
1339: if (rt6_qualify_for_ecmp(iter)) {
1340: *ins = iter->fib6_next;
1341: iter->fib6_node = NULL;
1342: list_add(&iter->purge_link, purge_list);
1343: if (rcu_access_pointer(fn->rr_ptr) == iter)
1344: fn->rr_ptr = NULL;
1345: nsiblings--;
1346: info->nl_net->ipv6.rt6_stats->fib_rt_entries--;
1347: } else {
1348: ins = &iter->fib6_next;
1349: }
1350: iter = rcu_dereference_protected(*ins,
1351: lockdep_is_held(&rt->fib6_table->tb6_lock));
1352: }
1353: WARN_ON(nsiblings != 0);
1354: }
1355: }
1356:
1357: return 0;
1358: }
SourceFile:net/ipv6/ip6_fib.c]
|
| 62/2 |
2026/08/09 09:21 |
llm |
expert |
0m
Model:
Tokens:
input: 61400
output: 66
thoughts: 1053
Thoughts: **Analysis of Potential RCU Stall in IPv6 Routing**
Okay, let's break this down. That `fib6_add_rt2node` function... it's standard linked list insertion. Nothing inherently loop-creating there. The critical part is that `tb6_lock` is held when it's called. So, the infinite loop is *unlikely* to be in `__find_rr_leaf`. The stall is more likely due to `__find_rr_leaf` being where the timer happened to interrupt, or it's just being called repeatedly due to numerous routes, or, most likely, due to a packet loop.
And then, there's *that* log: "bridge0: received packet on veth0 with own address as source address". Repeatedly. That screams "packet loop" to me. That's a classic scenario; 100% softirq CPU usage. And 100% softirq usage...starves `rcu_preempt`. Starved `rcu_preempt` is an RCU stall. A textbook Denial of Service (DoS) via packet loop.
Can an unprivileged user trigger this? Let's see: user namespace, network namespace, create a bridge and veth interfaces, loop...yup. So, not exploitable in the sense of remote code execution, but definitely a DoS. And user namespaces allow it. No VM guest or host trigger specifically, and not directly triggered by a specific remote packet, it's local configuration.
But wait, would a packet *entering* the loop from a remote source trigger it? The root cause is the loop itself, created by local configuration. The loop will continue, no matter where a packet originates. So local configuration is the trigger, not a specific remote packet.
Is this technically a kernel bug? Ideally, the kernel wouldn't stall or crash due to a packet loop. But it's known that packet loops *can* cause soft lockups. Mechanisms like `net_rx_action` help, but they still don't completely prevent this type of DoS since the timer interrupt will just re-trigger `__do_softirq` if `need_resched()` is false, starving other tasks. This is a known Linux softirq design limitation.
So, here's my assessment:
* Exploitable: **False**
* DoS: **True**
* Unprivileged: **False**
* User Namespace: **True**
Okay, just to be sure, let's double check there is no other bug.
The stack trace. `__might_fault` in `_copy_to_iter`. That's just a task doing a `read()` on a socket, getting interrupted by the timer. The timer processes softirqs (`__do_softirq`), the softirq handles network packets (`net_rx_action`). And *those* packets are looping in the bridge (`br_handle_frame` -> `br_fdb_update` and that's where the warning is printed). They are then routed (`ip6_route_input`). This perfectly lines up with the packet loop.
Just a quick check... Can the `br_fdb_update` warning *itself* cause the stall? It's just `printk`, and can theoretically stall a system if it prints too much. However, it's rate-limited with `net_ratelimit()`. Log shows "callbacks suppressed", so the warnings are limited. So no, the stall isn't caused by excessive logging.
Therefore, this is still caused by the packet loop consuming all CPU time. This is a DoS.
Results are set.
|
| 63/2 |
2026/08/09 09:21 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 64/2 |
2026/08/09 09:21 |
llm |
expert |
0m
Model:
Tokens:
input: 63375
output: 672
thoughts: 354
Thoughts: **Final Thoughts on the Bug**
Okay, the analysis is complete, and it's time to craft the reply. So, here's what I've got: the core issue is a textbook Denial of Service, specifically an RCU stall or soft lockup. The root cause is that packet loop in the network stack, stemming from the way a bridge interacts with veth interfaces.
Essentially, a user β and importantly, an unprivileged user with the ability to create a network namespace β can easily craft a malicious network configuration. They can set up a bridge, connect it to veth interfaces, and create a packet loop. Once packets start circulating in that loop, we hit a nasty state. `NET_RX_SOFTIRQ` gets slammed.
Even though `net_rx_action` has a budget and attempts to yield, the constant re-entry via timer interrupts keeps the CPU locked down. This results in a "softirq storm" where the CPU is almost 100% occupied processing these softirqs. Everything else on that CPU gets starved. This is a particular problem for things like `rcu_preempt`, as if it's starved too long, the RCU grace periods can't complete, and we end up with an RCU stall. Ultimately, this can lead to an out-of-memory condition or, if `panic_on_rcu_stall` is set, a full kernel panic.
The good news (relatively speaking) is that it's just a resource exhaustion DoS. No memory corruption, no privilege escalation. Itβs not exploitable in that sense. The key requirement for triggering this is the ability to create and configure network interfaces. This is possible for unprivileged users within a user namespace. So, it's accessible from user namespaces, but not from completely unprivileged processes without user namespaces, which is the crux of the issue.
|
| 65/1 |
2026/08/09 09:21 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Root Cause Analysis:**
The bug report indicates an RCU stall where the `rcu_preempt` kthread is starved
of CPU time for a long period (1648 jiffies). The stack trace for CPU 1 shows
that it is constantly processing network softirqs (`NET_RX_SOFTIRQ`) triggered
by the timer interrupt (`sysvec_apic_timer_interrupt`), which interrupted a user
task performing a socket read (`tcp_recvmsg` -> `_copy_to_iter`).
The kernel log repeatedly prints:
`bridge0: received packet on veth0 with own address as source address
(addr:aa:aa:aa:aa:aa:19, vlan:0)`
This message (emitted by `br_fdb_update` in the bridge code) is a classic
symptom of a **packet loop** at the Layer 2/Layer 3 boundary.
When a packet loop is created (e.g., bridging a `veth` interface to itself or
creating a routing loop between namespaces), packets are continuously received,
routed, and transmitted without being dropped. This causes a "softirq storm".
Although `net_rx_action` has a budget (usually 300 packets or 2ms) and yields to
prevent soft lockups, the Linux softirq design will re-invoke `__do_softirq()`
on every timer interrupt return if the interrupted task hasn't exhausted its CFS
timeslice (`need_resched()` is false). Because the interrupted task
(`tcp_recvmsg`) gets very little actual CPU time, its virtual runtime increases
very slowly, preventing it from being preempted by CFS. Consequently, normal
priority kthreads like `rcu_preempt` and `ksoftirqd` are completely starved of
CPU time. The starvation of `rcu_preempt` prevents RCU grace periods from
completing, leading to the reported RCU stall and potential OOM (as RCU
callbacks accumulate).
**Security Impact:**
* **Exploitable:** False. This is a resource exhaustion issue (CPU time and
softirq processing). There is no memory corruption, out-of-bounds access, or
information leak that could be leveraged for privilege escalation or arbitrary
code execution.
* **Denial of Service (DoS):** True. The softirq storm starves critical kernel
threads, leading to RCU stalls, system unresponsiveness, and eventually OOM or a
kernel panic (if `panic_on_rcu_stall` is configured).
* **Accessible From Unprivileged Processes:** False. Creating bridges, `veth`
pairs, and configuring routing rules requires `CAP_NET_ADMIN`. A standard
unprivileged process on the host cannot do this.
* **Accessible From User Namespaces:** True. An unprivileged user can create a
new user namespace and a new network namespace. Within this namespace, they gain
`CAP_NET_ADMIN` and can freely create bridges, `veth` devices, and routing rules
to intentionally construct a packet loop and trigger the DoS against the host
system.]
|