| 0/0 |
2026/09/12 00:51 |
flow |
assessment-security |
5m
Results: map[DenialOfService:true Explanation:**Analysis of the Bug**
The bug report indicates a softlockup (Denial of Service) occurring in the
network stack's softirq processing (`net_rx_action` -> `process_backlog`),
specifically while evaluating an nftables `synproxy` rule
(`nft_synproxy_eval_v4`).
**Root Cause:**
The vulnerability is a logic error in the `nft_synproxy` module that leads to an
infinite packet loop.
In `net/netfilter/nft_synproxy.c`, the functions `nft_synproxy_eval_v4()` and
`nft_synproxy_eval_v6()` check if an incoming packet is a SYN packet using a
simple `if (tcp->syn)` condition. However, it fails to verify that the ACK, FIN,
or RST flags are *not* set. (For comparison, the equivalent iptables
implementation in `ipt_SYNPROXY.c` correctly checks `if (th->syn && !(th->ack ||
th->fin || th->rst))`).
Because of this missing check, a SYN-ACK packet will also evaluate to true for
`tcp->syn`.
When the condition is met, the code calls `synproxy_send_client_synack()`, which
generates a SYN-ACK response packet by swapping the original source and
destination IP addresses.
If a packet is injected where both the source and destination addresses are
local to the machine (e.g., `127.0.0.1`), the generated SYN-ACK packet will be
routed back to the local loopback interface. When this generated SYN-ACK packet
is received, it is processed by the same `nft_synproxy` rule. Since its SYN flag
is set, it matches the flawed `if (tcp->syn)` condition again, causing the
kernel to generate *another* SYN-ACK packet.
This creates an infinite loop of SYN-ACK packets being generated, transmitted to
loopback, and received. The kernel gets trapped processing this endless backlog
of packets in the softirq context, consuming 100% of the CPU core and triggering
the workqueue/RCU softlockup warnings seen in the crash report.
**Security Impact:**
* **Exploitable:** No. The bug does not cause memory corruption (the old `skb`
is properly consumed and a new one is safely allocated), information leaks, or
privilege escalation. It is purely a logic bug.
* **Denial of Service:** Yes. The infinite loop in the softirq context starves
the CPU, hanging the system or triggering a kernel panic if `softlockup_panic`
is enabled.
* **Accessible From User Namespaces:** Yes. An unprivileged user can trivially
trigger this DoS by creating a new user namespace and network namespace (where
they hold `CAP_NET_ADMIN`), configuring a basic `nft_synproxy` rule, and sending
a single SYN packet to `127.0.0.1`.
* **Network Trigger:** Yes. While primarily a local DoS vector via namespaces,
it can theoretically be triggered remotely if a host has a poorly scoped
`nft_synproxy` rule and an attacker can send a spoofed SYN packet (where both
the source and destination IPs belong to the victim). This relies on the network
lacking strict anti-spoofing protections (like `rp_filter`). Exploitable:false FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/12 00:51 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/09/12 00:51 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/e4df1e35f73e8871a0bb5986e0a3f7f88903d380]
|
| 3/1 |
2026/09/12 00:51 |
action |
kernel-builder |
0m
Results: map[KernelObj:/app/workdir/cache/build/4052259e3ac679a0ea4a40bb36f332ce6ba3596e]
|
| 4/1 |
2026/09/12 00:51 |
action |
codesearch-prepare |
0m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/12 00:52 |
agent |
expert |
5m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:true 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:
BUG: workqueue lockup - pool cpus=1 node=0 flags=0x0 nice=0 stuck for 32s!
Showing busy workqueues and worker pools:
workqueue events: flags=0x100
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=10 refcnt=12
in-flight: 867:request_firmware_work_func for 87s ,4809:drain_vmap_area_work for 5s ,9:purge_vmap_node for 4s BAR(4809)
pending: 2*nsim_dev_hwstats_traffic_work, vmstat_shepherd, ovs_dp_masks_rebalance, 3*psi_avgs_work
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=16 refcnt=17
in-flight: 4855:bpf_prog_free_deferred for 38s
pending: psi_avgs_work, 4*nsim_dev_hwstats_traffic_work, 3*ovs_dp_masks_rebalance, psi_avgs_work, 2*ovs_dp_masks_rebalance, delayed_vfree_work, 2*rht_deferred_worker, nsim_fib_event_work
workqueue events_unbound: flags=0x2
pwq 8: cpus=0-1 flags=0x6 nice=0 active=16 refcnt=17
in-flight: 40:cfg80211_wiphy_work for 25s ,1185:cfg80211_wiphy_work for 20s ,54:cfg80211_wiphy_work for 22s ,59:cfg80211_wiphy_work for 38s cfg80211_wiphy_work
pending: cfg80211_wiphy_work, nsim_dev_trap_report_work, cfg80211_wiphy_work, 4*nsim_dev_trap_report_work, cfg80211_wiphy_work, toggle_allocation_gate, nsim_dev_trap_report_work, flush_memcg_stats_dwork
pwq 8: cpus=0-1 flags=0x6 nice=0 active=10 refcnt=11
in-flight: 12:linkwatch_event for 37s ,3595:cfg80211_wiphy_work for 37s cfg80211_wiphy_work ,143:cfg80211_wiphy_work for 38s cfg80211_wiphy_work
pending: 5*macvlan_process_broadcast
workqueue events_power_efficient: flags=0x82
pwq 8: cpus=0-1 flags=0x6 nice=0 active=4 refcnt=5
pending: fb_flashcursor, wg_ratelimiter_gc_entries, 2*neigh_managed_work
pwq 8: cpus=0-1 flags=0x6 nice=0 active=4 refcnt=5
in-flight: 3694:gc_worker for 2s
pending: 2*neigh_periodic_work, do_cache_clean
workqueue events_dfl_long: flags=0x2
pwq 8: cpus=0-1 flags=0x6 nice=0 active=7 refcnt=8
pending: 7*defense_work_handler
workqueue netns: flags=0x6000a
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=4
in-flight: 5152:cleanup_net for 41s
workqueue mm_percpu_wq: flags=0x108
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: vmstat_update
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: vmstat_update
workqueue writeback: flags=0x4a
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=3 MAYDAY
pending: wb_update_bandwidth_workfn
workqueue gid-cache-wq: flags=0x20002
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=5
pending: update_gid_event_work_handler
inactive: update_gid_event_work_handler
workqueue iou_exit: flags=0x2
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
in-flight: 13:io_ring_exit_work for 37s
workqueue bat_events: flags=0x6000a
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=47 MAYDAY
in-flight: 2851(RESCUER):batadv_tt_purge for 12s
pending: mayday_cursor_func
inactive: 4*batadv_tt_purge, batadv_iv_send_outstanding_bat_ogm_packet, 5*batadv_mcast_mla_update, 2*batadv_iv_send_outstanding_bat_ogm_packet, batadv_mcast_mla_update, 5*batadv_purge_orig, 3*batadv_iv_send_outstanding_bat_ogm_packet, batadv_purge_orig, 6*batadv_iv_send_outstanding_bat_ogm_packet, batadv_bla_periodic_work, 2*batadv_dat_purge, batadv_bla_periodic_work, 2*batadv_dat_purge, 2*batadv_bla_periodic_work, batadv_dat_purge, batadv_bla_periodic_work, batadv_dat_purge, batadv_bla_periodic_work, batadv_tt_purge
workqueue wg-kex-wg0: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg0: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-kex-wg1: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg1: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg2: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-kex-wg0: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg0: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-kex-wg1: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg1: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-kex-wg2: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg2: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg0: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg1: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg2: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker
workqueue wg-kex-wg0: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg0: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_tx_worker, wg_packet_encrypt_worker
workqueue wg-kex-wg1: flags=0x6
pwq 8: cpus=0-1 flags=0x6 nice=0 active=1 refcnt=2
pending: wg_packet_handshake_send_worker
workqueue wg-crypt-wg1: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg2: flags=0x128
pwq 2: cpus=0 node=0 flags=0x0 nice=0 active=1 refcnt=2
pending: wg_packet_encrypt_worker
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=3 refcnt=4
pending: wg_packet_decrypt_worker, wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg0: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_tx_worker, wg_packet_encrypt_worker
workqueue wg-crypt-wg1: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
workqueue wg-crypt-wg2: flags=0x128
pwq 6: cpus=1 node=0 flags=0x0 nice=0 active=2 refcnt=3
pending: wg_packet_encrypt_worker, wg_packet_tx_worker
pool 2: cpus=0 node=0 flags=0x0 nice=0 hung=4s workers=10 idle: 4504 4786 10 4892 4840 4829 4801
pool 6: cpus=1 node=0 flags=0x0 nice=0 hung=32s workers=6 idle: 5049 4800 26 55 24
pool 8: cpus=0-1 flags=0x6 nice=0 hung=0s workers=11 manager: 5698
Showing backtraces of busy workers in stalled worker pools:
pool 6: no worker in running state, cpu=1 is busy (nr_workers=6 nr_idle=5)
The pool might have trouble waking an idle worker.
Backtrace of last woken worker:
task:kworker/1:5 state:R running task stack:0 pid:5049 tgid:5049 ppid:2 task_flags:0x4208060 flags:0x00000010
Workqueue: 0x0 (events)
Call trace:
__switch_to+0x2b4/0x6e4 arch/arm64/kernel/process.c:775 (T)
context_switch kernel/sched/core.c:5520 [inline]
__schedule+0x1370/0x2d80 kernel/sched/core.c:7270
__schedule_loop kernel/sched/core.c:7347 [inline]
schedule+0x13c/0x20c kernel/sched/core.c:7362
worker_thread+0x924/0xbd0 kernel/workqueue.c:3566
kthread+0x304/0x3d4 kernel/kthread.c:436
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:838
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 2851 Comm: kworker/R-bat_e Tainted: G L syzkaller #0 PREEMPT
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026
Workqueue: bat_events batadv_tt_purge
pstate: 03400005 (nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : in_softirq_really kernel/kcov.c:167 [inline]
pc : check_kcov_mode+0x20/0x54 kernel/kcov.c:179
lr : write_comp_data+0x38/0x84 kernel/kcov.c:242
sp : ffff80008ec46cb0
x29: ffff80008ec46cb0 x28: 0000000000000000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000000 x24: ffff0000c886b9a8
x23: ffff0000cde95880 x22: 0000000000000007 x21: 0000000000000000
x20: 0000000000000000 x19: ffff80008567f80c x18: 00000000f799f18b
x17: 0000000000020010 x16: 0038dd8600000000 x15: 0000000000000000
x14: 00000000803107d8 x13: 0000000000000004 x12: 0000000000000000
x11: ffff0000c886b800 x10: 0000000000000000 x9 : 0000000000000301
x8 : ffff0000cde95880 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff80008567f80c
x2 : 0000000000000000 x1 : ffff0000cde95880 x0 : 0000000000000003
Call trace:
preempt_count arch/arm64/include/asm/preempt.h:12 [inline] (P)
in_softirq_really kernel/kcov.c:167 [inline] (P)
check_kcov_mode+0x20/0x54 kernel/kcov.c:179 (P)
__sanitizer_cov_trace_const_cmp8+0x24/0x30 kernel/kcov.c:317
ip_packet_match net/ipv4/netfilter/ip_tables.c:59 [inline]
ipt_do_table+0x560/0x1288 net/ipv4/netfilter/ip_tables.c:283
nf_hook_entry_hookfn include/linux/netfilter.h:165 [inline]
nf_hook_slow+0xc8/0x224 net/netfilter/core.c:619
nf_hook+0x1f0/0x364 include/linux/netfilter.h:280
__ip_local_out+0x54c/0x660 net/ipv4/ip_output.c:120
ip_local_out+0x3c/0x148 net/ipv4/ip_output.c:129
synproxy_send_tcp+0x3ec/0x5a4 net/netfilter/nf_synproxy_core.c:442
synproxy_send_client_synack+0x3b0/0x640 net/netfilter/nf_synproxy_core.c:487
nft_synproxy_eval_v4+0x16c/0x278 net/netfilter/nft_synproxy.c:59
nft_synproxy_do_eval+0x2d8/0x4a4 net/netfilter/nft_synproxy.c:141
nft_synproxy_eval+0x34/0x48 net/netfilter/nft_synproxy.c:247
expr_call_ops_eval net/netfilter/nf_tables_core.c:237 [inline]
nft_do_chain+0x418/0x13c8 net/netfilter/nf_tables_core.c:285
nft_do_chain_inet+0x284/0x3d4 net/netfilter/nft_chain_filter.c:162
nf_hook_entry_hookfn include/linux/netfilter.h:165 [inline]
nf_hook_slow+0xc8/0x224 net/netfilter/core.c:619
nf_hook include/linux/netfilter.h:280 [inline]
NF_HOOK+0x1f0/0x398 include/linux/netfilter.h:323
ip_local_deliver+0x128/0x188 net/ipv4/ip_input.c:262
dst_input include/net/dst.h:480 [inline]
ip_rcv_finish+0x20c/0x230 net/ipv4/ip_input.c:492
NF_HOOK+0x308/0x398 include/linux/netfilter.h:325
ip_rcv+0x7c/0x9c net/ipv4/ip_input.c:612
__netif_receive_skb_one_core+0xc8/0x110 net/core/dev.c:6264
__netif_receive_skb+0x34/0x128 net/core/dev.c:6377
process_backlog+0x5f4/0x16f8 net/core/dev.c:6728
__napi_poll+0xb4/0x328 net/core/dev.c:7787
napi_poll net/core/dev.c:7850 [inline]
net_rx_action+0x5b0/0xc14 net/core/dev.c:8007
handle_softirqs+0x2ec/0xd98 kernel/softirq.c:645
__do_softirq+0x14/0x20 kernel/softirq.c:679
____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:78
call_on_irq_stack+0x30/0x48 arch/arm64/kernel/entry.S:885
do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:83
do_softirq+0x90/0xf8 kernel/softirq.c:546
__local_bh_enable_ip+0x240/0x35c kernel/softirq.c:473
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:237 [inline]
_raw_spin_unlock_bh+0x3c/0x4c kernel/locking/spinlock.c:245
spin_unlock_bh include/linux/spinlock.h:407 [inline]
batadv_tt_global_purge net/batman-adv/translation-table.c:2390 [inline]
batadv_tt_purge+0x3e4/0x7b4 net/batman-adv/translation-table.c:3754
process_one_work kernel/workqueue.c:3387 [inline]
process_scheduled_works+0x91c/0x1250 kernel/workqueue.c:3470
rescuer_thread+0x68c/0xd90 kernel/workqueue.c:3694
kthread+0x304/0x3d4 kernel/kthread.c:436
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:838
Reply: **Analysis of the Bug**
The bug report indicates a softlockup (Denial of Service) occurring in the network stack's softirq processing (`net_rx_action` -> `process_backlog`), specifically while evaluating an nftables `synproxy` rule (`nft_synproxy_eval_v4`).
**Root Cause:**
The vulnerability is a logic error in the `nft_synproxy` module that leads to an infinite packet loop.
In `net/netfilter/nft_synproxy.c`, the functions `nft_synproxy_eval_v4()` and `nft_synproxy_eval_v6()` check if an incoming packet is a SYN packet using a simple `if (tcp->syn)` condition. However, it fails to verify that the ACK, FIN, or RST flags are *not* set. (For comparison, the equivalent iptables implementation in `ipt_SYNPROXY.c` correctly checks `if (th->syn && !(th->ack || th->fin || th->rst))`).
Because of this missing check, a SYN-ACK packet will also evaluate to true for `tcp->syn`.
When the condition is met, the code calls `synproxy_send_client_synack()`, which generates a SYN-ACK response packet by swapping the original source and destination IP addresses.
If a packet is injected where both the source and destination addresses are local to the machine (e.g., `127.0.0.1`), the generated SYN-ACK packet will be routed back to the local loopback interface. When this generated SYN-ACK packet is received, it is processed by the same `nft_synproxy` rule. Since its SYN flag is set, it matches the flawed `if (tcp->syn)` condition again, causing the kernel to generate *another* SYN-ACK packet.
This creates an infinite loop of SYN-ACK packets being generated, transmitted to loopback, and received. The kernel gets trapped processing this endless backlog of packets in the softirq context, consuming 100% of the CPU core and triggering the workqueue/RCU softlockup warnings seen in the crash report.
**Security Impact:**
* **Exploitable:** No. The bug does not cause memory corruption (the old `skb` is properly consumed and a new one is safely allocated), information leaks, or privilege escalation. It is purely a logic bug.
* **Denial of Service:** Yes. The infinite loop in the softirq context starves the CPU, hanging the system or triggering a kernel panic if `softlockup_panic` is enabled.
* **Accessible From User Namespaces:** Yes. An unprivileged user can trivially trigger this DoS by creating a new user namespace and network namespace (where they hold `CAP_NET_ADMIN`), configuring a basic `nft_synproxy` rule, and sending a single SYN packet to `127.0.0.1`.
* **Network Trigger:** Yes. While primarily a local DoS vector via namespaces, it can theoretically be triggered remotely if a host has a poorly scoped `nft_synproxy` rule and an attacker can send a spoofed SYN packet (where both the source and destination IPs belong to the victim). This relies on the network lacking strict anti-spoofing protections (like `rp_filter`).
|
| 6/2 |
2026/09/12 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 12042
output: 18
thoughts: 1809
Thoughts: **Analyzing a Workqueue Softlockup in Network Packet Processing**
Okay, so I've got this bug report about a workqueue lockup, specifically with `batadv_tt_purge` and it's been stuck for 32 seconds. The backtrace is the key here. It shows the CPU is locked, and that this problem involves netfilter (specifically `ipt_do_table`, `nft_synproxy_eval`, `nf_hook` calls) and the network stack in general, as well as Batman-adv. I'm seeing `net_rx_action` which is processing packets in an enabled bottom half, which is strange. The trace indicates that packets are being processed through the network stack, getting to `ipt_do_table`, and then looping back into the same processing path.
My initial thought is this looks like a loop or a massive backlog, likely triggered by a flood of packets. The interesting part is that `batadv_tt_purge` calls `spin_unlock_bh`, enabling bottom halves which triggers the packet processing. The packets go through the IP stack, and the netfilter hooks, and specifically `nft_synproxy_eval`, `synproxy_send_client_synack`, `ip_local_out`, and then `ipt_do_table`. `synproxy_send_client_synack` creates a SYNACK packet; does this somehow cause the system to process the same packet again, leading to an infinite loop? It's sent *out*, not received... so probably not.
Let me think. `synproxy_send_client_synack` calls `synproxy_send_tcp`, so let's look at `synproxy`. Perhaps there is some kind of loop in the synproxy path itself that creates a packet storm. Let's see if there are any known issues with synproxy in the network stack. I'll need to research synproxy and potential looping issues. This seems like a promising path.
|
| 7/2 |
2026/09/12 00:52 |
tool |
grepper |
0m
Error:
Args: map[Expression:synproxy.*loop]
Results:
|
| 8/2 |
2026/09/12 00:52 |
llm |
expert |
0m
Model:
Tokens:
input: 14301
output: 31
thoughts: 20
Thoughts: Here's my thought process, as it went down:
**Investigating a Potential Synproxy Issue**
Okay, so I've got a hunch there might be something going sideways with synproxy, specifically around the `synproxy_send_client_synack` function. I need to dig into the git history to see if there have been any recent commits touching this area, any bug fixes, or potentially problematic changes. This is a pretty focused search, so hopefully, I'll be able to quickly zero in on relevant commits that could provide some insights into what's going on. I'll need to pay close attention to the commit messages and the diffs to understand the context and the rationale behind any changes. Let's see what the git log reveals.
|
| 9/2 |
2026/09/12 00:52 |
tool |
git-log |
0m
Args: map[CodeRegexp:synproxy_send_client_synack Count:10]
Results: map[Output:5445d6419962 arm64: Don't read GMID_EL1 when MTE is disabled
]
|
| 10/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 14556
output: 44
thoughts: 15
Thoughts: Okay, I'm ready. Here's my summary, taking the provided thought and expressing it in a first-person perspective, assuming I'm an expert:
**Rethinking the Approach**
Hold on a minute, something feels off about that direction. I was initially going to go with X methodology, but after reviewing the current constraints, it doesn't align as well as I'd initially hoped. I need to consider a more precise tool. Okay, I'm going to make a strategic pivot here. Let's make sure we're using **SymbolName** instead. That seems to better accommodate the specific factors in play.
|
| 11/2 |
2026/09/12 00:53 |
tool |
git-log |
0m
Args: map[SourcePath:net/netfilter/nf_synproxy_core.c SymbolName:synproxy_send_client_synack]
Results: map[Output:5445d6419962 arm64: Don't read GMID_EL1 when MTE is disabled
]
|
| 12/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 14794
output: 23
thoughts: 59
Thoughts: Here's my take on the situation:
**Investigating the `synproxy_send_client_synack` Function**
Okay, so I'm trying to figure out exactly where the `synproxy_send_client_synack` function lives in the kernel source. My gut tells me it's either in `net/netfilter/nf_synproxy_core.c` or perhaps nestled within the IPv4 specific implementation, `net/ipv4/netfilter/nf_synproxy_ipv4.c`. I could probably just look it up, but sometimes a quick mental query is the way to go. Time to confirm with a grep and pinpoint its exact location.
|
| 13/2 |
2026/09/12 00:53 |
tool |
grepper |
0m
Args: map[Expression:synproxy_send_client_synack]
Results: map[Output:include/net/netfilter/nf_synproxy.h=49=void synproxy_init_timestamp_cookie(const struct nf_synproxy_info *info,
--
include/net/netfilter/nf_synproxy.h-51-
include/net/netfilter/nf_synproxy.h:52:void synproxy_send_client_synack(struct net *net, const struct sk_buff *skb,
include/net/netfilter/nf_synproxy.h-53- const struct tcphdr *th,
--
include/net/netfilter/nf_synproxy.h=66=void nf_synproxy_ipv4_fini(struct synproxy_net *snet, struct net *net);
--
include/net/netfilter/nf_synproxy.h-68-#if IS_ENABLED(CONFIG_IPV6)
include/net/netfilter/nf_synproxy.h:69:void synproxy_send_client_synack_ipv6(struct net *net,
include/net/netfilter/nf_synproxy.h-70- const struct sk_buff *skb,
--
net/ipv4/netfilter/ipt_SYNPROXY.c=13=synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
--
net/ipv4/netfilter/ipt_SYNPROXY.c-47-
net/ipv4/netfilter/ipt_SYNPROXY.c:48: synproxy_send_client_synack(net, skb, th, &opts);
net/ipv4/netfilter/ipt_SYNPROXY.c-49- consume_skb(skb);
--
net/ipv6/netfilter/ip6t_SYNPROXY.c=13=synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
--
net/ipv6/netfilter/ip6t_SYNPROXY.c-47-
net/ipv6/netfilter/ip6t_SYNPROXY.c:48: synproxy_send_client_synack_ipv6(net, skb, th, &opts);
net/ipv6/netfilter/ip6t_SYNPROXY.c-49- consume_skb(skb);
--
net/netfilter/nf_synproxy_core.c=449=void
net/netfilter/nf_synproxy_core.c:450:synproxy_send_client_synack(struct net *net,
net/netfilter/nf_synproxy_core.c-451- const struct sk_buff *skb, const struct tcphdr *th,
--
net/netfilter/nf_synproxy_core.c-489-}
net/netfilter/nf_synproxy_core.c:490:EXPORT_SYMBOL_GPL(synproxy_send_client_synack);
net/netfilter/nf_synproxy_core.c-491-
--
net/netfilter/nf_synproxy_core.c=868=void
net/netfilter/nf_synproxy_core.c:869:synproxy_send_client_synack_ipv6(struct net *net,
net/netfilter/nf_synproxy_core.c-870- const struct sk_buff *skb,
--
net/netfilter/nf_synproxy_core.c-910-}
net/netfilter/nf_synproxy_core.c:911:EXPORT_SYMBOL_GPL(synproxy_send_client_synack_ipv6);
net/netfilter/nf_synproxy_core.c-912-
--
net/netfilter/nft_synproxy.c=44=static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
--
net/netfilter/nft_synproxy.c-58- nft_synproxy_tcp_options(opts, tcp, snet, &info);
net/netfilter/nft_synproxy.c:59: synproxy_send_client_synack(net, skb, tcp, opts);
net/netfilter/nft_synproxy.c-60- consume_skb(skb);
--
net/netfilter/nft_synproxy.c=75=static void nft_synproxy_eval_v6(const struct nft_synproxy *priv,
--
net/netfilter/nft_synproxy.c-89- nft_synproxy_tcp_options(opts, tcp, snet, &info);
net/netfilter/nft_synproxy.c:90: synproxy_send_client_synack_ipv6(net, skb, tcp, opts);
net/netfilter/nft_synproxy.c-91- consume_skb(skb);
]
|
| 14/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 16196
output: 25
thoughts: 19
Thoughts: Okay, here's my attempt at summarizing those thoughts from a first-person, expert perspective, aiming for a fulsome rendering:
**Investigating Potential Soft Lockups Related to Synproxy Commits**
Right, let's dive into this. My initial thought process revolves around a specific problem: the potential for soft lockups, and a specific area: the interaction with synproxy. So, the logical first step is to see if there's been any recent activity, specifically commits, that touch upon *both* of these areas. This isn't just a casual search, of course. I'm going to be looking for commits that:
* Could reasonably *introduce* a soft lockup, whether directly or indirectly through some interaction or race condition. This requires a deeper understanding of synproxy internals and where locking might be involved.
* Are within a reasonable timeframe β I'll need to know the context of the reported issue.
* Mention both "synproxy" *and* "softlockup" in the commit message directly, or in the discussion on the list.
* Potentially touch on related networking subsystems that the synproxy module uses.
This search is more than just keyword matching; it's a mental exercise of understanding the system, potential failure points, and relevant code changes. Then, I will start to see the code changes and then determine if there is a causal relationship. I will then work backwards to find out what caused the issue, or if the commit even has a relationship.
|
| 15/2 |
2026/09/12 00:53 |
tool |
git-log |
0m
Args: map[MessageRegexps:[synproxy softlockup]]
Results:
|
| 16/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 16570
output: 23
thoughts: 17
Thoughts: Okay, here's my summary, taking on the persona you requested:
**Assessing Recent Synproxy & Loop Activity**
Alright, let's get down to brass tacks. I need to quickly get a lay of the land. My immediate priority is to understand the current state of affairs regarding synproxy and the "loop" β whatever that might specifically entail in this context. My experience has taught me that diving into specifics without a good overview can be a recipe for wasted time. So, the first step is to check the commit logs. I want to see if there's been any recent activity, any code changes, fixes, or even discussions that involve these two components. This initial scan will help me determine:
* **Relevance:** Are these things even active areas of development right now? Or are they legacy parts of the system that are relatively stable?
* **Context:** What were the last issues/improvements addressed? What was the general direction of work?
* **Hotspots:** Are there any recent "hot" commits that might indicate problems or a need for attention?
This initial commit log dive is a crucial starting point. It's a quick way to build an effective initial hypothesis about what, specifically, I should be looking for in the following stage. It's a triage process before I start digging into the details.
|
| 17/2 |
2026/09/12 00:53 |
tool |
git-log |
0m
Args: map[MessageRegexps:[synproxy loop]]
Results:
|
| 18/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 16904
output: 24
thoughts: 15
Thoughts: Okay, here's my interpretation of those thoughts, summarized in the first person, assuming an expert user:
**Checking on Synproxy Activity**
Alright, let's get down to business. My immediate thought is to check for recent activity, specifically commits, that touch on `synproxy`. I need to understand the current state of play. Are there any recent changes, bug fixes, or enhancements related to this functionality that I should be aware of? This is a core component, and staying on top of the development around it is crucial for my work. Knowing the commit history will provide invaluable context β who's been working on it, what problems have been addressed, and if any regressions might have been introduced. This is the starting point for any in-depth analysis or troubleshooting I'm about to undertake. Time to see what the logs reveal!
|
| 19/2 |
2026/09/12 00:53 |
tool |
git-log |
0m
Args: map[Count:10 MessageRegexps:[synproxy]]
Results:
|
| 20/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 17131
output: 27
thoughts: 20
Thoughts: Here's your summary:
**Troubleshooting a Git Log Issue**
Okay, my `git log` command isn't behaving as expected. Something's clearly off. My first instinct is to try and narrow down the scope of the problem. Instead of blindly troubleshooting the whole history, let's zero in on a specific area that might be causing the failure. I suspect it may be related to changes involving `synproxy`. So, let's use `grep` to filter the output and see if we can isolate commits related to that keyword. That should give me a more manageable subset to analyze and figure out what went wrong. Focusing on those commits related to `synproxy` might reveal the root cause of the error faster. This focused approach is likely a more efficient way to debug the issue than a blind search.
|
| 21/2 |
2026/09/12 00:53 |
tool |
grepper |
0m
Args: map[Expression:synproxy PathPrefix:net/netfilter/]
Results: map[Output:
Full output is too long, showing 500 out of 999 lines.
Use more precise expression if possible.
net/netfilter/Makefile=76=obj-$(CONFIG_NF_NAT_TFTP) += nf_nat_tftp.o
--
net/netfilter/Makefile-78-# SYNPROXY
net/netfilter/Makefile:79:obj-$(CONFIG_NETFILTER_SYNPROXY) += nf_synproxy_core.o
net/netfilter/Makefile-80-
--
net/netfilter/Makefile=132=obj-$(CONFIG_NFT_XFRM) += nft_xfrm.o
net/netfilter/Makefile:133:obj-$(CONFIG_NFT_SYNPROXY) += nft_synproxy.o
net/netfilter/Makefile-134-
--
net/netfilter/nf_conntrack_core.c-48-#include <net/netfilter/nf_conntrack_labels.h>
net/netfilter/nf_conntrack_core.c:49:#include <net/netfilter/nf_conntrack_synproxy.h>
net/netfilter/nf_conntrack_core.c-50-#include <net/netfilter/nf_nat.h>
--
net/netfilter/nf_conntrack_core.c=1754=init_conntrack(struct net *net, struct nf_conn *tmpl,
--
net/netfilter/nf_conntrack_core.c-1779-
net/netfilter/nf_conntrack_core.c:1780: if (!nf_ct_add_synproxy(ct, tmpl)) {
net/netfilter/nf_conntrack_core.c-1781- nf_conntrack_free(ct);
--
net/netfilter/nf_conntrack_extend.c-23-#include <net/netfilter/nf_conntrack_labels.h>
net/netfilter/nf_conntrack_extend.c:24:#include <net/netfilter/nf_conntrack_synproxy.h>
net/netfilter/nf_conntrack_extend.c-25-#include <net/netfilter/nf_conntrack_act_ct.h>
--
net/netfilter/nf_conntrack_extend.c=30=static const u8 nf_ct_ext_type_len[NF_CT_EXT_NUM] = {
--
net/netfilter/nf_conntrack_extend.c-49-#if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
net/netfilter/nf_conntrack_extend.c:50: [NF_CT_EXT_SYNPROXY] = sizeof(struct nf_conn_synproxy),
net/netfilter/nf_conntrack_extend.c-51-#endif
--
net/netfilter/nf_conntrack_extend.c=57=static __always_inline unsigned int total_extension_size(void)
--
net/netfilter/nf_conntrack_extend.c-81-#if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
net/netfilter/nf_conntrack_extend.c:82: + sizeof(struct nf_conn_synproxy)
net/netfilter/nf_conntrack_extend.c-83-#endif
--
net/netfilter/nf_conntrack_netlink.c-46-#include <net/netfilter/nf_conntrack_labels.h>
net/netfilter/nf_conntrack_netlink.c:47:#include <net/netfilter/nf_conntrack_synproxy.h>
net/netfilter/nf_conntrack_netlink.c-48-#if IS_ENABLED(CONFIG_NF_NAT)
--
net/netfilter/nf_conntrack_netlink.c=480=static int ctnetlink_dump_ct_seq_adj(struct sk_buff *skb, struct nf_conn *ct)
--
net/netfilter/nf_conntrack_netlink.c-503-
net/netfilter/nf_conntrack_netlink.c:504:static int ctnetlink_dump_ct_synproxy(struct sk_buff *skb, struct nf_conn *ct)
net/netfilter/nf_conntrack_netlink.c-505-{
net/netfilter/nf_conntrack_netlink.c:506: struct nf_conn_synproxy *synproxy = nfct_synproxy(ct);
net/netfilter/nf_conntrack_netlink.c-507- struct nlattr *nest_parms;
net/netfilter/nf_conntrack_netlink.c-508-
net/netfilter/nf_conntrack_netlink.c:509: if (!synproxy)
net/netfilter/nf_conntrack_netlink.c-510- return 0;
--
net/netfilter/nf_conntrack_netlink.c-515-
net/netfilter/nf_conntrack_netlink.c:516: if (nla_put_be32(skb, CTA_SYNPROXY_ISN, htonl(synproxy->isn)) ||
net/netfilter/nf_conntrack_netlink.c:517: nla_put_be32(skb, CTA_SYNPROXY_ITS, htonl(synproxy->its)) ||
net/netfilter/nf_conntrack_netlink.c:518: nla_put_be32(skb, CTA_SYNPROXY_TSOFF, htonl(synproxy->tsoff)))
net/netfilter/nf_conntrack_netlink.c-519- goto nla_put_failure;
--
net/netfilter/nf_conntrack_netlink.c=555=static int ctnetlink_dump_extinfo(struct sk_buff *skb,
--
net/netfilter/nf_conntrack_netlink.c-562- ctnetlink_dump_ct_seq_adj(skb, ct) < 0 ||
net/netfilter/nf_conntrack_netlink.c:563: ctnetlink_dump_ct_synproxy(skb, ct) < 0)
net/netfilter/nf_conntrack_netlink.c-564- return -1;
--
net/netfilter/nf_conntrack_netlink.c=744=ctnetlink_conntrack_event(unsigned int events, const struct nf_ct_event *item)
--
net/netfilter/nf_conntrack_netlink.c-852- if (events & (1 << IPCT_SYNPROXY) &&
net/netfilter/nf_conntrack_netlink.c:853: ctnetlink_dump_ct_synproxy(skb, ct) < 0)
net/netfilter/nf_conntrack_netlink.c-854- goto nla_put_failure;
--
net/netfilter/nf_conntrack_netlink.c=2067=ctnetlink_change_seq_adj(struct nf_conn *ct,
--
net/netfilter/nf_conntrack_netlink.c-2101-
net/netfilter/nf_conntrack_netlink.c:2102:static const struct nla_policy synproxy_policy[CTA_SYNPROXY_MAX + 1] = {
net/netfilter/nf_conntrack_netlink.c-2103- [CTA_SYNPROXY_ISN] = { .type = NLA_U32 },
--
net/netfilter/nf_conntrack_netlink.c-2107-
net/netfilter/nf_conntrack_netlink.c:2108:static int ctnetlink_change_synproxy(struct nf_conn *ct,
net/netfilter/nf_conntrack_netlink.c-2109- const struct nlattr * const cda[])
net/netfilter/nf_conntrack_netlink.c-2110-{
net/netfilter/nf_conntrack_netlink.c:2111: struct nf_conn_synproxy *synproxy = nfct_synproxy(ct);
net/netfilter/nf_conntrack_netlink.c-2112- struct nlattr *tb[CTA_SYNPROXY_MAX + 1];
--
net/netfilter/nf_conntrack_netlink.c-2114-
net/netfilter/nf_conntrack_netlink.c:2115: if (!synproxy)
net/netfilter/nf_conntrack_netlink.c-2116- return 0;
--
net/netfilter/nf_conntrack_netlink.c-2118- err = nla_parse_nested_deprecated(tb, CTA_SYNPROXY_MAX,
net/netfilter/nf_conntrack_netlink.c:2119: cda[CTA_SYNPROXY], synproxy_policy,
net/netfilter/nf_conntrack_netlink.c-2120- NULL);
--
net/netfilter/nf_conntrack_netlink.c-2128-
net/netfilter/nf_conntrack_netlink.c:2129: synproxy->isn = ntohl(nla_get_be32(tb[CTA_SYNPROXY_ISN]));
net/netfilter/nf_conntrack_netlink.c:2130: synproxy->its = ntohl(nla_get_be32(tb[CTA_SYNPROXY_ITS]));
net/netfilter/nf_conntrack_netlink.c:2131: synproxy->tsoff = ntohl(nla_get_be32(tb[CTA_SYNPROXY_TSOFF]));
net/netfilter/nf_conntrack_netlink.c-2132-
--
net/netfilter/nf_conntrack_netlink.c=2162=ctnetlink_change_conntrack(struct nf_conn *ct,
--
net/netfilter/nf_conntrack_netlink.c-2206- if (cda[CTA_SYNPROXY]) {
net/netfilter/nf_conntrack_netlink.c:2207: err = ctnetlink_change_synproxy(ct, cda);
net/netfilter/nf_conntrack_netlink.c-2208- if (err < 0)
--
net/netfilter/nf_conntrack_netlink.c=2222=ctnetlink_create_conntrack(struct net *net,
--
net/netfilter/nf_conntrack_netlink.c-2304- nfct_seqadj_ext_add(ct);
net/netfilter/nf_conntrack_netlink.c:2305: nfct_synproxy_ext_add(ct);
net/netfilter/nf_conntrack_netlink.c-2306-
--
net/netfilter/nf_conntrack_netlink.c-2332- if (cda[CTA_SYNPROXY]) {
net/netfilter/nf_conntrack_netlink.c:2333: err = ctnetlink_change_synproxy(ct, cda);
net/netfilter/nf_conntrack_netlink.c-2334- if (err < 0)
--
net/netfilter/nf_conntrack_netlink.c=2667=static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
--
net/netfilter/nf_conntrack_netlink.c-2727-
net/netfilter/nf_conntrack_netlink.c:2728: if (ctnetlink_dump_ct_synproxy(skb, ct) < 0)
net/netfilter/nf_conntrack_netlink.c-2729- goto nla_put_failure;
--
net/netfilter/nf_conntrack_proto_tcp.c-27-#include <net/netfilter/nf_conntrack_seqadj.h>
net/netfilter/nf_conntrack_proto_tcp.c:28:#include <net/netfilter/nf_conntrack_synproxy.h>
net/netfilter/nf_conntrack_proto_tcp.c-29-#include <net/netfilter/nf_conntrack_timeout.h>
--
net/netfilter/nf_conntrack_proto_tcp.c=1001=int nf_conntrack_tcp_packet(struct nf_conn *ct,
--
net/netfilter/nf_conntrack_proto_tcp.c-1166- */
net/netfilter/nf_conntrack_proto_tcp.c:1167: if (nfct_synproxy(ct) && old_state == TCP_CONNTRACK_SYN_SENT &&
net/netfilter/nf_conntrack_proto_tcp.c-1168- index == TCP_ACK_SET && dir == IP_CT_DIR_ORIGINAL &&
--
net/netfilter/nf_synproxy_core.c-14-#include <linux/netfilter_ipv6.h>
net/netfilter/nf_synproxy_core.c:15:#include <linux/netfilter/nf_synproxy.h>
net/netfilter/nf_synproxy_core.c-16-
--
net/netfilter/nf_synproxy_core.c-20-#include <net/netfilter/nf_conntrack_seqadj.h>
net/netfilter/nf_synproxy_core.c:21:#include <net/netfilter/nf_conntrack_synproxy.h>
net/netfilter/nf_synproxy_core.c-22-#include <net/netfilter/nf_conntrack_zones.h>
net/netfilter/nf_synproxy_core.c:23:#include <net/netfilter/nf_synproxy.h>
net/netfilter/nf_synproxy_core.c-24-
net/netfilter/nf_synproxy_core.c:25:static DEFINE_MUTEX(synproxy_mutex);
net/netfilter/nf_synproxy_core.c-26-
net/netfilter/nf_synproxy_core.c:27:unsigned int synproxy_net_id;
net/netfilter/nf_synproxy_core.c:28:EXPORT_SYMBOL_GPL(synproxy_net_id);
net/netfilter/nf_synproxy_core.c-29-
net/netfilter/nf_synproxy_core.c=30=bool
net/netfilter/nf_synproxy_core.c:31:synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
net/netfilter/nf_synproxy_core.c:32: const struct tcphdr *th, struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-33-{
--
net/netfilter/nf_synproxy_core.c-97-}
net/netfilter/nf_synproxy_core.c:98:EXPORT_SYMBOL_GPL(synproxy_parse_options);
net/netfilter/nf_synproxy_core.c-99-
net/netfilter/nf_synproxy_core.c=100=static unsigned int
net/netfilter/nf_synproxy_core.c:101:synproxy_options_size(const struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-102-{
--
net/netfilter/nf_synproxy_core.c=117=static void
net/netfilter/nf_synproxy_core.c:118:synproxy_build_options(struct tcphdr *th, const struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-119-{
--
net/netfilter/nf_synproxy_core.c-154-
net/netfilter/nf_synproxy_core.c:155:void synproxy_init_timestamp_cookie(const struct nf_synproxy_info *info,
net/netfilter/nf_synproxy_core.c:156: struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-157-{
--
net/netfilter/nf_synproxy_core.c-172-}
net/netfilter/nf_synproxy_core.c:173:EXPORT_SYMBOL_GPL(synproxy_init_timestamp_cookie);
net/netfilter/nf_synproxy_core.c-174-
net/netfilter/nf_synproxy_core.c=175=static void
net/netfilter/nf_synproxy_core.c:176:synproxy_check_timestamp_cookie(struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-177-{
--
net/netfilter/nf_synproxy_core.c=187=static bool
net/netfilter/nf_synproxy_core.c:188:synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
net/netfilter/nf_synproxy_core.c-189- struct tcphdr *th, struct nf_conn *ct,
net/netfilter/nf_synproxy_core.c-190- enum ip_conntrack_info ctinfo,
net/netfilter/nf_synproxy_core.c:191: const struct nf_conn_synproxy *synproxy)
net/netfilter/nf_synproxy_core.c-192-{
--
net/netfilter/nf_synproxy_core.c-195-
net/netfilter/nf_synproxy_core.c:196: if (synproxy->tsoff == 0)
net/netfilter/nf_synproxy_core.c-197- return true;
--
net/netfilter/nf_synproxy_core.c-224- old = get_unaligned_be32(&op[2]);
net/netfilter/nf_synproxy_core.c:225: new = old - synproxy->tsoff;
net/netfilter/nf_synproxy_core.c-226- put_unaligned_be32(new, &op[2]);
--
net/netfilter/nf_synproxy_core.c-228- old = get_unaligned_be32(&op[6]);
net/netfilter/nf_synproxy_core.c:229: new = old + synproxy->tsoff;
net/netfilter/nf_synproxy_core.c-230- put_unaligned_be32(new, &op[6]);
--
net/netfilter/nf_synproxy_core.c-242-#ifdef CONFIG_PROC_FS
net/netfilter/nf_synproxy_core.c:243:static void *synproxy_cpu_seq_start(struct seq_file *seq, loff_t *pos)
net/netfilter/nf_synproxy_core.c-244-{
net/netfilter/nf_synproxy_core.c:245: struct synproxy_net *snet = synproxy_pernet(seq_file_net(seq));
net/netfilter/nf_synproxy_core.c-246- int cpu;
--
net/netfilter/nf_synproxy_core.c-260-
net/netfilter/nf_synproxy_core.c:261:static void *synproxy_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
net/netfilter/nf_synproxy_core.c-262-{
net/netfilter/nf_synproxy_core.c:263: struct synproxy_net *snet = synproxy_pernet(seq_file_net(seq));
net/netfilter/nf_synproxy_core.c-264- int cpu;
--
net/netfilter/nf_synproxy_core.c-275-
net/netfilter/nf_synproxy_core.c:276:static void synproxy_cpu_seq_stop(struct seq_file *seq, void *v)
net/netfilter/nf_synproxy_core.c-277-{
--
net/netfilter/nf_synproxy_core.c-280-
net/netfilter/nf_synproxy_core.c:281:static int synproxy_cpu_seq_show(struct seq_file *seq, void *v)
net/netfilter/nf_synproxy_core.c-282-{
net/netfilter/nf_synproxy_core.c:283: struct synproxy_stats *stats = v;
net/netfilter/nf_synproxy_core.c-284-
--
net/netfilter/nf_synproxy_core.c-301-
net/netfilter/nf_synproxy_core.c:302:static const struct seq_operations synproxy_cpu_seq_ops = {
net/netfilter/nf_synproxy_core.c:303: .start = synproxy_cpu_seq_start,
net/netfilter/nf_synproxy_core.c:304: .next = synproxy_cpu_seq_next,
net/netfilter/nf_synproxy_core.c:305: .stop = synproxy_cpu_seq_stop,
net/netfilter/nf_synproxy_core.c:306: .show = synproxy_cpu_seq_show,
net/netfilter/nf_synproxy_core.c-307-};
net/netfilter/nf_synproxy_core.c-308-
net/netfilter/nf_synproxy_core.c:309:static int __net_init synproxy_proc_init(struct net *net)
net/netfilter/nf_synproxy_core.c-310-{
net/netfilter/nf_synproxy_core.c:311: if (!proc_create_net("synproxy", 0444, net->proc_net_stat,
net/netfilter/nf_synproxy_core.c:312: &synproxy_cpu_seq_ops, sizeof(struct seq_net_private)))
net/netfilter/nf_synproxy_core.c-313- return -ENOMEM;
--
net/netfilter/nf_synproxy_core.c-316-
net/netfilter/nf_synproxy_core.c:317:static void __net_exit synproxy_proc_exit(struct net *net)
net/netfilter/nf_synproxy_core.c-318-{
net/netfilter/nf_synproxy_core.c:319: remove_proc_entry("synproxy", net->proc_net_stat);
net/netfilter/nf_synproxy_core.c-320-}
net/netfilter/nf_synproxy_core.c-321-#else
net/netfilter/nf_synproxy_core.c:322:static int __net_init synproxy_proc_init(struct net *net)
net/netfilter/nf_synproxy_core.c-323-{
--
net/netfilter/nf_synproxy_core.c-326-
net/netfilter/nf_synproxy_core.c:327:static void __net_exit synproxy_proc_exit(struct net *net)
net/netfilter/nf_synproxy_core.c-328-{
--
net/netfilter/nf_synproxy_core.c-332-
net/netfilter/nf_synproxy_core.c:333:static int __net_init synproxy_net_init(struct net *net)
net/netfilter/nf_synproxy_core.c-334-{
net/netfilter/nf_synproxy_core.c:335: struct synproxy_net *snet = synproxy_pernet(net);
net/netfilter/nf_synproxy_core.c-336- struct nf_conn *ct;
--
net/netfilter/nf_synproxy_core.c-344- goto err2;
net/netfilter/nf_synproxy_core.c:345: if (!nfct_synproxy_ext_add(ct))
net/netfilter/nf_synproxy_core.c-346- goto err2;
--
net/netfilter/nf_synproxy_core.c-350-
net/netfilter/nf_synproxy_core.c:351: snet->stats = alloc_percpu(struct synproxy_stats);
net/netfilter/nf_synproxy_core.c-352- if (snet->stats == NULL)
--
net/netfilter/nf_synproxy_core.c-354-
net/netfilter/nf_synproxy_core.c:355: err = synproxy_proc_init(net);
net/netfilter/nf_synproxy_core.c-356- if (err < 0)
--
net/netfilter/nf_synproxy_core.c-368-
net/netfilter/nf_synproxy_core.c:369:static void __net_exit synproxy_net_exit(struct net *net)
net/netfilter/nf_synproxy_core.c-370-{
net/netfilter/nf_synproxy_core.c:371: struct synproxy_net *snet = synproxy_pernet(net);
net/netfilter/nf_synproxy_core.c-372-
net/netfilter/nf_synproxy_core.c-373- nf_ct_put(snet->tmpl);
net/netfilter/nf_synproxy_core.c:374: synproxy_proc_exit(net);
net/netfilter/nf_synproxy_core.c-375- free_percpu(snet->stats);
--
net/netfilter/nf_synproxy_core.c-377-
net/netfilter/nf_synproxy_core.c:378:static struct pernet_operations synproxy_net_ops = {
net/netfilter/nf_synproxy_core.c:379: .init = synproxy_net_init,
net/netfilter/nf_synproxy_core.c:380: .exit = synproxy_net_exit,
net/netfilter/nf_synproxy_core.c:381: .id = &synproxy_net_id,
net/netfilter/nf_synproxy_core.c:382: .size = sizeof(struct synproxy_net),
net/netfilter/nf_synproxy_core.c-383-};
net/netfilter/nf_synproxy_core.c-384-
net/netfilter/nf_synproxy_core.c:385:static int __init synproxy_core_init(void)
net/netfilter/nf_synproxy_core.c-386-{
net/netfilter/nf_synproxy_core.c:387: return register_pernet_subsys(&synproxy_net_ops);
net/netfilter/nf_synproxy_core.c-388-}
net/netfilter/nf_synproxy_core.c-389-
net/netfilter/nf_synproxy_core.c:390:static void __exit synproxy_core_exit(void)
net/netfilter/nf_synproxy_core.c-391-{
net/netfilter/nf_synproxy_core.c:392: unregister_pernet_subsys(&synproxy_net_ops);
net/netfilter/nf_synproxy_core.c-393-}
net/netfilter/nf_synproxy_core.c-394-
net/netfilter/nf_synproxy_core.c:395:module_init(synproxy_core_init);
net/netfilter/nf_synproxy_core.c:396:module_exit(synproxy_core_exit);
net/netfilter/nf_synproxy_core.c-397-
net/netfilter/nf_synproxy_core.c=398=static struct iphdr *
net/netfilter/nf_synproxy_core.c:399:synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr,
net/netfilter/nf_synproxy_core.c-400- __be32 daddr)
--
net/netfilter/nf_synproxy_core.c=420=static void
net/netfilter/nf_synproxy_core.c:421:synproxy_send_tcp(struct net *net,
net/netfilter/nf_synproxy_core.c-422- const struct sk_buff *skb, struct sk_buff *nskb,
--
net/netfilter/nf_synproxy_core.c=449=void
net/netfilter/nf_synproxy_core.c:450:synproxy_send_client_synack(struct net *net,
net/netfilter/nf_synproxy_core.c-451- const struct sk_buff *skb, const struct tcphdr *th,
net/netfilter/nf_synproxy_core.c:452: const struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-453-{
--
net/netfilter/nf_synproxy_core.c-461-
net/netfilter/nf_synproxy_core.c:462: tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
net/netfilter/nf_synproxy_core.c-463- nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
--
net/netfilter/nf_synproxy_core.c-468-
net/netfilter/nf_synproxy_core.c:469: niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr);
net/netfilter/nf_synproxy_core.c-470-
--
net/netfilter/nf_synproxy_core.c-484-
net/netfilter/nf_synproxy_core.c:485: synproxy_build_options(nth, opts);
net/netfilter/nf_synproxy_core.c-486-
net/netfilter/nf_synproxy_core.c:487: synproxy_send_tcp(net, skb, nskb, skb_nfct(skb),
net/netfilter/nf_synproxy_core.c-488- IP_CT_ESTABLISHED_REPLY, niph, nth, tcp_hdr_size);
net/netfilter/nf_synproxy_core.c-489-}
net/netfilter/nf_synproxy_core.c:490:EXPORT_SYMBOL_GPL(synproxy_send_client_synack);
net/netfilter/nf_synproxy_core.c-491-
net/netfilter/nf_synproxy_core.c=492=static void
net/netfilter/nf_synproxy_core.c:493:synproxy_send_server_syn(struct net *net,
net/netfilter/nf_synproxy_core.c-494- const struct sk_buff *skb, const struct tcphdr *th,
net/netfilter/nf_synproxy_core.c:495: const struct synproxy_options *opts, u32 recv_seq)
net/netfilter/nf_synproxy_core.c-496-{
net/netfilter/nf_synproxy_core.c:497: struct synproxy_net *snet = synproxy_pernet(net);
net/netfilter/nf_synproxy_core.c-498- struct sk_buff *nskb;
--
net/netfilter/nf_synproxy_core.c-504-
net/netfilter/nf_synproxy_core.c:505: tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
net/netfilter/nf_synproxy_core.c-506- nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
--
net/netfilter/nf_synproxy_core.c-511-
net/netfilter/nf_synproxy_core.c:512: niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr);
net/netfilter/nf_synproxy_core.c-513-
--
net/netfilter/nf_synproxy_core.c-518- nth->seq = htonl(recv_seq - 1);
net/netfilter/nf_synproxy_core.c:519: /* ack_seq is used to relay our ISN to the synproxy hook to initialize
net/netfilter/nf_synproxy_core.c-520- * sequence number translation once a connection tracking entry exists.
--
net/netfilter/nf_synproxy_core.c-530-
net/netfilter/nf_synproxy_core.c:531: synproxy_build_options(nth, opts);
net/netfilter/nf_synproxy_core.c-532-
net/netfilter/nf_synproxy_core.c:533: synproxy_send_tcp(net, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
net/netfilter/nf_synproxy_core.c-534- niph, nth, tcp_hdr_size);
--
net/netfilter/nf_synproxy_core.c=537=static void
net/netfilter/nf_synproxy_core.c:538:synproxy_send_server_ack(struct net *net,
net/netfilter/nf_synproxy_core.c-539- const struct ip_ct_tcp *state,
net/netfilter/nf_synproxy_core.c-540- const struct sk_buff *skb, const struct tcphdr *th,
net/netfilter/nf_synproxy_core.c:541: const struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-542-{
--
net/netfilter/nf_synproxy_core.c-549-
net/netfilter/nf_synproxy_core.c:550: tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
net/netfilter/nf_synproxy_core.c-551- nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
--
net/netfilter/nf_synproxy_core.c-556-
net/netfilter/nf_synproxy_core.c:557: niph = synproxy_build_ip(net, nskb, iph->daddr, iph->saddr);
net/netfilter/nf_synproxy_core.c-558-
--
net/netfilter/nf_synproxy_core.c-570-
net/netfilter/nf_synproxy_core.c:571: synproxy_build_options(nth, opts);
net/netfilter/nf_synproxy_core.c-572-
net/netfilter/nf_synproxy_core.c:573: synproxy_send_tcp(net, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
net/netfilter/nf_synproxy_core.c-574-}
--
net/netfilter/nf_synproxy_core.c=576=static void
net/netfilter/nf_synproxy_core.c:577:synproxy_send_client_ack(struct net *net,
net/netfilter/nf_synproxy_core.c-578- const struct sk_buff *skb, const struct tcphdr *th,
net/netfilter/nf_synproxy_core.c:579: const struct synproxy_options *opts)
net/netfilter/nf_synproxy_core.c-580-{
--
net/netfilter/nf_synproxy_core.c-587-
net/netfilter/nf_synproxy_core.c:588: tcp_hdr_size = sizeof(*nth) + synproxy_options_size(opts);
net/netfilter/nf_synproxy_core.c-589- nskb = alloc_skb(sizeof(*niph) + tcp_hdr_size + MAX_TCP_HEADER,
--
net/netfilter/nf_synproxy_core.c-594-
net/netfilter/nf_synproxy_core.c:595: niph = synproxy_build_ip(net, nskb, iph->saddr, iph->daddr);
net/netfilter/nf_synproxy_core.c-596-
--
net/netfilter/nf_synproxy_core.c-608-
net/netfilter/nf_synproxy_core.c:609: synproxy_build_options(nth, opts);
net/netfilter/nf_synproxy_core.c-610-
net/netfilter/nf_synproxy_core.c:611: synproxy_send_tcp(net, skb, nskb, skb_nfct(skb),
net/netfilter/nf_synproxy_core.c-612- IP_CT_ESTABLISHED_REPLY, niph, nth, tcp_hdr_size);
--
net/netfilter/nf_synproxy_core.c=615=bool
net/netfilter/nf_synproxy_core.c:616:synproxy_recv_client_ack(struct net *net,
net/netfilter/nf_synproxy_core.c-617- const struct sk_buff *skb, const struct tcphdr *th,
net/netfilter/nf_synproxy_core.c:618: struct synproxy_options *opts, u32 recv_seq)
net/netfilter/nf_synproxy_core.c-619-{
net/netfilter/nf_synproxy_core.c:620: struct synproxy_net *snet = synproxy_pernet(net);
net/netfilter/nf_synproxy_core.c-621- int mss;
--
net/netfilter/nf_synproxy_core.c-633- if (opts->options & NF_SYNPROXY_OPT_TIMESTAMP)
net/netfilter/nf_synproxy_core.c:634: synproxy_check_timestamp_cookie(opts);
net/netfilter/nf_synproxy_core.c-635-
net/netfilter/nf_synproxy_core.c:636: synproxy_send_server_syn(net, skb, th, opts, recv_seq);
net/netfilter/nf_synproxy_core.c-637- return true;
net/netfilter/nf_synproxy_core.c-638-}
net/netfilter/nf_synproxy_core.c:639:EXPORT_SYMBOL_GPL(synproxy_recv_client_ack);
net/netfilter/nf_synproxy_core.c-640-
net/netfilter/nf_synproxy_core.c=641=unsigned int
net/netfilter/nf_synproxy_core.c:642:ipv4_synproxy_hook(void *priv, struct sk_buff *skb,
net/netfilter/nf_synproxy_core.c-643- const struct nf_hook_state *nhs)
--
net/netfilter/nf_synproxy_core.c-645- struct net *net = nhs->net;
net/netfilter/nf_synproxy_core.c:646: struct synproxy_net *snet = synproxy_pernet(net);
net/netfilter/nf_synproxy_core.c-647- enum ip_conntrack_info ctinfo;
net/netfilter/nf_synproxy_core.c-648- struct nf_conn *ct;
net/netfilter/nf_synproxy_core.c:649: struct nf_conn_synproxy *synproxy;
net/netfilter/nf_synproxy_core.c:650: struct synproxy_options opts = {};
net/netfilter/nf_synproxy_core.c-651- const struct ip_ct_tcp *state;
--
net/netfilter/nf_synproxy_core.c-658-
net/netfilter/nf_synproxy_core.c:659: synproxy = nfct_synproxy(ct);
net/netfilter/nf_synproxy_core.c:660: if (!synproxy)
net/netfilter/nf_synproxy_core.c-661- return NF_ACCEPT;
--
net/netfilter/nf_synproxy_core.c-675- if (th->rst && CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL) {
net/netfilter/nf_synproxy_core.c:676: nf_ct_seqadj_init(ct, ctinfo, synproxy->isn -
net/netfilter/nf_synproxy_core.c-677- ntohl(th->seq) + 1);
--
net/netfilter/nf_synproxy_core.c-689- nf_ct_seqadj_init(ct, ctinfo, 0);
net/netfilter/nf_synproxy_core.c:690: synproxy->tsoff = 0;
net/netfilter/nf_synproxy_core.c-691- this_cpu_inc(snet->stats->conn_reopened);
--
net/netfilter/nf_synproxy_core.c-693- case TCP_CONNTRACK_SYN_SENT:
net/netfilter/nf_synproxy_core.c:694: if (!synproxy_parse_options(skb, thoff, th, &opts))
net/netfilter/nf_synproxy_core.c-695- return NF_DROP;
--
net/netfilter/nf_synproxy_core.c-702- */
net/netfilter/nf_synproxy_core.c:703: if (synproxy_recv_client_ack(net, skb, th, &opts,
net/netfilter/nf_synproxy_core.c-704- ntohl(th->seq) + 1)) {
--
net/netfilter/nf_synproxy_core.c-712-
net/netfilter/nf_synproxy_core.c:713: synproxy->isn = ntohl(th->ack_seq);
net/netfilter/nf_synproxy_core.c-714- if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP)
net/netfilter/nf_synproxy_core.c:715: synproxy->its = opts.tsecr;
net/netfilter/nf_synproxy_core.c-716-
--
net/netfilter/nf_synproxy_core.c-722-
net/netfilter/nf_synproxy_core.c:723: if (!synproxy_parse_options(skb, thoff, th, &opts))
net/netfilter/nf_synproxy_core.c-724- return NF_DROP;
--
net/netfilter/nf_synproxy_core.c-726- if (opts.options & NF_SYNPROXY_OPT_TIMESTAMP) {
net/netfilter/nf_synproxy_core.c:727: synproxy->tsoff = opts.tsval - synproxy->its;
net/netfilter/nf_synproxy_core.c-728- nf_conntrack_event_cache(IPCT_SYNPROXY, ct);
--
net/netfilter/nf_synproxy_core.c-735- swap(opts.tsval, opts.tsecr);
net/netfilter/nf_synproxy_core.c:736: synproxy_send_server_ack(net, state, skb, th, &opts);
net/netfilter/nf_synproxy_core.c-737-
net/netfilter/nf_synproxy_core.c:738: nf_ct_seqadj_init(ct, ctinfo, synproxy->isn - ntohl(th->seq));
net/netfilter/nf_synproxy_core.c-739- nf_conntrack_event_cache(IPCT_SEQADJ, ct);
--
net/netfilter/nf_synproxy_core.c-741- swap(opts.tsval, opts.tsecr);
net/netfilter/nf_synproxy_core.c:742: synproxy_send_client_ack(net, skb, th, &opts);
net/netfilter/nf_synproxy_core.c-743-
--
net/netfilter/nf_synproxy_core.c-749-
net/netfilter/nf_synproxy_core.c:750: if (!synproxy_tstamp_adjust(skb, thoff, th, ct, ctinfo, synproxy))
net/netfilter/nf_synproxy_core.c-751- return NF_DROP_REASON(skb, SKB_DROP_REASON_NETFILTER_DROP, ENOMEM);
--
net/netfilter/nf_synproxy_core.c-754-}
net/netfilter/nf_synproxy_core.c:755:EXPORT_SYMBOL_GPL(ipv4_synproxy_hook);
net/netfilter/nf_synproxy_core.c-756-
net/netfilter/nf_synproxy_core.c:757:static const struct nf_hook_ops ipv4_synproxy_ops[] = {
net/netfilter/nf_synproxy_core.c-758- {
net/netfilter/nf_synproxy_core.c:759: .hook = ipv4_synproxy_hook,
net/netfilter/nf_synproxy_core.c-760- .pf = NFPROTO_IPV4,
--
net/netfilter/nf_synproxy_core.c-764- {
net/netfilter/nf_synproxy_core.c:765: .hook = ipv4_synproxy_hook,
net/netfilter/nf_synproxy_core.c-766- .pf = NFPROTO_IPV4,
--
net/netfilter/nf_synproxy_core.c-771-
net/netfilter/nf_synproxy_core.c:772:int nf_synproxy_ipv4_init(struct synproxy_net *snet, struct net *net)
net/netfilter/nf_synproxy_core.c-773-{
--
net/netfilter/nf_synproxy_core.c-775-
net/netfilter/nf_synproxy_core.c:776: mutex_lock(&synproxy_mutex);
net/netfilter/nf_synproxy_core.c-777- if (snet->hook_ref4 == 0) {
net/netfilter/nf_synproxy_core.c:778: err = nf_register_net_hooks(net, ipv4_synproxy_ops,
net/netfilter/nf_synproxy_core.c:779: ARRAY_SIZE(ipv4_synproxy_ops));
net/netfilter/nf_synproxy_core.c-780- if (err)
--
net/netfilter/nf_synproxy_core.c-785-out:
net/netfilter/nf_synproxy_core.c:786: mutex_unlock(&synproxy_mutex);
net/netfilter/nf_synproxy_core.c-787- return err;
net/netfilter/nf_synproxy_core.c-788-}
net/netfilter/nf_synproxy_core.c:789:EXPORT_SYMBOL_GPL(nf_synproxy_ipv4_init);
net/netfilter/nf_synproxy_core.c-790-
net/netfilter/nf_synproxy_core.c:791:void nf_synproxy_ipv4_fini(struct synproxy_net *snet, struct net *net)
net/netfilter/nf_synproxy_core.c-792-{
net/netfilter/nf_synproxy_core.c:793: mutex_lock(&synproxy_mutex);
net/netfilter/nf_synproxy_core.c-794- snet->hook_ref4--;
net/netfilter/nf_synproxy_core.c-795- if (snet->hook_ref4 == 0)
net/netfilter/nf_synproxy_core.c:796: nf_unregister_net_hooks(net, ipv4_synproxy_ops,
net/netfilter/nf_synproxy_core.c:797: ARRAY_SIZE(ipv4_synproxy_ops));
net/netfilter/nf_synproxy_core.c:798: mutex_unlock(&synproxy_mutex);
net/netfilter/nf_synproxy_core.c-799-}
net/netfilter/nf_synproxy_core.c:800:EXPORT_SYMBOL_GPL(nf_synproxy_ipv4_fini);
net/netfilter/nf_synproxy_core.c-801-
]
|
| 22/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 29856
output: 44
thoughts: 891
Thoughts: **Analyzing the SYN Proxy Path**
Okay, so I'm tracing the path of a SYN-ACK packet generated by `synproxy_send_client_synack`. I see that the packet is sent using `ip_local_out`. Right, `ip_local_out` is the key. That sends it through the regular network stack, eventually reaching the output device.
Now, the potential gotcha: If the routing table sends the packet back to the loopback interface, then it gets received again. That means it would go through `ip_rcv` -> `ip_local_deliver` -> `nft_do_chain_inet` -> `nft_synproxy_eval` -> `synproxy_send_client_synack` ... and the loop repeats.
Specifically, I'm concerned because `synproxy_send_client_synack` creates a SYN-ACK in response to a SYN, which is exactly the structure of the packet being *received* now. This would result in another SYN-ACK. And so on, ad infinitum. So the question is: does `nft_synproxy_eval` correctly handle this SYN-ACK-turned-SYN, or is it going to get stuck in a recursive loop? Time to check the code in `nft_synproxy_eval`.
|
| 23/2 |
2026/09/12 00:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nft_synproxy.c Name:nft_synproxy_eval_v4]
Results: map[SourceCode: 44: static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
45: struct nft_regs *regs,
46: const struct nft_pktinfo *pkt,
47: const struct tcphdr *tcp,
48: struct tcphdr *_tcph,
49: struct synproxy_options *opts)
50: {
51: struct nf_synproxy_info info = READ_ONCE(priv->info);
52: struct net *net = nft_net(pkt);
53: struct synproxy_net *snet = synproxy_pernet(net);
54: struct sk_buff *skb = pkt->skb;
55:
56: if (tcp->syn) {
57: /* Initial SYN from client */
58: nft_synproxy_tcp_options(opts, tcp, snet, &info);
59: synproxy_send_client_synack(net, skb, tcp, opts);
60: consume_skb(skb);
61: regs->verdict.code = NF_STOLEN;
62: } else if (tcp->ack) {
63: /* ACK from client */
64: if (synproxy_recv_client_ack(net, skb, tcp, opts,
65: ntohl(tcp->seq))) {
66: consume_skb(skb);
67: regs->verdict.code = NF_STOLEN;
68: } else {
69: regs->verdict.code = NF_DROP;
70: }
71: }
72: }
SourceFile:net/netfilter/nft_synproxy.c]
|
| 24/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 31551
output: 43
thoughts: 424
Thoughts: **The SYN-ACK Loop: A Deep Dive**
Okay, so I'm tracing the logic here in this synproxy implementation, and I've hit a pretty nasty problem. It seems like the condition `tcp->syn` is the smoking gun here. If I see a SYN packet with `tcp->syn` set, the evaluation function, `nft_synproxy_eval_v4`, kicks into gear. A SYN-ACK packet, by definition, *has* `tcp->syn` set, right? So, `nft_synproxy_eval_v4` is going to process it, which makes me think that the response should be handled by `synproxy_send_client_synack`, and it does!
The problem is, `synproxy_send_client_synack` turns around and generates *another* SYN-ACK. And here's where things get really interesting; this new packet is swapped! Source and destination addresses are flipped in the SYN-ACK generated by `synproxy_send_client_synack`, which means we're dealing with local loopback traffic, it means both A and B are the local machine.
Let me lay this out step-by-step:
1. We get a SYN packet from A to B (the local machine)
2. `nft_synproxy_eval_v4` generates a SYN-ACK from B to A.
3. This SYN-ACK goes out, and if it's loopback, is received.
4. This SYN-ACK *also* has `tcp->syn` set.
5. `nft_synproxy_eval_v4` sees the SYN-ACK, which triggers another packet, resulting in a SYN-ACK from A to B.
6. The new SYN-ACK goes out, it's routed back to loopback, and we're *back* in step 4!
It's a loop! Every SYN-ACK gets evaluated, and the logic is going to kick off a new SYN-ACK, infinitely. That's a major vulnerability. We're getting an infinite feedback loop.
Now, I've got to confirm if `tcp->syn` is *the only* condition. I need to double-check what calls `nft_synproxy_eval_v4`, and then look into `nft_synproxy_do_eval`. I know I'm missing something, so I will have to start there.
|
| 25/2 |
2026/09/12 00:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nft_synproxy.c Name:nft_synproxy_do_eval]
Results: map[SourceCode: 106: static void nft_synproxy_do_eval(const struct nft_synproxy *priv,
107: struct nft_regs *regs,
108: const struct nft_pktinfo *pkt)
109: {
110: struct synproxy_options opts = {};
111: struct sk_buff *skb = pkt->skb;
112: int thoff = nft_thoff(pkt);
113: const struct tcphdr *tcp;
114: struct tcphdr _tcph;
115:
116: if (pkt->tprot != IPPROTO_TCP) {
117: regs->verdict.code = NFT_BREAK;
118: return;
119: }
120:
121: if (nf_ip_checksum(skb, nft_hook(pkt), thoff, IPPROTO_TCP)) {
122: regs->verdict.code = NF_DROP;
123: return;
124: }
125:
126: tcp = skb_header_pointer(skb, thoff,
127: sizeof(struct tcphdr),
128: &_tcph);
129: if (!tcp) {
130: regs->verdict.code = NF_DROP;
131: return;
132: }
133:
134: if (!synproxy_parse_options(skb, thoff, tcp, &opts)) {
135: regs->verdict.code = NF_DROP;
136: return;
137: }
138:
139: switch (skb->protocol) {
140: case htons(ETH_P_IP):
141: nft_synproxy_eval_v4(priv, regs, pkt, tcp, &_tcph, &opts);
142: return;
143: #if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
144: case htons(ETH_P_IPV6):
145: nft_synproxy_eval_v6(priv, regs, pkt, tcp, &_tcph, &opts);
146: return;
147: #endif
148: }
149: regs->verdict.code = NFT_BREAK;
150: }
SourceFile:net/netfilter/nft_synproxy.c]
|
| 26/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 33240
output: 43
thoughts: 108
Thoughts: **SYN-ACK Packet Confusion**
Okay, hold on a second. I'm looking at `nft_synproxy_eval_v4`, and it's checking `tcp->syn`. That's the key field. But if the incoming packet is a SYN-ACK, wouldn't `tcp->syn` be *set to 1* and `tcp->ack` also be set to 1? That means the `if (tcp->syn)` condition would evaluate to TRUE! And if that's the case, itβll generate a SYN-ACK in response, right? Thatβs not what we want.
I need to confirm if there's any validation that the packet is *exclusively* a SYN packet. Is there a filter that verifies the packet doesn't have the ACK flag set? I'm going to quickly check `ipt_SYNPROXY.c` to see if it suffers from the exact same issue. This could be a widespread problem if both implementations are flawed in the same way.
|
| 27/2 |
2026/09/12 00:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/ipv4/netfilter/ipt_SYNPROXY.c Name:synproxy_tg4]
Results: map[SourceCode: 12: static unsigned int
13: synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
14: {
15: const struct xt_synproxy_info *info = par->targinfo;
16: struct net *net = xt_net(par);
17: struct synproxy_net *snet = synproxy_pernet(net);
18: struct synproxy_options opts = {};
19: struct tcphdr *th, _th;
20:
21: if (nf_ip_checksum(skb, xt_hooknum(par), par->thoff, IPPROTO_TCP))
22: return NF_DROP;
23:
24: th = skb_header_pointer(skb, par->thoff, sizeof(_th), &_th);
25: if (th == NULL)
26: return NF_DROP;
27:
28: if (!synproxy_parse_options(skb, par->thoff, th, &opts))
29: return NF_DROP;
30:
31: if (th->syn && !(th->ack || th->fin || th->rst)) {
32: /* Initial SYN from client */
33: this_cpu_inc(snet->stats->syn_received);
34:
35: if (th->ece && th->cwr)
36: opts.options |= XT_SYNPROXY_OPT_ECN;
37:
38: opts.options &= info->options;
39: opts.mss_encode = opts.mss_option;
40: opts.mss_option = info->mss;
41: if (opts.options & XT_SYNPROXY_OPT_TIMESTAMP)
42: synproxy_init_timestamp_cookie(info, &opts);
43: else
44: opts.options &= ~(XT_SYNPROXY_OPT_WSCALE |
45: XT_SYNPROXY_OPT_SACK_PERM |
46: XT_SYNPROXY_OPT_ECN);
47:
48: synproxy_send_client_synack(net, skb, th, &opts);
49: consume_skb(skb);
50: return NF_STOLEN;
51: } else if (th->ack && !(th->fin || th->rst || th->syn)) {
52: /* ACK from client */
53: if (synproxy_recv_client_ack(net, skb, th, &opts, ntohl(th->seq))) {
54: consume_skb(skb);
55: return NF_STOLEN;
56: } else {
57: return NF_DROP;
58: }
59: }
60:
61: return XT_CONTINUE;
62: }
SourceFile:net/ipv4/netfilter/ipt_SYNPROXY.c]
|
| 28/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 34423
output: 44
thoughts: 93
Thoughts: **My Initial Assessment of the SYNPROXY Implementation**
Right, so I was just looking at these SYNPROXY implementations and immediately spotted something interesting. In `ipt_SYNPROXY.c`, they're checking for a SYN packet *and* making sure it's not an ACK, FIN, or RST packet using `if (th->syn && !(th->ack || th->fin || th->rst))`. Good, that's what I'd expect. However, when I glanced at `nft_synproxy.c`, it seems they are *only* checking for the SYN flag with `if (tcp->syn)`. That omission is a significant potential flaw; it looks like they're missing the important check for `!tcp->ack`. That's a classic mistake, and easily could lead to bypass. I better double check the evaluation function for IPv4, `nft_synproxy_eval_v4`, and make absolutely sure I'm not missing anything. This needs a closer look.
|
| 29/2 |
2026/09/12 00:53 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nft_synproxy.c Name:nft_synproxy_eval_v4]
Results: map[SourceCode: 44: static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
45: struct nft_regs *regs,
46: const struct nft_pktinfo *pkt,
47: const struct tcphdr *tcp,
48: struct tcphdr *_tcph,
49: struct synproxy_options *opts)
50: {
51: struct nf_synproxy_info info = READ_ONCE(priv->info);
52: struct net *net = nft_net(pkt);
53: struct synproxy_net *snet = synproxy_pernet(net);
54: struct sk_buff *skb = pkt->skb;
55:
56: if (tcp->syn) {
57: /* Initial SYN from client */
58: nft_synproxy_tcp_options(opts, tcp, snet, &info);
59: synproxy_send_client_synack(net, skb, tcp, opts);
60: consume_skb(skb);
61: regs->verdict.code = NF_STOLEN;
62: } else if (tcp->ack) {
63: /* ACK from client */
64: if (synproxy_recv_client_ack(net, skb, tcp, opts,
65: ntohl(tcp->seq))) {
66: consume_skb(skb);
67: regs->verdict.code = NF_STOLEN;
68: } else {
69: regs->verdict.code = NF_DROP;
70: }
71: }
72: }
SourceFile:net/netfilter/nft_synproxy.c]
|
| 30/2 |
2026/09/12 00:53 |
llm |
expert |
0m
Model:
Tokens:
input: 35250
output: 41
thoughts: 3530
Thoughts: **Vulnerability Analysis: Infinite SYN-ACK Loop in nftables synproxy**
Okay, here's what I've figured out: the `nft_synproxy_eval_v4` function in nftables has a critical flaw. It checks for the `tcp->syn` flag, but if it encounters a SYN-ACK packet, it incorrectly interprets this as a SYN and generates *another* SYN-ACK. The core problem is that this new SYN-ACK can be routed back to the same machine, creating an infinite loop. This happens when the source and destination are both local, such as with a loopback address or a case where the rule matches on output.
Specifically, the `nft_synproxy_eval_v4` is called by `nft_synproxy_do_eval`, which is in turn called from `nft_do_chain`. It can be attached to any chain, but typically PREROUTING or INPUT.
An attacker can exploit this by sending a crafted SYN packet with the source address equal to the destination address (spoofing the victim's own address) to a local address. The victim, with an `nft_synproxy` rule, will generate a SYN-ACK, routing it back to itself, triggering the rule again, and again, creating an infinite loop. The vulnerability lies in `tcp->syn` matching SYN-ACK.
This is a Denial of Service. The generated SYN-ACKs are queued on the loopback interface by `dev_queue_xmit`, processed in softirq (`net_rx_action`), potentially causing a softlockup, starving the CPU. The bug report points that the packet is coming from `ip_rcv` -> `ip_local_deliver` -> `nft_do_chain_inet` -> `nft_synproxy_eval`, which means the rule is on the INPUT chain.
If the rule is added to the OUTPUT chain, the same loop can occur because `ip_local_out` is also processed in the OUTPUT chain. The SYN-ACK that is generated by `nft_synproxy` is sent using `ip_local_out` which goes to the OUTPUT chain again, triggering the rule recursively.
The good news (if you can call it that) is that many ISPs use BCP38 to filter spoofed packets, but not all. If the attacker is on the local network as the victim, address spoofing is trivial. If the victim's public IP is not a martian, a "Land attack" scenario is possible: sending a packet with SRC = DST = Victim's public IP. Reverse Path Filtering (rp_filter) *might* mitigate it if in strict mode, however, it is frequently set to loose or disabled. This means that a loop is still possible.
What's particularly concerning is that this can be triggered from an unprivileged user namespace. An unprivileged user can create a network namespace, add an nftables synproxy rule, and then send a packet to loopback to trigger the loop, causing a softlockup on the host CPU. A softlockup in the netns can crash the whole host.
|
| 31/2 |
2026/09/12 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nft_synproxy.c Name:nft_synproxy_init]
Results: map[SourceCode: 262: static int nft_synproxy_init(const struct nft_ctx *ctx,
263: const struct nft_expr *expr,
264: const struct nlattr * const tb[])
265: {
266: struct nft_synproxy *priv = nft_expr_priv(expr);
267:
268: return nft_synproxy_do_init(ctx, tb, priv);
269: }
SourceFile:net/netfilter/nft_synproxy.c]
|
| 32/2 |
2026/09/12 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 39640
output: 43
thoughts: 14
Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience:
**Diving into `nft_synproxy_do_init`**
Alright, time to dig into this `nft_synproxy_do_init` function. I'm already mentally running through the Netfilter internals β looking for any potential surprises or gotchas. My focus is on the initialization process. What data structures are they setting up? How are they interacting with the existing Netfilter infrastructure? I'm particularly interested in how they're handling memory allocation, as that's always a prime source of issues in kernel code. Is it using the standard `kmalloc` and `kfree` paths, or are there any custom allocators at play? If so, why? Are there any potential race conditions during initialization that I need to be aware of, especially if this function is called from multiple contexts? I'll also be mentally mapping out its interactions with the `nf_hook_ops` structure; how does it register itself and what hook points is it using? Are there any obvious security vulnerabilities lurking in the code? I want to pay attention to the error handling paths and how thoroughly they are handled. My goal is to understand the initialization's behavior and potential pitfalls.
|
| 33/2 |
2026/09/12 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nft_synproxy.c Name:nft_synproxy_do_init]
Results: map[SourceCode: 152: static int nft_synproxy_do_init(const struct nft_ctx *ctx,
153: const struct nlattr * const tb[],
154: struct nft_synproxy *priv)
155: {
156: struct synproxy_net *snet = synproxy_pernet(ctx->net);
157: u32 flags;
158: int err;
159:
160: if (tb[NFTA_SYNPROXY_MSS])
161: priv->info.mss = ntohs(nla_get_be16(tb[NFTA_SYNPROXY_MSS]));
162: if (tb[NFTA_SYNPROXY_WSCALE])
163: priv->info.wscale = nla_get_u8(tb[NFTA_SYNPROXY_WSCALE]);
164: if (tb[NFTA_SYNPROXY_FLAGS]) {
165: flags = ntohl(nla_get_be32(tb[NFTA_SYNPROXY_FLAGS]));
166: if (flags & ~NF_SYNPROXY_OPT_MASK)
167: return -EOPNOTSUPP;
168: priv->info.options = flags;
169: }
170:
171: err = nf_ct_netns_get(ctx->net, ctx->family);
172: if (err)
173: return err;
174:
175: switch (ctx->family) {
176: case NFPROTO_IPV4:
177: err = nf_synproxy_ipv4_init(snet, ctx->net);
178: if (err)
179: goto nf_ct_failure;
180: break;
181: #if IS_ENABLED(CONFIG_NF_TABLES_IPV6)
182: case NFPROTO_IPV6:
183: err = nf_synproxy_ipv6_init(snet, ctx->net);
184: if (err)
185: goto nf_ct_failure;
186: break;
187: #endif
188: case NFPROTO_INET:
189: err = nf_synproxy_ipv4_init(snet, ctx->net);
190: if (err)
191: goto nf_ct_failure;
192: err = nf_synproxy_ipv6_init(snet, ctx->net);
193: if (err) {
194: nf_synproxy_ipv4_fini(snet, ctx->net);
195: goto nf_ct_failure;
196: }
197: break;
198: }
199:
200: return 0;
201:
202: nf_ct_failure:
203: nf_ct_netns_put(ctx->net, ctx->family);
204: return err;
205: }
SourceFile:net/netfilter/nft_synproxy.c]
|
| 34/2 |
2026/09/12 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 40830
output: 37
thoughts: 317
Thoughts: **My Analysis of the Synproxy Vulnerability**
Okay, so I'm looking at this synproxy issue, and it's pretty straightforward at first glance. The code path basically starts with `nf_synproxy_ipv4_init`, which just handles registering the necessary hooks. No obvious user namespace restrictions are present, which immediately raises a red flag. That means an unprivileged user can create a namespace, network namespace, set up an nftables rule with synproxy enabled, and then trigger the loop by just sending a SYN packet to the loopback interface. Classic privilege escalation.
But hang on, if this is an infinite loop, why doesn't `net_rx_action` eventually bail out after, say, a couple of jiffies? Ah, I see, it's not a single monolithic `net_rx_action` call. It processes some packets, then returns. However, the softirq is re-armed, and `ksoftirqd` is responsible for picking it up and running it again.
Wait a secondβ¦ if `ksoftirqd` is the one running it, then the backtrace should show `ksoftirqd` in the stack. But the backtrace *doesnβt*! It's showing `kworker/R-bat_e` β a workqueue worker β executing `batadv_tt_purge`, which then calls `spin_unlock_bh`. And *that's* the key. `spin_unlock_bh` enables bottom halves and processes pending softirqs *synchronously* on the current stack! So, this isn't just a re-arm of the softirq, it's immediate processing.
If the softirq is processed synchronously, `__do_softirq` will loop, up to 10 times. Aha! `__do_softirq` loops up to 10 times, and then, after exhausting the loops, calls `wakeup_softirqd`. Interesting. Now I need to confirm this behavior; time to go and check `__do_softirq` in `kernel/softirq.c` to verify the bounds of the loop.
|
| 35/2 |
2026/09/12 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:__do_softirq]
Results: map[SourceCode: 677: asmlinkage __visible void __softirq_entry __do_softirq(void)
678: {
679: handle_softirqs(false);
680: }
SourceFile:kernel/softirq.c]
|
| 36/2 |
2026/09/12 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 41733
output: 36
thoughts: 11
Thoughts: Okay, here's my summary, presented as a stream of thought:
**Diving into `handle_softirqs`**
Right, time to dig into this `handle_softirqs` function. I've been meaning to revisit this part of the kernel for a while, and now seems like the perfect opportunity. Let's see how things are currently implemented, focusing on the concurrency aspects and any potential bottlenecks. I'm especially interested in how it interacts with the hardware interrupt handling, given that's typically where softirqs are triggered from. Are there any clever synchronization primitives being used? What's the scheduling policy? Is it truly preemptible, or are there hidden lock-ups I need to be aware of? I'll probably start by tracing the call graph and identifying any critical sections. I need to understand how the system balances the need for immediate interrupt handling with preventing starvation of softirqs. Okay, let's start with the source... I'll keep an eye out for any unusual data structures or optimizations I might have overlooked in the past.
|
| 37/2 |
2026/09/12 00:54 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:handle_softirqs]
Results: map[SourceCode: 602: static void handle_softirqs(bool ksirqd)
603: {
604: unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
605: unsigned long old_flags = current->flags;
606: int max_restart = MAX_SOFTIRQ_RESTART;
607: struct softirq_action *h;
608: bool in_hardirq;
609: __u32 pending;
610: int softirq_bit;
611:
612: /*
613: * Mask out PF_MEMALLOC as the current task context is borrowed for the
614: * softirq. A softirq handled, such as network RX, might set PF_MEMALLOC
615: * again if the socket is related to swapping.
616: */
617: current->flags &= ~PF_MEMALLOC;
618:
619: pending = local_softirq_pending();
620:
621: softirq_handle_begin();
622: in_hardirq = lockdep_softirq_start();
623: account_softirq_enter(current);
624:
625: restart:
626: /* Reset the pending bitmask before enabling irqs */
627: set_softirq_pending(0);
628:
629: local_irq_enable();
630:
631: h = softirq_vec;
632:
633: while ((softirq_bit = ffs(pending))) {
634: unsigned int vec_nr;
635: int prev_count;
636:
637: h += softirq_bit - 1;
638:
639: vec_nr = h - softirq_vec;
640: prev_count = preempt_count();
641:
642: kstat_incr_softirqs_this_cpu(vec_nr);
643:
644: trace_softirq_entry(vec_nr);
645: h->action();
646: trace_softirq_exit(vec_nr);
647: if (unlikely(prev_count != preempt_count())) {
648: pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
649: vec_nr, softirq_to_name[vec_nr], h->action,
650: prev_count, preempt_count());
651: preempt_count_set(prev_count);
652: }
653: h++;
654: pending >>= softirq_bit;
655: }
656:
657: if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd)
658: rcu_softirq_qs();
659:
660: local_irq_disable();
661:
662: pending = local_softirq_pending();
663: if (pending) {
664: if (time_before(jiffies, end) && !need_resched() &&
665: --max_restart)
666: goto restart;
667:
668: wakeup_softirqd();
669: }
670:
671: account_softirq_exit(current);
672: lockdep_softirq_end(in_hardirq);
673: softirq_handle_end();
674: current_restore_flags(old_flags, PF_MEMALLOC);
675: }
SourceFile:kernel/softirq.c]
|
| 38/2 |
2026/09/12 00:54 |
llm |
expert |
0m
Model:
Tokens:
input: 43110
output: 37
thoughts: 223
Thoughts: **Analyzing a Softlockup in the Kernel**
Okay, so I'm tracking this softlockup, and it seems like `handle_softirqs` is the starting point. It's supposed to loop a limited number of times β up to ten, or until a short time window passes. Then it's supposed to wake up the softirqd and return. But if it returns, why is the CPU getting stuck?
The softlockup trigger is specifically within `check_kcov_mode` inside `ipt_do_table`. That's where things get interesting. It strongly suggests the CPU is getting hung *inside* `net_rx_action` or one of the packet processing functions. I need to trace the network path. `synproxy_send_client_synack` calls `ip_local_out`, which calls `ip_output`, which calls `dev_queue_xmit`, which then calls `__dev_queue_xmit`.
Now, if the packet is being sent to loopback, `__dev_queue_xmit` will call `dev_hard_start_xmit`, which eventually calls `loopback_xmit`. That's where I need to focus my attention. It seems there is a race condition in the loopback driver, or at least a resource issue that manifests on loopback and is exposed by whatever is in that path. Time to dive into `loopback_xmit` and see what's going on there.
|
| 39/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/loopback.c Name:loopback_xmit]
Results: map[SourceCode: 67: /* The higher levels take care of making this non-reentrant (it's
68: * called with bh's disabled).
69: */
70: static netdev_tx_t loopback_xmit(struct sk_buff *skb,
71: struct net_device *dev)
72: {
73: int len;
74:
75: skb_tx_timestamp(skb);
76:
77: /* do not fool net_timestamp_check() with various clock bases */
78: skb_clear_tstamp(skb);
79:
80: skb_orphan(skb);
81:
82: /* Before queueing this packet to __netif_rx(),
83: * make sure dst is refcounted.
84: */
85: skb_dst_force(skb);
86:
87: skb->protocol = eth_type_trans(skb, dev);
88:
89: len = skb->len;
90: if (likely(__netif_rx(skb) == NET_RX_SUCCESS))
91: dev_lstats_add(dev, len);
92:
93: return NETDEV_TX_OK;
94: }
SourceFile:drivers/net/loopback.c]
|
| 40/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 44080
output: 36
thoughts: 31
Thoughts: Here's my analysis of the provided snippet, as though it were my train of thought:
**Diving into the `loopback_xmit` Path**
Okay, so `loopback_xmit` kicks off the process, and from the looks of it, it's immediately calling `__netif_rx(skb)`. That's interesting. I need to understand what's happening within `__netif_rx` and what role it plays in the whole loopback process. Itβs pretty fundamental. I should probably focus my attention there for now to get a better handle on the data flow. Let's dig into that function definition next.
|
| 41/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:__netif_rx]
Results: map[SourceCode:5786: /**
5787: * __netif_rx - Slightly optimized version of netif_rx
5788: * @skb: buffer to post
5789: *
5790: * This behaves as netif_rx except that it does not disable bottom halves.
5791: * As a result this function may only be invoked from the interrupt context
5792: * (either hard or soft interrupt).
5793: */
5794: int __netif_rx(struct sk_buff *skb)
5795: {
5796: int ret;
5797:
5798: lockdep_assert_once(hardirq_count() | softirq_count());
5799:
5800: trace_netif_rx_entry(skb);
5801: ret = netif_rx_internal(skb);
5802: trace_netif_rx_exit(ret);
5803: return ret;
5804: }
SourceFile:net/core/dev.c]
|
| 42/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 44605
output: 37
thoughts: 17
Thoughts: Here's my take on the process, framed as a concise summary of my thoughts:
**Network Packet Flow: The Backlog's Role**
Okay, so I'm looking at how the network stack handles incoming packets, and it seems `netif_rx_internal` is the key function in the receive path. What's interesting is that this function directly calls `enqueue_to_backlog`. I interpret this as the primary way that packets are added to the backlog queue. This makes sense from a design perspective; `netif_rx_internal` handles the initial processing, likely device-specific setup, checksum verification and basic filtering, and then hands off the packet to the backlog for further, potentially more time-intensive processing which can be done later. The implication is that `enqueue_to_backlog` is a core mechanism for managing packet flow and prioritizing or delaying processing, and probably synchronizes access to shared resources. The "backlog" term implies there's some sort of queueing happening here, which could be important for dealing with bursty network traffic and avoiding race conditions. This is a very interesting piece of the puzzle. Iβll need to delve deeper into what that backlog queue *is* and how `enqueue_to_backlog` interacts with the rest of the system, like the softirq processing mechanism.
|
| 43/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:enqueue_to_backlog]
Results: map[SourceCode:5425: /*
5426: * enqueue_to_backlog is called to queue an skb to a per CPU backlog
5427: * queue (may be a remote CPU queue).
5428: */
5429: static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
5430: unsigned int *qtail)
5431: {
5432: enum skb_drop_reason reason;
5433: struct softnet_data *sd;
5434: unsigned long flags;
5435: unsigned int qlen;
5436: int max_backlog;
5437: u32 tail;
5438:
5439: reason = SKB_DROP_REASON_DEV_READY;
5440:
5441: sd = &per_cpu(softnet_data, cpu);
5442:
5443: qlen = skb_queue_len_lockless(&sd->input_pkt_queue);
5444: max_backlog = READ_ONCE(net_hotdata.max_backlog);
5445: if (unlikely(qlen > max_backlog) ||
5446: skb_flow_limit(skb, qlen, max_backlog))
5447: goto cpu_backlog_drop;
5448: backlog_lock_irq_save(sd, &flags);
5449: qlen = skb_queue_len(&sd->input_pkt_queue);
5450: if (likely(qlen <= max_backlog)) {
5451: if (unlikely(!netif_running(skb->dev))) {
5452: backlog_unlock_irq_restore(sd, flags);
5453: goto bad_dev;
5454: }
5455: if (!qlen) {
5456: /* Schedule NAPI for backlog device. We can use
5457: * non atomic operation as we own the queue lock.
5458: */
5459: if (!__test_and_set_bit(NAPI_STATE_SCHED,
5460: &sd->backlog.state))
5461: napi_schedule_rps(sd);
5462: }
5463: __skb_queue_tail(&sd->input_pkt_queue, skb);
5464: tail = rps_input_queue_tail_incr(sd);
5465: backlog_unlock_irq_restore(sd, flags);
5466:
5467: /* save the tail outside of the critical section */
5468: rps_input_queue_tail_save(qtail, tail);
5469: return NET_RX_SUCCESS;
5470: }
5471:
5472: backlog_unlock_irq_restore(sd, flags);
5473:
5474: cpu_backlog_drop:
5475: reason = SKB_DROP_REASON_CPU_BACKLOG;
5476: numa_drop_add(&sd->drop_counters, 1);
5477: bad_dev:
5478: dev_core_stats_rx_dropped_inc(skb->dev);
5479: kfree_skb_reason(skb, reason);
5480: return NET_RX_DROP;
5481: }
SourceFile:net/core/dev.c]
|
| 44/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 45897
output: 35
thoughts: 316
Thoughts: **My Analysis of the Backlog Loop**
Okay, let's break this down. `enqueue_to_backlog` uses `sd->input_pkt_queue`, and if the queue length (`qlen`) exceeds `max_backlog`, it's supposed to drop the packet. The implication is, of course, that the backlog wouldn't be able to grow infinitely, and then...the loop would stop. But if the loop stops, then there can't be an infinite loop, right? So, why the soft lockup?
Wait a second. The crucial part I missed is that `process_backlog` is *also* actively working with that same `sd->input_pkt_queue`. It's dequeuing packets from `sd->input_pkt_queue`, moving them to `sd->process_queue`, and then processing them. And *while* it's processing, things get interesting. Processing packets involves calling `__netif_receive_skb`, which then calls `ip_rcv`, and from there we go through `nft_synproxy_eval`, which *generates a new packet*. That packet then goes to `ip_local_out`, then to `loopback_xmit`, which...you guessed it, calls `enqueue_to_backlog`!
So, for every packet *dequeued* from `sd->input_pkt_queue`, one *more* packet is enqueued. That explains it! The queue length doesn't exceed `max_backlog` because it's a 1-in, 1-out situation. Therefore, the packet is NEVER dropped. That means the `process_backlog` *continues* to add packets, never dropping them, until its processing quota, usually 64 packets, is exhausted!
Wait, so there's a quota...that's important!
|
| 45/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/core/dev.c Name:process_backlog]
Results: map[SourceCode:6706: static int process_backlog(struct napi_struct *napi, int quota)
6707: {
6708: struct softnet_data *sd = container_of(napi, struct softnet_data, backlog);
6709: bool again = true;
6710: int work = 0;
6711:
6712: /* Check if we have pending ipi, its better to send them now,
6713: * not waiting net_rx_action() end.
6714: */
6715: if (sd_has_rps_ipi_waiting(sd)) {
6716: local_irq_disable();
6717: net_rps_action_and_irq_enable(sd);
6718: }
6719:
6720: napi->weight = READ_ONCE(net_hotdata.dev_rx_weight);
6721: while (again) {
6722: struct sk_buff *skb;
6723:
6724: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6725: while ((skb = __skb_dequeue(&sd->process_queue))) {
6726: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6727: rcu_read_lock();
6728: __netif_receive_skb(skb);
6729: rcu_read_unlock();
6730: if (++work >= quota) {
6731: rps_input_queue_head_add(sd, work);
6732: return work;
6733: }
6734:
6735: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6736: }
6737: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6738:
6739: backlog_lock_irq_disable(sd);
6740: if (skb_queue_empty(&sd->input_pkt_queue)) {
6741: /*
6742: * Inline a custom version of __napi_complete().
6743: * only current cpu owns and manipulates this napi,
6744: * and NAPI_STATE_SCHED is the only possible flag set
6745: * on backlog.
6746: * We can use a plain write instead of clear_bit(),
6747: * and we dont need an smp_mb() memory barrier.
6748: */
6749: napi->state &= NAPIF_STATE_THREADED;
6750: again = false;
6751: } else {
6752: local_lock_nested_bh(&softnet_data.process_queue_bh_lock);
6753: skb_queue_splice_tail_init(&sd->input_pkt_queue,
6754: &sd->process_queue);
6755: local_unlock_nested_bh(&softnet_data.process_queue_bh_lock);
6756: }
6757: backlog_unlock_irq_enable(sd);
6758: }
6759:
6760: if (work)
6761: rps_input_queue_head_add(sd, work);
6762: return work;
6763: }
SourceFile:net/core/dev.c]
|
| 46/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 47614
output: 39
thoughts: 404
Thoughts: **Analyzing the SoftIRQ Flow and Potential Re-entry**
Okay, let's break this down. My initial understanding is that if the work completed meets or exceeds the quota, we're done; the function returns the work done. `net_rx_action` is the entry point, calling `napi_poll` which then hits `process_backlog`. If `process_backlog` returns that the work *is* the quota, then NAPI stays on the poll list. The subsequent call to `net_rx_action` would therefore loop. But I need to be more precise about the looping behavior.
Ah, right, `net_rx_action` loops until either `time_limit` is reached or the `budget` is exhausted, I'm already aware of this. Looking at the code snippet, it looks like `net_rx_action` is designed to be limited, it bails out if the budget is zero or the time limit is passed, in this case, a soft interrupt will run for a maximum of 2 jiffies. This is expected. `handle_softirqs` then gets called, and it loops up to 10 times. So, worst case, that's 20 jiffies, or, as it stands at HZ=1000, 20ms. Fine. After that, it calls `wakeup_softirqd()` and returns.
Now, this is where it gets interesting, because the return of `handle_softirqs` should hand control back to the interrupted context, which in this particular scenario is `batadv_tt_purge`. But `batadv_tt_purge` calls `spin_unlock_bh`, and that in turn calls `__local_bh_enable_ip`, and `__local_bh_enable_ip` calls `do_softirq`. So, the return path is...not what I initially thought. `do_softirq` will potentially cause another softirq. That's what I need to investigate in `__local_bh_enable_ip`.
|
| 47/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/softirq.c Name:__local_bh_enable_ip]
Results: map[SourceCode: 450: void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
451: {
452: WARN_ON_ONCE(in_hardirq());
453: lockdep_assert_irqs_enabled();
454: #ifdef CONFIG_TRACE_IRQFLAGS
455: local_irq_disable();
456: #endif
457: /*
458: * Are softirqs going to be turned on now:
459: */
460: if (softirq_count() == SOFTIRQ_DISABLE_OFFSET)
461: lockdep_softirqs_on(ip);
462: /*
463: * Keep preemption disabled until we are done with
464: * softirq processing:
465: */
466: __preempt_count_sub(cnt - 1);
467:
468: if (unlikely(!in_interrupt() && local_softirq_pending())) {
469: /*
470: * Run softirq if any pending. And do it in its own stack
471: * as we may be calling this deep in a task call stack already.
472: */
473: do_softirq();
474: }
475:
476: preempt_count_dec();
477: #ifdef CONFIG_TRACE_IRQFLAGS
478: local_irq_enable();
479: #endif
480: preempt_check_resched();
481: }
SourceFile:kernel/softirq.c]
|
| 48/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 48978
output: 42
thoughts: 2628
Thoughts: **Analyzing a Softlockup in Network Packet Processing**
Okay, so I'm trying to figure out this softlockup, and the trace points me directly into the softirq processing. `__local_bh_enable_ip` calls `do_softirq()`, which is where things get interesting. I know `do_softirq()` processes softirqs and returns, and then `batadv_tt_purge` continues its work. But there's a softlockup, which means something's getting stuck. I have to trace this process down.
I see `do_softirq()` calls `__do_softirq()`, which has a loop. The loop has a limited number of iterations. If it doesn't return, it calls `wakeup_softirqd()`. But if `wakeup_softirqd()` wakes up `ksoftirqd`, that's a normal thread, and it could get scheduled. Importantly, `__local_bh_enable_ip` also calls `preempt_check_resched()`, so this thread could preempt the current `kworker` thread. That's a possibility, but there's a limit to the loops, so this wouldn't be an infinite loop or cause a softlockup in itself.
The softlockup's reported in `kworker/R-bat_e`. Something's blocking. I've got to follow the backtrace. `ipt_do_table` is there, along with `nf_hook`, `ip_local_out`, and the `synproxy` functions. So it seems packet processing is involved.
The backtrace shows `process_backlog`. `process_backlog` processes packets, and if `ip_local_out` sends a packet to the loopback interface, `loopback_xmit` will call `__netif_rx`. I immediately start wondering if we're hitting a loopback scenario. So it has to go to the backlog, which might cause an infinite loop in some scenarios, but the code has a loop limit. So that's not it.
If a packet's sent to a device, if it doesn't have a backlog, it may process it synchronously. It could also be sent to a bridge, or a veth. In the case of veth, that also queues it to the backlog. I need to understand if the backlog is being overwhelmed. So that loop's probably not the problem, either.
I re-examine the backtrace. Is there a loop in the firewall? That would mean a packet is sent to `ip_local_out`, is processed by iptables and then sent again. IPTables does have loop detection.
Now, I start considering devices that call `netif_receive_skb` directly from `ndo_start_xmit`. MACVLAN, IPVLAN, tunnels, VXLAN, that sort of thing. If a device calls `netif_receive_skb` directly from `ndo_start_xmit`, then `__netif_receive_skb` is re-entered. And that could create an infinite recursion.
But wait. The backtrace does *not* show that recursion. It only shows a single level of `__netif_receive_skb` calls.
So it isn't recursion. Now I consider a flood of packets, which is a DoS, which is a distinct issue. But the report specifies the workqueue worker is stuck for a long time. So it isn't simply packet processing.
Let's revisit `net_rx_action`. This yields after a very short time, and the worker is supposed to return to the workqueue. If that's the case, then this whole thing shouldn't be happening.
Ah. If `net_rx_action` yields, that returns to `handle_softirqs`. This has a loop, but after a fixed number of iterations, it should exit. So why doesn't it exit? And why doesn't it wake up the other thread and quit? Because after the loop it calls `wakeup_softirqd`. Then, the worker thread would finish and return from its work.
Wait, what if `handle_softirqs` *doesn't* return? It has a time check and it also checks to see if rescheduling is required. The loop has a limited number of executions. So it *should* return. So, what would be the issue? The `batadv_tt_purge` *itself* has a loop!
|
| 49/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/batman-adv/translation-table.c Name:batadv_tt_purge]
Results: map[SourceCode:3735: /**
3736: * batadv_tt_purge() - periodic worker to maintain the translation table
3737: * @work: delayed work embedded in the per-mesh-interface TT state
3738: *
3739: * Purge timed-out entries from the local and global TT, drop stale TT
3740: * requests and roaming clients, and reschedule the next run after
3741: * BATADV_TT_WORK_PERIOD milliseconds.
3742: */
3743: static void batadv_tt_purge(struct work_struct *work)
3744: {
3745: struct delayed_work *delayed_work;
3746: struct batadv_priv_tt *priv_tt;
3747: struct batadv_priv *bat_priv;
3748:
3749: delayed_work = to_delayed_work(work);
3750: priv_tt = container_of(delayed_work, struct batadv_priv_tt, work);
3751: bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3752:
3753: batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT);
3754: batadv_tt_global_purge(bat_priv);
3755: batadv_tt_req_purge(bat_priv);
3756: batadv_tt_roam_purge(bat_priv);
3757:
3758: queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3759: msecs_to_jiffies(BATADV_TT_WORK_PERIOD));
3760: }
SourceFile:net/batman-adv/translation-table.c]
|
| 50/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 53116
output: 44
thoughts: 18
Thoughts: Here's my take on those thoughts, tailored for an expert audience:
**Unpacking `batadv_tt_global_purge` and Spinlock Release**
Okay, so I'm looking at `batadv_tt_global_purge`, and it's calling `spin_unlock_bh`. That immediately tells me a few things. First, this function is likely involved in some sort of global cleanup or invalidation within the B.A.T.M.A.N. advanced (batadv) mesh routing protocol. The "global" aspect suggests it's impacting some shared data structure or cache, probably something critical to the overall network state.
The `spin_unlock_bh` call is the key piece, though. The `_bh` suffix screams "bottom half" protection, which means the spinlock that was likely acquired (presumably via `spin_lock_bh` or a related function within the larger code context) is protecting data structures used in interrupt context or deferrable bottom halves. That's immediately interesting because it indicates potential issues with race conditions if we aren't careful.
I need to quickly figure out which data structure is being protected by this lock and why. It's almost certain it's linked to the batadv's topology tables or neighbor discovery processes, based on the global nature of this purge. I'll need to trace back from this `spin_unlock_bh` call and see *what* exactly it is unlocking and *where* that lock was acquired. Understanding the critical section is essential here. Was this related to a potential deadlock? Memory corruption?
Knowing the specific data being accessed will give me more context. This is what I have to investigate. The potential for a race condition, corruption, or deadlock is high here, so this section of the code needs to be thoroughly vetted, and any side effects investigated. I'll need to go back and check how this function is integrated and why its called.
|
| 51/2 |
2026/09/12 00:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/batman-adv/translation-table.c Name:batadv_tt_global_purge]
Results: map[SourceCode:2348: /**
2349: * batadv_tt_global_purge() - purge expired global translation table entries
2350: * @bat_priv: the bat priv with all the mesh interface information
2351: *
2352: * Iterate over the global translation table and drop every entry that the
2353: * roaming or temporary timer has expired for.
2354: */
2355: static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
2356: {
2357: spinlock_t *list_lock; /* protects write access to the hash lists */
2358: struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2359: struct batadv_tt_common_entry *tt_common;
2360: struct batadv_tt_global_entry *tt_global;
2361: struct hlist_node *node_tmp;
2362: struct hlist_head *head;
2363: char *msg = NULL;
2364: u32 i;
2365:
2366: for (i = 0; i < hash->size; i++) {
2367: head = &hash->table[i];
2368: list_lock = &hash->list_locks[i];
2369:
2370: spin_lock_bh(list_lock);
2371: hlist_for_each_entry_safe(tt_common, node_tmp, head,
2372: hash_entry) {
2373: tt_global = container_of(tt_common,
2374: struct batadv_tt_global_entry,
2375: common);
2376:
2377: if (!batadv_tt_global_to_purge(tt_global, &msg))
2378: continue;
2379:
2380: batadv_dbg(BATADV_DBG_TT, bat_priv,
2381: "Deleting global tt entry %pM (vid: %d): %s\n",
2382: tt_global->common.addr,
2383: batadv_print_vid(tt_global->common.vid),
2384: msg);
2385:
2386: hlist_del_rcu(&tt_common->hash_entry);
2387:
2388: batadv_tt_global_entry_put(tt_global);
2389: }
2390: spin_unlock_bh(list_lock);
2391: }
2392: }
SourceFile:net/batman-adv/translation-table.c]
|
| 52/2 |
2026/09/12 00:55 |
llm |
expert |
0m
Model:
Tokens:
input: 54338
output: 43
thoughts: 1239
Thoughts: **Analyzing the Workqueue Lockup: The Infinite Packet Loop Culprit**
Okay, so I'm digging into this workqueue lockup, and it's starting to make sense. `batadv_tt_global_purge` has this loop over `hash->size`, and for each bucket, it uses `spin_lock_bh` and `spin_unlock_bh`. A large `hash->size` means a lot of `spin_unlock_bh` calls. Each `spin_unlock_bh` enables bottom halves, and if there are softirqs pending (like a full backlog of packets), they get processed for up to 2ms. Then it goes to the next bucket. With a constantly full backlog from an "infinite packet loop", *every* `spin_unlock_bh` spends 2ms on softirqs! With a hash size of 1024, that's potentially 2 seconds of softirq processing *just* within this one function!
But wait, there are also similar loops in `batadv_tt_local_purge`, `batadv_tt_req_purge`, and `batadv_tt_roam_purge`. And the larger the `hash->size`, or the more time `net_rx_action` takes, the worse it gets. Importantly, if the packet loop *is* infinite, the CPU is 99% in `net_rx_action` and 1% in the purge functions, meaning the purges become terribly slow. This means the workqueue watchdog will kick in because the work item runs for longer than 30 seconds. That would give the "BUG: workqueue lockup - pool cpus=1 node=0 flags=0x0 nice=0 stuck for 32s!" error.
So, the root cause is this "infinite packet loop" - it's keeping softirqs perpetually pending. Any code that calls `spin_unlock_bh` or `local_bh_enable` gets trapped processing packets. This causes major slowdowns, leading to workqueue lockups and RCU stalls. It's almost certainly the `nft_synproxy` rule that is the issue.
Let's confirm if `nft_synproxy` can really cause an infinite loop. It seems to. If `tcp->syn` is true, then `synproxy_send_client_synack` creates a SYN-ACK packet. This SYN-ACK has `tcp->syn` set, so it will match the `nft_synproxy` rule again, causing another SYN-ACK, creating an infinite loop.
But wait, does anything stop this? `nft_synproxy_do_eval` doesn't check conntrack state! Typically, `nft_synproxy` is used with `ct state new,untracked`. If I configured a rule like `nft add rule ip filter INPUT ct state new,untracked synproxy mss 1460`, the rule should *only* match if the conntrack state is NEW or UNTRACKED. Now, what's the conntrack state of a SYN-ACK? If it's a response to a SYN, it's ESTABLISHED or SYN_RECV. But the SYN-ACK is generated *by* `synproxy_send_client_synack`, which doesn't create a conntrack entry.
So, the SYN-ACK goes through PREROUTING, and conntrack sees it. If there's no existing connection, conntrack marks it as INVALID. The `ct state new,untracked` rule shouldn't match INVALID. However, if `nf_conntrack_tcp_loose` is enabled, and it usually is, the SYN-ACK might be incorrectly picked up as a NEW connection. Now I need to check how `nf_conntrack_tcp_loose` works with `SYN-ACK`. I need to look at `tcp_in_window` or `tcp_packet` in `nf_conntrack_proto_tcp.c`.
|
| 53/2 |
2026/09/12 00:56 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:net/netfilter/nf_conntrack_proto_tcp.c Name:tcp_packet]
Results: map[SourceCode: SourceFile:]
|
| 54/2 |
2026/09/12 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 56502
output: 49
thoughts: 15
Thoughts: Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:
**Analyzing `nf_conntrack_tcp_packet`**
Alright, time to get my hands dirty. I need to take a look at `nf_conntrack_tcp_packet`. Given my expertise, I'm already anticipating some of the nuances involved in the TCP connection tracking process. I'm thinking about the role this function plays within the Netfilter connection tracking framework. What specific aspects of a TCP packet is it examining? Is it focused on flags, sequence numbers, window sizes, or some combination thereof? I'm probably going to be mentally stepping through the function's code flow, considering how it handles various TCP states β ESTABLISHED, SYN_SENT, FIN_WAIT, and all the rest. I'll be looking for potential optimization opportunities or, more importantly, any signs of unexpected behavior or potential security vulnerabilities, edge cases that might be missed or exploited. The data structures it interacts with are going to be key as well; I'll need to understand the relationship between the packet data, the connection table entries, and any associated state machines. My goal is to grasp its exact behavior within the connection tracking machinery, identifying areas that are efficient, and areas where potential improvements could be made. Let's see what's what!
|
| 55/2 |
2026/09/12 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nf_conntrack_proto_tcp.c Name:nf_conntrack_tcp_packet]
Results: map[SourceCode:1000: /* Returns verdict for packet, or -1 for invalid. */
1001: int nf_conntrack_tcp_packet(struct nf_conn *ct,
1002: struct sk_buff *skb,
1003: unsigned int dataoff,
1004: enum ip_conntrack_info ctinfo,
1005: const struct nf_hook_state *state)
1006: {
1007: struct net *net = nf_ct_net(ct);
1008: struct nf_tcp_net *tn = nf_tcp_pernet(net);
1009: enum tcp_conntrack new_state, old_state;
1010: struct nf_tcp_invalid_log log = {};
1011: unsigned int index, *timeouts;
1012: bool lowered_timeout = false;
1013: enum nf_ct_tcp_action res;
1014: enum ip_conntrack_dir dir;
1015: const struct tcphdr *th;
1016: struct tcphdr _tcph;
1017: unsigned long timeout;
1018:
1019: th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph);
1020: if (th == NULL)
1021: return -NF_ACCEPT;
1022:
1023: if (tcp_error(th, skb, dataoff, state))
1024: return -NF_ACCEPT;
1025:
1026: if (!nf_ct_is_confirmed(ct) && !tcp_new(ct, skb, dataoff, th, state))
1027: return -NF_ACCEPT;
1028:
1029: spin_lock_bh(&ct->lock);
1030: old_state = ct->proto.tcp.state;
1031: dir = CTINFO2DIR(ctinfo);
1032: index = get_conntrack_index(th);
1033: new_state = tcp_conntracks[dir][index][old_state];
1034:
1035: switch (new_state) {
1036: case TCP_CONNTRACK_SYN_SENT:
1037: if (old_state < TCP_CONNTRACK_TIME_WAIT)
1038: break;
1039: /* RFC 1122: "When a connection is closed actively,
1040: * it MUST linger in TIME-WAIT state for a time 2xMSL
1041: * (Maximum Segment Lifetime). However, it MAY accept
1042: * a new SYN from the remote TCP to reopen the connection
1043: * directly from TIME-WAIT state, if..."
1044: * We ignore the conditions because we are in the
1045: * TIME-WAIT state anyway.
1046: *
1047: * Handle aborted connections: we and the server
1048: * think there is an existing connection but the client
1049: * aborts it and starts a new one.
1050: */
1051: if (((ct->proto.tcp.seen[dir].flags
1052: | ct->proto.tcp.seen[!dir].flags)
1053: & IP_CT_TCP_FLAG_CLOSE_INIT)
1054: || (ct->proto.tcp.last_dir == dir
1055: && ct->proto.tcp.last_index == TCP_RST_SET)) {
1056: /* Attempt to reopen a closed/aborted connection.
1057: * Delete this connection and look up again. */
1058: spin_unlock_bh(&ct->lock);
1059:
1060: /* Only repeat if we can actually remove the timer.
1061: * Destruction may already be in progress in process
1062: * context and we must give it a chance to terminate.
1063: */
1064: if (nf_ct_kill(ct))
1065: return -NF_REPEAT;
1066: return NF_DROP;
1067: }
1068: fallthrough;
1069: case TCP_CONNTRACK_IGNORE:
1070: /* Ignored packets:
1071: *
1072: * Our connection entry may be out of sync, so ignore
1073: * packets which may signal the real connection between
1074: * the client and the server.
1075: *
1076: * a) SYN in ORIGINAL
1077: * b) SYN/ACK in REPLY
1078: * c) ACK in reply direction after initial SYN in original.
1079: *
1080: * If the ignored packet is invalid, the receiver will send
1081: * a RST we'll catch below.
1082: */
1083: if (index == TCP_SYNACK_SET
1084: && ct->proto.tcp.last_index == TCP_SYN_SET
1085: && ct->proto.tcp.last_dir != dir
1086: && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {
1087: /* b) This SYN/ACK acknowledges a SYN that we earlier
1088: * ignored as invalid. This means that the client and
1089: * the server are both in sync, while the firewall is
1090: * not. We get in sync from the previously annotated
1091: * values.
1092: */
1093: old_state = TCP_CONNTRACK_SYN_SENT;
1094: new_state = TCP_CONNTRACK_SYN_RECV;
1095: ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_end =
1096: ct->proto.tcp.last_end;
1097: ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_maxend =
1098: ct->proto.tcp.last_end;
1099: ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_maxwin =
1100: ct->proto.tcp.last_win == 0 ?
1101: 1 : ct->proto.tcp.last_win;
1102: ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale =
1103: ct->proto.tcp.last_wscale;
1104: ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK;
1105: ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags =
1106: ct->proto.tcp.last_flags;
1107: nf_ct_tcp_state_reset(&ct->proto.tcp.seen[dir]);
1108: break;
1109: }
1110: ct->proto.tcp.last_index = index;
1111: ct->proto.tcp.last_dir = dir;
1112: ct->proto.tcp.last_seq = ntohl(th->seq);
1113: ct->proto.tcp.last_end =
1114: segment_seq_plus_len(ntohl(th->seq), skb->len, dataoff, th);
1115: ct->proto.tcp.last_win = ntohs(th->window);
1116:
1117: /* a) This is a SYN in ORIGINAL. The client and the server
1118: * may be in sync but we are not. In that case, we annotate
1119: * the TCP options and let the packet go through. If it is a
1120: * valid SYN packet, the server will reply with a SYN/ACK, and
1121: * then we'll get in sync. Otherwise, the server potentially
1122: * responds with a challenge ACK if implementing RFC5961.
1123: */
1124: if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) {
1125: struct ip_ct_tcp_state seen = {};
1126:
1127: ct->proto.tcp.last_flags =
1128: ct->proto.tcp.last_wscale = 0;
1129: tcp_options(skb, dataoff, th, &seen);
1130: if (seen.flags & IP_CT_TCP_FLAG_WINDOW_SCALE) {
1131: ct->proto.tcp.last_flags |=
1132: IP_CT_TCP_FLAG_WINDOW_SCALE;
1133: ct->proto.tcp.last_wscale = seen.td_scale;
1134: }
1135: if (seen.flags & IP_CT_TCP_FLAG_SACK_PERM) {
1136: ct->proto.tcp.last_flags |=
1137: IP_CT_TCP_FLAG_SACK_PERM;
1138: }
1139: /* Mark the potential for RFC5961 challenge ACK,
1140: * this pose a special problem for LAST_ACK state
1141: * as ACK is interpreted as ACKing last FIN.
1142: */
1143: if (old_state == TCP_CONNTRACK_LAST_ACK)
1144: ct->proto.tcp.last_flags |=
1145: IP_CT_EXP_CHALLENGE_ACK;
1146: }
1147:
1148: /* possible challenge ack reply to syn */
1149: if (old_state == TCP_CONNTRACK_SYN_SENT &&
1150: index == TCP_ACK_SET &&
1151: dir == IP_CT_DIR_REPLY)
1152: ct->proto.tcp.last_ack = ntohl(th->ack_seq);
1153:
1154: spin_unlock_bh(&ct->lock);
1155: nf_ct_l4proto_log_invalid(skb, ct, state,
1156: "packet (index %d) in dir %d ignored, state %s",
1157: index, dir,
1158: tcp_conntrack_names[old_state]);
1159: return NF_ACCEPT;
1160: case TCP_CONNTRACK_MAX:
1161: /* Special case for SYN proxy: when the SYN to the server or
1162: * the SYN/ACK from the server is lost, the client may transmit
1163: * a keep-alive packet while in SYN_SENT state. This needs to
1164: * be associated with the original conntrack entry in order to
1165: * generate a new SYN with the correct sequence number.
1166: */
1167: if (nfct_synproxy(ct) && old_state == TCP_CONNTRACK_SYN_SENT &&
1168: index == TCP_ACK_SET && dir == IP_CT_DIR_ORIGINAL &&
1169: ct->proto.tcp.last_dir == IP_CT_DIR_ORIGINAL &&
1170: ct->proto.tcp.seen[dir].td_end - 1 == ntohl(th->seq)) {
1171: pr_debug("nf_ct_tcp: SYN proxy client keep alive\n");
1172: spin_unlock_bh(&ct->lock);
1173: return NF_ACCEPT;
1174: }
1175:
1176: /* Invalid packet */
1177: spin_unlock_bh(&ct->lock);
1178: nf_ct_l4proto_log_invalid(skb, ct, state,
1179: "packet (index %d) in dir %d invalid, state %s",
1180: index, dir,
1181: tcp_conntrack_names[old_state]);
1182: return -NF_ACCEPT;
1183: case TCP_CONNTRACK_TIME_WAIT:
1184: /* RFC5961 compliance cause stack to send "challenge-ACK"
1185: * e.g. in response to spurious SYNs. Conntrack MUST
1186: * not believe this ACK is acking last FIN.
1187: */
1188: if (old_state == TCP_CONNTRACK_LAST_ACK &&
1189: index == TCP_ACK_SET &&
1190: ct->proto.tcp.last_dir != dir &&
1191: ct->proto.tcp.last_index == TCP_SYN_SET &&
1192: (ct->proto.tcp.last_flags & IP_CT_EXP_CHALLENGE_ACK)) {
1193: /* Detected RFC5961 challenge ACK */
1194: ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK;
1195: spin_unlock_bh(&ct->lock);
1196: nf_ct_l4proto_log_invalid(skb, ct, state, "challenge-ack ignored");
1197: return NF_ACCEPT; /* Don't change state */
1198: }
1199: break;
1200: case TCP_CONNTRACK_SYN_SENT2:
1201: /* tcp_conntracks table is not smart enough to handle
1202: * simultaneous open.
1203: */
1204: ct->proto.tcp.last_flags |= IP_CT_TCP_SIMULTANEOUS_OPEN;
1205: break;
1206: case TCP_CONNTRACK_SYN_RECV:
1207: if (dir == IP_CT_DIR_REPLY && index == TCP_ACK_SET &&
1208: ct->proto.tcp.last_flags & IP_CT_TCP_SIMULTANEOUS_OPEN)
1209: new_state = TCP_CONNTRACK_ESTABLISHED;
1210: break;
1211: case TCP_CONNTRACK_CLOSE:
1212: if (index != TCP_RST_SET)
1213: break;
1214:
1215: /* If we are closing, tuple might have been re-used already.
1216: * last_index, last_ack, and all other ct fields used for
1217: * sequence/window validation are outdated in that case.
1218: *
1219: * As the conntrack can already be expired by GC under pressure,
1220: * just skip validation checks.
1221: */
1222: if (tcp_can_early_drop(ct))
1223: goto in_window;
1224:
1225: /* td_maxack might be outdated if we let a SYN through earlier */
1226: if ((ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) &&
1227: ct->proto.tcp.last_index != TCP_SYN_SET) {
1228: u32 seq = ntohl(th->seq);
1229:
1230: /* If we are not in established state and SEQ=0 this is most
1231: * likely an answer to a SYN we let go through above (last_index
1232: * can be updated due to out-of-order ACKs).
1233: */
1234: if (seq == 0 && !nf_conntrack_tcp_established(ct))
1235: break;
1236:
1237: if (before(seq, ct->proto.tcp.seen[!dir].td_maxack) &&
1238: !tn->tcp_ignore_invalid_rst) {
1239: /* Invalid RST */
1240: spin_unlock_bh(&ct->lock);
1241: nf_ct_l4proto_log_invalid(skb, ct, state, "invalid rst");
1242: return -NF_ACCEPT;
1243: }
1244:
1245: if (!nf_conntrack_tcp_established(ct) ||
1246: seq == ct->proto.tcp.seen[!dir].td_maxack)
1247: break;
1248:
1249: /* Check if rst is part of train, such as
1250: * foo:80 > bar:4379: P, 235946583:235946602(19) ack 42
1251: * foo:80 > bar:4379: R, 235946602:235946602(0) ack 42
1252: */
1253: if (ct->proto.tcp.last_index == TCP_ACK_SET &&
1254: ct->proto.tcp.last_dir == dir &&
1255: seq == ct->proto.tcp.last_end)
1256: break;
1257:
1258: /* ... RST sequence number doesn't match exactly, keep
1259: * established state to allow a possible challenge ACK.
1260: */
1261: new_state = old_state;
1262: }
1263: if (((test_bit(IPS_SEEN_REPLY_BIT, &ct->status)
1264: && ct->proto.tcp.last_index == TCP_SYN_SET
1265: && ct->proto.tcp.last_dir != dir)
1266: || (!test_bit(IPS_ASSURED_BIT, &ct->status)
1267: && ct->proto.tcp.last_index == TCP_ACK_SET))
1268: && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {
1269: /* RST sent to invalid SYN or ACK we had let through
1270: * at a) and c) above:
1271: *
1272: * a) SYN was in window then
1273: * c) we hold a half-open connection.
1274: *
1275: * Delete our connection entry.
1276: * We skip window checking, because packet might ACK
1277: * segments we ignored. */
1278: goto in_window;
1279: }
1280:
1281: /* Reset in response to a challenge-ack we let through earlier */
1282: if (old_state == TCP_CONNTRACK_SYN_SENT &&
1283: ct->proto.tcp.last_index == TCP_ACK_SET &&
1284: ct->proto.tcp.last_dir == IP_CT_DIR_REPLY &&
1285: ntohl(th->seq) == ct->proto.tcp.last_ack)
1286: goto in_window;
1287:
1288: break;
1289: default:
1290: /* Keep compilers happy. */
1291: break;
1292: }
1293:
1294: res = tcp_in_window(ct, dir, index,
1295: skb, dataoff, th, &log);
1296: switch (res) {
1297: case NFCT_TCP_IGNORE:
1298: spin_unlock_bh(&ct->lock);
1299: nf_tcp_log_invalid(skb, ct, state, &log);
1300: return NF_ACCEPT;
1301: case NFCT_TCP_INVALID:
1302: lowered_timeout = nf_tcp_handle_invalid(ct, dir, index);
1303: spin_unlock_bh(&ct->lock);
1304: nf_tcp_log_invalid(skb, ct, state, &log);
1305: if (lowered_timeout)
1306: nf_ct_l4proto_log_invalid(skb, ct, state, "lowered timeout to UNACK");
1307: return -NF_ACCEPT;
1308: case NFCT_TCP_ACCEPT:
1309: break;
1310: }
1311: in_window:
1312: /* From now on we have got in-window packets */
1313: ct->proto.tcp.last_index = index;
1314: ct->proto.tcp.last_dir = dir;
1315:
1316: ct->proto.tcp.state = new_state;
1317: if (old_state != new_state
1318: && new_state == TCP_CONNTRACK_FIN_WAIT)
1319: ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
1320:
1321: timeouts = nf_ct_timeout_lookup(ct);
1322: if (!timeouts)
1323: timeouts = tn->timeouts;
1324:
1325: if (ct->proto.tcp.retrans >= tn->tcp_max_retrans &&
1326: timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
1327: timeout = timeouts[TCP_CONNTRACK_RETRANS];
1328: else if (unlikely(index == TCP_RST_SET &&
1329: new_state == TCP_CONNTRACK_ESTABLISHED) &&
1330: timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK])
1331: timeout = timeouts[TCP_CONNTRACK_UNACK];
1332: else if ((ct->proto.tcp.seen[0].flags | ct->proto.tcp.seen[1].flags) &
1333: IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED &&
1334: timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK])
1335: timeout = timeouts[TCP_CONNTRACK_UNACK];
1336: else if (ct->proto.tcp.last_win == 0 &&
1337: timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
1338: timeout = timeouts[TCP_CONNTRACK_RETRANS];
1339: else
1340: timeout = timeouts[new_state];
1341: spin_unlock_bh(&ct->lock);
1342:
1343: if (new_state != old_state)
1344: nf_conntrack_event_cache(IPCT_PROTOINFO, ct);
1345:
1346: if (!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
1347: /* If only reply is a RST, we can consider ourselves not to
1348: have an established connection: this is a fairly common
1349: problem case, so we can delete the conntrack
1350: immediately. --RR */
1351: if (th->rst) {
1352: nf_ct_kill_acct(ct, ctinfo, skb);
1353: return NF_ACCEPT;
1354: }
1355:
1356: if (index == TCP_SYN_SET && old_state == TCP_CONNTRACK_SYN_SENT) {
1357: /* do not renew timeout on SYN retransmit.
1358: *
1359: * Else port reuse by client or NAT middlebox can keep
1360: * entry alive indefinitely (including nat info).
1361: */
1362: return NF_ACCEPT;
1363: }
1364:
1365: /* ESTABLISHED without SEEN_REPLY, i.e. mid-connection
1366: * pickup with loose=1. Avoid large ESTABLISHED timeout.
1367: */
1368: if (new_state == TCP_CONNTRACK_ESTABLISHED &&
1369: timeout > timeouts[TCP_CONNTRACK_UNACK])
1370: timeout = timeouts[TCP_CONNTRACK_UNACK];
1371: } else if (!test_bit(IPS_ASSURED_BIT, &ct->status)
1372: && (old_state == TCP_CONNTRACK_SYN_RECV
1373: || old_state == TCP_CONNTRACK_ESTABLISHED)
1374: && new_state == TCP_CONNTRACK_ESTABLISHED) {
1375: /* Set ASSURED if we see valid ack in ESTABLISHED
1376: after SYN_RECV or a valid answer for a picked up
1377: connection. */
1378: set_bit(IPS_ASSURED_BIT, &ct->status);
1379: nf_conntrack_event_cache(IPCT_ASSURED, ct);
1380: }
1381: nf_ct_refresh_acct(ct, ctinfo, skb, timeout);
1382:
1383: return NF_ACCEPT;
1384: }
SourceFile:net/netfilter/nf_conntrack_proto_tcp.c]
|
| 56/2 |
2026/09/12 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 63655
output: 43
thoughts: 21
Thoughts: Here's my understanding of the situation, tailored for an expert audience:
**Analyzing the TCP Connection Initiation**
Okay, so I'm looking at how TCP handles a connection attempt. I'm focusing on that critical handshake stage, specifically the arrival of a SYN-ACK packet. I know that if I receive that SYN-ACK, but there's no corresponding connection state already established, the system kicks off a new connection process. It calls the `tcp_new` function. This function has to handle the scenario where a new connection is being formed from scratch. It's the entry point to initiate a new TCP connection on the receiving end. My mind races to consider everything that `tcp_new` must do in that context to manage memory allocation, state initialization, and handle the sequence numbers within the SYN-ACK to get that connection established. I need to handle potential RST's at any point, so this needs to be baked in from the get-go.
|
| 57/2 |
2026/09/12 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nf_conntrack_proto_tcp.c Name:tcp_new]
Results: map[SourceCode: 876: static noinline bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,
877: unsigned int dataoff,
878: const struct tcphdr *th,
879: const struct nf_hook_state *state)
880: {
881: enum tcp_conntrack new_state;
882: struct net *net = nf_ct_net(ct);
883: const struct nf_tcp_net *tn = nf_tcp_pernet(net);
884:
885: /* Don't need lock here: this conntrack not in circulation yet */
886: new_state = tcp_conntracks[0][get_conntrack_index(th)][TCP_CONNTRACK_NONE];
887:
888: /* Invalid: delete conntrack */
889: if (new_state >= TCP_CONNTRACK_MAX) {
890: tcp_error_log(skb, state, "invalid new");
891: return false;
892: }
893:
894: if (new_state == TCP_CONNTRACK_SYN_SENT) {
895: memset(&ct->proto.tcp, 0, sizeof(ct->proto.tcp));
896: /* SYN packet */
897: ct->proto.tcp.seen[0].td_end =
898: segment_seq_plus_len(ntohl(th->seq), skb->len,
899: dataoff, th);
900: ct->proto.tcp.seen[0].td_maxwin = ntohs(th->window);
901: if (ct->proto.tcp.seen[0].td_maxwin == 0)
902: ct->proto.tcp.seen[0].td_maxwin = 1;
903: ct->proto.tcp.seen[0].td_maxend =
904: ct->proto.tcp.seen[0].td_end;
905:
906: tcp_options(skb, dataoff, th, &ct->proto.tcp.seen[0]);
907: } else if (tn->tcp_loose == 0) {
908: /* Don't try to pick up connections. */
909: return false;
910: } else {
911: memset(&ct->proto.tcp, 0, sizeof(ct->proto.tcp));
912: /*
913: * We are in the middle of a connection,
914: * its history is lost for us.
915: * Let's try to use the data from the packet.
916: */
917: ct->proto.tcp.seen[0].td_end =
918: segment_seq_plus_len(ntohl(th->seq), skb->len,
919: dataoff, th);
920: ct->proto.tcp.seen[0].td_maxwin = ntohs(th->window);
921: if (ct->proto.tcp.seen[0].td_maxwin == 0)
922: ct->proto.tcp.seen[0].td_maxwin = 1;
923: ct->proto.tcp.seen[0].td_maxend =
924: ct->proto.tcp.seen[0].td_end +
925: ct->proto.tcp.seen[0].td_maxwin;
926:
927: /* We assume SACK and liberal window checking to handle
928: * window scaling */
929: ct->proto.tcp.seen[0].flags =
930: ct->proto.tcp.seen[1].flags = IP_CT_TCP_FLAG_SACK_PERM |
931: IP_CT_TCP_FLAG_BE_LIBERAL;
932: }
933:
934: /* tcp_packet will set them */
935: ct->proto.tcp.last_index = TCP_NONE_SET;
936: return true;
937: }
SourceFile:net/netfilter/nf_conntrack_proto_tcp.c]
|
| 58/2 |
2026/09/12 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 65087
output: 46
thoughts: 70
Thoughts: **Analyzing TCP Connection Tracking**
Okay, so I'm looking at how we're handling a SYN-ACK packet, specifically within the connection tracking mechanism. The core of this seems to be the `tcp_conntracks` table, and I'm accessing it using an index calculated via `get_conntrack_index(th)`. Based on the context, and what I'm familiar with, I anticipate that when dealing with a SYN-ACK packet, `get_conntrack_index(th)` should return `TCP_SYNACK_SET`. The next logical step is to dive into the `tcp_conntracks` table itself at that calculated index and see what data it holds. This will be where the core connection state information for this particular flow should reside. I need to understand what's in that entry.
|
| 59/2 |
2026/09/12 00:56 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netfilter/nf_conntrack_proto_tcp.c Name:tcp_conntracks]
Results: map[SourceCode: 101: /*
102: * The TCP state transition table needs a few words...
103: *
104: * We are the man in the middle. All the packets go through us
105: * but might get lost in transit to the destination.
106: * It is assumed that the destinations can't receive segments
107: * we haven't seen.
108: *
109: * The checked segment is in window, but our windows are *not*
110: * equivalent with the ones of the sender/receiver. We always
111: * try to guess the state of the current sender.
112: *
113: * The meaning of the states are:
114: *
115: * NONE: initial state
116: * SYN_SENT: SYN-only packet seen
117: * SYN_SENT2: SYN-only packet seen from reply dir, simultaneous open
118: * SYN_RECV: SYN-ACK packet seen
119: * ESTABLISHED: ACK packet seen
120: * FIN_WAIT: FIN packet seen
121: * CLOSE_WAIT: ACK seen (after FIN)
122: * LAST_ACK: FIN seen (after FIN)
123: * TIME_WAIT: last ACK seen
124: * CLOSE: closed connection (RST)
125: *
126: * Packets marked as IGNORED (sIG):
127: * if they may be either invalid or valid
128: * and the receiver may send back a connection
129: * closing RST or a SYN/ACK.
130: *
131: * Packets marked as INVALID (sIV):
132: * if we regard them as truly invalid packets
133: */
134: static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = {
135: {
136: /* ORIGINAL */
137: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
138: /*syn*/ { sSS, sSS, sIG, sIG, sIG, sIG, sIG, sSS, sSS, sS2 },
139: /*
140: * sNO -> sSS Initialize a new connection
141: * sSS -> sSS Retransmitted SYN
142: * sS2 -> sS2 Late retransmitted SYN
143: * sSR -> sIG
144: * sES -> sIG Error: SYNs in window outside the SYN_SENT state
145: * are errors. Receiver will reply with RST
146: * and close the connection.
147: * Or we are not in sync and hold a dead connection.
148: * sFW -> sIG
149: * sCW -> sIG
150: * sLA -> sIG
151: * sTW -> sSS Reopened connection (RFC 1122).
152: * sCL -> sSS
153: */
154: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
155: /*synack*/ { sIV, sIV, sSR, sIV, sIV, sIV, sIV, sIV, sIV, sSR },
156: /*
157: * sNO -> sIV Too late and no reason to do anything
158: * sSS -> sIV Client can't send SYN and then SYN/ACK
159: * sS2 -> sSR SYN/ACK sent to SYN2 in simultaneous open
160: * sSR -> sSR Late retransmitted SYN/ACK in simultaneous open
161: * sES -> sIV Invalid SYN/ACK packets sent by the client
162: * sFW -> sIV
163: * sCW -> sIV
164: * sLA -> sIV
165: * sTW -> sIV
166: * sCL -> sIV
167: */
168: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
169: /*fin*/ { sIV, sIV, sFW, sFW, sLA, sLA, sLA, sTW, sCL, sIV },
170: /*
171: * sNO -> sIV Too late and no reason to do anything...
172: * sSS -> sIV Client might not send FIN in this state:
173: * we enforce waiting for a SYN/ACK reply first.
174: * sS2 -> sIV
175: * sSR -> sFW Close started.
176: * sES -> sFW
177: * sFW -> sLA FIN seen in both directions, waiting for
178: * the last ACK.
179: * Might be a retransmitted FIN as well...
180: * sCW -> sLA
181: * sLA -> sLA Retransmitted FIN. Remain in the same state.
182: * sTW -> sTW
183: * sCL -> sCL
184: */
185: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
186: /*ack*/ { sES, sIV, sES, sES, sCW, sCW, sTW, sTW, sCL, sIV },
187: /*
188: * sNO -> sES Assumed.
189: * sSS -> sIV ACK is invalid: we haven't seen a SYN/ACK yet.
190: * sS2 -> sIV
191: * sSR -> sES Established state is reached.
192: * sES -> sES :-)
193: * sFW -> sCW Normal close request answered by ACK.
194: * sCW -> sCW
195: * sLA -> sTW Last ACK detected (RFC5961 challenged)
196: * sTW -> sTW Retransmitted last ACK. Remain in the same state.
197: * sCL -> sCL
198: */
199: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
200: /*rst*/ { sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL },
201: /*none*/ { sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV }
202: },
203: {
204: /* REPLY */
205: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
206: /*syn*/ { sIV, sS2, sIV, sIV, sIV, sIV, sIV, sSS, sIV, sS2 },
207: /*
208: * sNO -> sIV Never reached.
209: * sSS -> sS2 Simultaneous open
210: * sS2 -> sS2 Retransmitted simultaneous SYN
211: * sSR -> sIV Invalid SYN packets sent by the server
212: * sES -> sIV
213: * sFW -> sIV
214: * sCW -> sIV
215: * sLA -> sIV
216: * sTW -> sSS Reopened connection, but server may have switched role
217: * sCL -> sIV
218: */
219: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
220: /*synack*/ { sIV, sSR, sIG, sIG, sIG, sIG, sIG, sIG, sIG, sSR },
221: /*
222: * sSS -> sSR Standard open.
223: * sS2 -> sSR Simultaneous open
224: * sSR -> sIG Retransmitted SYN/ACK, ignore it.
225: * sES -> sIG Late retransmitted SYN/ACK?
226: * sFW -> sIG Might be SYN/ACK answering ignored SYN
227: * sCW -> sIG
228: * sLA -> sIG
229: * sTW -> sIG
230: * sCL -> sIG
231: */
232: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
233: /*fin*/ { sIV, sIV, sFW, sFW, sLA, sLA, sLA, sTW, sCL, sIV },
234: /*
235: * sSS -> sIV Server might not send FIN in this state.
236: * sS2 -> sIV
237: * sSR -> sFW Close started.
238: * sES -> sFW
239: * sFW -> sLA FIN seen in both directions.
240: * sCW -> sLA
241: * sLA -> sLA Retransmitted FIN.
242: * sTW -> sTW
243: * sCL -> sCL
244: */
245: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
246: /*ack*/ { sIV, sIG, sSR, sES, sCW, sCW, sTW, sTW, sCL, sIG },
247: /*
248: * sSS -> sIG Might be a half-open connection.
249: * sS2 -> sIG
250: * sSR -> sSR Might answer late resent SYN.
251: * sES -> sES :-)
252: * sFW -> sCW Normal close request answered by ACK.
253: * sCW -> sCW
254: * sLA -> sTW Last ACK detected (RFC5961 challenged)
255: * sTW -> sTW Retransmitted last ACK.
256: * sCL -> sCL
257: */
258: /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */
259: /*rst*/ { sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL },
260: /*none*/ { sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sIV }
261: }
262: };
SourceFile:net/netfilter/nf_conntrack_proto_tcp.c]
|
| 60/2 |
2026/09/12 00:56 |
llm |
expert |
0m
Model:
Tokens:
input: 68622
output: 66
thoughts: 3635
Thoughts: **Analysis of a Denial-of-Service Vulnerability in `nft_synproxy`**
Okay, here's the breakdown of my thinking: I've identified a critical flaw in the `nft_synproxy` module of the Linux kernel's `nftables` framework. It stems from a logical error where a misconfigured rule can lead to an infinite loop, ultimately causing a softlockup and a denial-of-service (DoS) condition.
Initially, I realized that if a SYN-ACK packet, which is considered invalid, triggers the `tcp_new` function to return false. However, even though the connection tracking flags this as INVALID, it can still trigger an issue in `nft_synproxy`. The root cause lies in the fact that `nft_synproxy_eval_v4` doesn't adequately filter packets based on TCP flags. It simply checks for the SYN flag being set and generates SYN-ACK packets. This is problematic if a user sets a rule like `nft add rule ip filter INPUT tcp flags syn synproxy mss 1460`. Even the more specific `tcp flags syn` is vulnerable! This matches any packet with SYN, even the SYN-ACK, which should be filtered. If the user doesn't specify `ct state new,untracked`, the SYN-ACK packet will trigger a loop as the `nft_synproxy` generates responses and reprocesses these in an infinite loop. This misconfiguration leads to the kernel generating packets endlessly, consuming CPU resources and resulting in a softlockup.
This vulnerability can be triggered locally and remotely depending on the configuration. An unprivileged user can create a user namespace and network namespace to add the vulnerable rule. They can then trigger the loop by sending a SYN packet to a loopback address. This is a surefire way to trigger the DoS. Remotely, the attack is trickier. It relies on a vulnerable system with a similar misconfigured rule, and the attacker would need to spoof the victim's IP address and potentially bypass anti-spoofing measures (like rp_filter) and martian checks. This is the only way it can be triggered over a network. The attack can be triggered on the INPUT chain. However, if an attacker could put the rule on the OUTPUT chain of the target, this could be easier.
I verified that this is purely a logic bug. There is no memory corruption or use-after-free. It's an infinite loop in packet generation and processing. The fix is straightforward: the kernel code should include an explicit check, ensuring that SYN-ACK, FIN, or RST packets are filtered out. This is a crucial defense, and should have been in the original code.
The vulnerability is a DoS, which is accessible from a user namespace with `CAP_NET_ADMIN`. It is not accessible from unprivileged processes, assuming user namespaces are not accessible. It can be triggered by network traffic given that the configuration is right and that the network packet can be directed to the vulnerable system. This will not escalate privileges or leak any information. The vulnerability can be exploited by an unprivileged user within a network namespace.
|
| 61/2 |
2026/09/12 00:57 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:false NetworkTrigger:true PeripheralTrigger:false RemoteTrigger:false Unprivileged:false UserNamespace:true VMGuestTrigger:false VMHostTrigger:false]
|
| 62/2 |
2026/09/12 00:57 |
llm |
expert |
0m
Model:
Tokens:
input: 73048
output: 711
thoughts: 461
Thoughts: **My Final Reasoning on the Synproxy Bug**
Alright, the analysis is complete, and here's the breakdown of what's happening. The core issue lies within the `nft_synproxy` module, specifically a vulnerability that results in an infinite packet loop. This manifests within the `nft_synproxy_eval_v4()` and `nft_synproxy_eval_v6()` functions.
The fundamental problem is a faulty check for SYN packets. The code simply uses `if (tcp->syn)` to identify SYN packets. However, this is incomplete. It fails to account for the ACK, FIN, or RST flags also being set, unlike the equivalent iptables implementation, which correctly checks `th->syn && !(th->ack || th->fin || th->rst)`.
The consequence of this oversight is that SYN-ACK packets are also erroneously identified as SYN packets. When a packet matches this flawed criteria, `synproxy_send_client_synack()` is invoked, generating a SYN-ACK response with swapped source and destination addresses.
Now, hereβs where the loop occurs. If an attacker β or even a local, unprivileged user β sends a SYN packet with both source and destination addresses being local (like 127.0.0.1, the loopback interface), the generated SYN-ACK packet is routed back to the loopback. This newly generated SYN-ACK, thanks to the same flawed check, is incorrectly identified as a SYN packet. This then triggers another SYN-ACK response, and the cycle continues infinitely.
The network stack processes these packets within the softirq context (`net_rx_action`), and this constant processing consumes 100% of the CPU, starving other tasks and leading to a softlockup β essentially, a Denial of Service.
This can be easily triggered by an unprivileged user by simply setting up a new network namespace, adding an `nft_synproxy` rule, and sending a single SYN packet to the loopback. Theoretically, it *could* be exploited remotely if an attacker can spoof packets with a local source address that bypasses anti-spoofing filters, like `rp_filter`, though that's a more nuanced attack.
Fortunately, the scope is limited to DoS. The bug does not lead to any memory corruption or privilege escalation, so the impact is constrained, but still significant.
|
| 63/1 |
2026/09/12 00:57 |
action |
format-explanation |
0m
Results: map[Explanation:**Analysis of the Bug**
The bug report indicates a softlockup (Denial of Service) occurring in the
network stack's softirq processing (`net_rx_action` -> `process_backlog`),
specifically while evaluating an nftables `synproxy` rule
(`nft_synproxy_eval_v4`).
**Root Cause:**
The vulnerability is a logic error in the `nft_synproxy` module that leads to an
infinite packet loop.
In `net/netfilter/nft_synproxy.c`, the functions `nft_synproxy_eval_v4()` and
`nft_synproxy_eval_v6()` check if an incoming packet is a SYN packet using a
simple `if (tcp->syn)` condition. However, it fails to verify that the ACK, FIN,
or RST flags are *not* set. (For comparison, the equivalent iptables
implementation in `ipt_SYNPROXY.c` correctly checks `if (th->syn && !(th->ack ||
th->fin || th->rst))`).
Because of this missing check, a SYN-ACK packet will also evaluate to true for
`tcp->syn`.
When the condition is met, the code calls `synproxy_send_client_synack()`, which
generates a SYN-ACK response packet by swapping the original source and
destination IP addresses.
If a packet is injected where both the source and destination addresses are
local to the machine (e.g., `127.0.0.1`), the generated SYN-ACK packet will be
routed back to the local loopback interface. When this generated SYN-ACK packet
is received, it is processed by the same `nft_synproxy` rule. Since its SYN flag
is set, it matches the flawed `if (tcp->syn)` condition again, causing the
kernel to generate *another* SYN-ACK packet.
This creates an infinite loop of SYN-ACK packets being generated, transmitted to
loopback, and received. The kernel gets trapped processing this endless backlog
of packets in the softirq context, consuming 100% of the CPU core and triggering
the workqueue/RCU softlockup warnings seen in the crash report.
**Security Impact:**
* **Exploitable:** No. The bug does not cause memory corruption (the old `skb`
is properly consumed and a new one is safely allocated), information leaks, or
privilege escalation. It is purely a logic bug.
* **Denial of Service:** Yes. The infinite loop in the softirq context starves
the CPU, hanging the system or triggering a kernel panic if `softlockup_panic`
is enabled.
* **Accessible From User Namespaces:** Yes. An unprivileged user can trivially
trigger this DoS by creating a new user namespace and network namespace (where
they hold `CAP_NET_ADMIN`), configuring a basic `nft_synproxy` rule, and sending
a single SYN packet to `127.0.0.1`.
* **Network Trigger:** Yes. While primarily a local DoS vector via namespaces,
it can theoretically be triggered remotely if a host has a poorly scoped
`nft_synproxy` rule and an attacker can send a spoofed SYN packet (where both
the source and destination IPs belong to the victim). This relies on the network
lacking strict anti-spoofing protections (like `rp_filter`).]
|