| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/04 23:18 | flow | patch-triage |
17mArgs:null Results: {
"EnableConfigs": [
"INET",
"IPV6",
"MPTCP",
"MPTCP_IPV6"
],
"FocusSymbols": [
"tcp_v6_disconnect",
"tcp_v6_restore_af_ops",
"tcp_v6_connect",
"tcp_v4_do_rcv",
"__mptcp_subflow_disconnect",
"mptcp_subflow_shutdown",
"mptcp_close_ssk"
],
"KMSANReasoning": "The patch addresses a protocol confusion issue where IPv6 sockets connected to IPv4-mapped addresses retained IPv4 operations (such as sk_backlog_rcv = tcp_v4_do_rcv and IPv4 icsk_af_ops) after disconnect. It introduces tcp_v6_restore_af_ops() to reset these handlers back to IPv6 during tcp_v6_disconnect(), updates MPTCP to call the polymorphic ssk-\u003esk_prot-\u003edisconnect(), and adds an skb-\u003eprotocol sanity check in tcp_v4_do_rcv().\n\nNo memory allocations are introduced or altered on the stack or heap, no data is copied to user space, and no branching depends on uninitialized data. Any protocol confusion bugs or improper packet handling leading to out-of-bounds reads or invalid state transitions are covered by KASAN and kernel assertions. Therefore, this patch poses no uninitialized memory or info-leak risks, and a dedicated KMSAN fuzzing session is not needed.",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies core TCP IPv4, IPv6, and MPTCP networking code. Specifically, it introduces tcp_v6_disconnect to properly restore IPv6 af_ops and backlog handler when disconnecting IPv4-mapped IPv6 sockets, checks for invalid protocol packets in tcp_v4_do_rcv, and updates MPTCP subflow disconnect/shutdown logic to invoke protocol-specific disconnect callbacks instead of hardcoded tcp_disconnect. This reachable code path can be exercised via socket API calls (connect, disconnect, listen, and MPTCP subflow management) and warrants fuzzing.",
"WorthFuzzing": true
} |
| 1/1 | 2026/11/04 23:18 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit efa149f8ce29656fc2a4dcf0d119efed7642880f\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Nov 4 23:18:01 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c\nindex a7f9242f1e4290..8fa6564d2b6029 100644\n--- a/net/ipv4/tcp_ipv4.c\n+++ b/net/ipv4/tcp_ipv4.c\n@@ -1836,6 +1836,11 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)\n {\n \tenum skb_drop_reason reason;\n \n+\tif (unlikely(skb-\u003eprotocol != htons(ETH_P_IP))) {\n+\t\treason = SKB_DROP_REASON_INVALID_PROTO;\n+\t\tgoto err_discard;\n+\t}\n+\n \treason = psp_sk_rx_policy_check(sk, skb);\n \tif (reason)\n \t\tgoto err_discard;\ndiff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c\nindex e006a30360eae1..a93410aab66e6f 100644\n--- a/net/ipv6/tcp_ipv6.c\n+++ b/net/ipv6/tcp_ipv6.c\n@@ -130,6 +130,19 @@ static int tcp_v6_pre_connect(struct sock *sk, struct sockaddr_unsized *uaddr,\n \treturn BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr, \u0026addr_len);\n }\n \n+/* Undo the v4-mapped setup done by tcp_v6_connect(). */\n+static void tcp_v6_restore_af_ops(struct sock *sk)\n+{\n+\t/* Paired with READ_ONCE() in tcp_(get|set)sockopt() */\n+\tWRITE_ONCE(inet_csk(sk)-\u003eicsk_af_ops, \u0026ipv6_specific);\n+\tif (sk_is_mptcp(sk))\n+\t\tmptcpv6_handle_mapped(sk, false);\n+\tsk-\u003esk_backlog_rcv = tcp_v6_do_rcv;\n+#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)\n+\ttcp_sk(sk)-\u003eaf_specific = \u0026tcp_sock_ipv6_specific;\n+#endif\n+}\n+\n static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,\n \t\t\t int addr_len)\n {\n@@ -243,14 +256,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,\n \n \t\tif (err) {\n \t\t\ticsk-\u003eicsk_ext_hdr_len = exthdrlen;\n-\t\t\t/* Paired with READ_ONCE() in tcp_(get|set)sockopt() */\n-\t\t\tWRITE_ONCE(icsk-\u003eicsk_af_ops, \u0026ipv6_specific);\n-\t\t\tif (sk_is_mptcp(sk))\n-\t\t\t\tmptcpv6_handle_mapped(sk, false);\n-\t\t\tsk-\u003esk_backlog_rcv = tcp_v6_do_rcv;\n-#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)\n-\t\t\ttp-\u003eaf_specific = \u0026tcp_sock_ipv6_specific;\n-#endif\n+\t\t\ttcp_v6_restore_af_ops(sk);\n \t\t\tgoto failure;\n \t\t}\n \t\tnp-\u003esaddr = sk-\u003esk_v6_rcv_saddr;\n@@ -2093,6 +2099,19 @@ static int tcp_v6_init_sock(struct sock *sk)\n \treturn 0;\n }\n \n+static int tcp_v6_disconnect(struct sock *sk, int flags)\n+{\n+\tint ret = tcp_disconnect(sk, flags);\n+\n+\t/* A socket used for a v4-mapped connection must not keep IPv4\n+\t * handlers when it is reused for listen() or a native IPv6 connect().\n+\t */\n+\tif (sk-\u003esk_backlog_rcv == tcp_v4_do_rcv)\n+\t\ttcp_v6_restore_af_ops(sk);\n+\n+\treturn ret;\n+}\n+\n #ifdef CONFIG_PROC_FS\n /* Proc filesystem TCPv6 sock list dumping. */\n static void get_openreq6(struct seq_file *seq,\n@@ -2283,7 +2302,7 @@ struct proto tcpv6_prot = {\n \t.close\t\t\t= tcp_close,\n \t.pre_connect\t\t= tcp_v6_pre_connect,\n \t.connect\t\t= tcp_v6_connect,\n-\t.disconnect\t\t= tcp_disconnect,\n+\t.disconnect\t\t= tcp_v6_disconnect,\n \t.accept\t\t\t= inet_csk_accept,\n \t.ioctl\t\t\t= tcp_ioctl,\n \t.init\t\t\t= tcp_v6_init_sock,\ndiff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c\nindex 7a22e9388e0e9a..fdfbc7de2ec036 100644\n--- a/net/mptcp/protocol.c\n+++ b/net/mptcp/protocol.c\n@@ -2608,7 +2608,7 @@ static void __mptcp_subflow_disconnect(struct sock *ssk,\n \t\t/* The MPTCP code never wait on the subflow sockets, TCP-level\n \t\t * disconnect should never fail\n \t\t */\n-\t\tWARN_ON_ONCE(tcp_disconnect(ssk, 0));\n+\t\tWARN_ON_ONCE(ssk-\u003esk_prot-\u003edisconnect(ssk, 0));\n \t\tmptcp_subflow_ctx_reset(subflow);\n \t} else {\n \t\ttcp_shutdown(ssk, SEND_SHUTDOWN);\n@@ -3287,7 +3287,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)\n \t\t\tbreak;\n \t\tfallthrough;\n \tcase TCP_SYN_SENT:\n-\t\tWARN_ON_ONCE(tcp_disconnect(ssk, O_NONBLOCK));\n+\t\tWARN_ON_ONCE(ssk-\u003esk_prot-\u003edisconnect(ssk, O_NONBLOCK));\n \t\tbreak;\n \tdefault:\n \t\tif (__mptcp_check_fallback(mptcp_sk(sk))) {\n"
} |
| 2/1 | 2026/11/04 23:18 | agent | patch-evaluator |
14mModel:core Args: null Results: {
"EnableConfigs": [
"INET",
"IPV6",
"MPTCP",
"MPTCP_IPV6"
],
"FocusSymbols": [
"tcp_v6_disconnect",
"tcp_v6_restore_af_ops",
"tcp_v6_connect",
"tcp_v4_do_rcv",
"__mptcp_subflow_disconnect",
"mptcp_subflow_shutdown",
"mptcp_close_ssk"
],
"Reasoning": "The patch modifies core TCP IPv4, IPv6, and MPTCP networking code. Specifically, it introduces tcp_v6_disconnect to properly restore IPv6 af_ops and backlog handler when disconnecting IPv4-mapped IPv6 sockets, checks for invalid protocol packets in tcp_v4_do_rcv, and updates MPTCP subflow disconnect/shutdown logic to invoke protocol-specific disconnect callbacks instead of hardcoded tcp_disconnect. This reachable code path can be exercised via socket API calls (connect, disconnect, listen, and MPTCP subflow management) and warrants fuzzing.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
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: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit efa149f8ce29656fc2a4dcf0d119efed7642880f
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Nov 4 23:18:01 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a7f9242f1e4290..8fa6564d2b6029 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1836,6 +1836,11 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
{
enum skb_drop_reason reason;
+ if (unlikely(skb->protocol != htons(ETH_P_IP))) {
+ reason = SKB_DROP_REASON_INVALID_PROTO;
+ goto err_discard;
+ }
+
reason = psp_sk_rx_policy_check(sk, skb);
if (reason)
goto err_discard;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e006a30360eae1..a93410aab66e6f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -130,6 +130,19 @@ static int tcp_v6_pre_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
return BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr, &addr_len);
}
+/* Undo the v4-mapped setup done by tcp_v6_connect(). */
+static void tcp_v6_restore_af_ops(struct sock *sk)
+{
+ /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
+ WRITE_ONCE(inet_csk(sk)->icsk_af_ops, &ipv6_specific);
+ if (sk_is_mptcp(sk))
+ mptcpv6_handle_mapped(sk, false);
+ sk->sk_backlog_rcv = tcp_v6_do_rcv;
+#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)
+ tcp_sk(sk)->af_specific = &tcp_sock_ipv6_specific;
+#endif
+}
+
static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
int addr_len)
{
@@ -243,14 +256,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
if (err) {
icsk->icsk_ext_hdr_len = exthdrlen;
- /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
- WRITE_ONCE(icsk->icsk_af_ops, &ipv6_specific);
- if (sk_is_mptcp(sk))
- mptcpv6_handle_mapped(sk, false);
- sk->sk_backlog_rcv = tcp_v6_do_rcv;
-#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)
- tp->af_specific = &tcp_sock_ipv6_specific;
-#endif
+ tcp_v6_restore_af_ops(sk);
goto failure;
}
np->saddr = sk->sk_v6_rcv_saddr;
@@ -2093,6 +2099,19 @@ static int tcp_v6_init_sock(struct sock *sk)
return 0;
}
+static int tcp_v6_disconnect(struct sock *sk, int flags)
+{
+ int ret = tcp_disconnect(sk, flags);
+
+ /* A socket used for a v4-mapped connection must not keep IPv4
+ * handlers when it is reused for listen() or a native IPv6 connect().
+ */
+ if (sk->sk_backlog_rcv == tcp_v4_do_rcv)
+ tcp_v6_restore_af_ops(sk);
+
+ return ret;
+}
+
#ifdef CONFIG_PROC_FS
/* Proc filesystem TCPv6 sock list dumping. */
static void get_openreq6(struct seq_file *seq,
@@ -2283,7 +2302,7 @@ struct proto tcpv6_prot = {
.close = tcp_close,
.pre_connect = tcp_v6_pre_connect,
.connect = tcp_v6_connect,
- .disconnect = tcp_disconnect,
+ .disconnect = tcp_v6_disconnect,
.accept = inet_csk_accept,
.ioctl = tcp_ioctl,
.init = tcp_v6_init_sock,
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7a22e9388e0e9a..fdfbc7de2ec036 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2608,7 +2608,7 @@ static void __mptcp_subflow_disconnect(struct sock *ssk,
/* The MPTCP code never wait on the subflow sockets, TCP-level
* disconnect should never fail
*/
- WARN_ON_ONCE(tcp_disconnect(ssk, 0));
+ WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, 0));
mptcp_subflow_ctx_reset(subflow);
} else {
tcp_shutdown(ssk, SEND_SHUTDOWN);
@@ -3287,7 +3287,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
break;
fallthrough;
case TCP_SYN_SENT:
- WARN_ON_ONCE(tcp_disconnect(ssk, O_NONBLOCK));
+ WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, O_NONBLOCK));
break;
default:
if (__mptcp_check_fallback(mptcp_sk(sk))) {
|
| 3/2 | 2026/11/04 23:18 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 4429 output: 32 thoughts: 641 Thoughts: **Patch Analysis: TCP/MPTCP Network Subsystem Modifications** Alright, let's break this down. My initial assessment is that this patch is making some key modifications to the TCP and MPTCP network stacks, specifically around IPv4, IPv6, and the Multiple Path TCP (MPTCP) extensions. I see changes in three files: `tcp_ipv4.c`, `tcp_ipv6.c`, and `protocol.c`. First, in `tcp_ipv4.c`, a check has been added within `tcp_v4_do_rcv()` to ensure the incoming packet protocol is IPv4 (ETH_P_IP). If it's not, it's dropped with a specific reason. Seems like a basic sanity check, potentially to prevent some sort of protocol confusion or injection. The second area of concern is IPv6, with significant modifications in `tcp_ipv6.c`. It looks like there's a new helper function `tcp_v6_restore_af_ops()` and a new function `tcp_v6_disconnect()` has been added. `tcp_v6_connect()` is updated to call the new helper. Also, the `disconnect` function in `tcpv6_prot` is now pointing to `tcp_v6_disconnect()` instead of `tcp_disconnect`. The new `tcp_v6_disconnect()` function appears to handle the cleanup and restores IPv6 handlers when a v4-mapped connection is disconnected, particularly when the socket might be reused for listen() or a native IPv6 connection. This indicates a focus on socket state management and handling v4-mapped connections correctly when switching to IPv6. Finally, in `protocol.c` (MPTCP), I see changes in `__mptcp_subflow_disconnect()` and `mptcp_subflow_shutdown()`. Instead of directly calling `tcp_disconnect`, these functions now call the socket's `disconnect` method. The use of `WARN_ON_ONCE` here suggests that the original assumption or behavior of `tcp_disconnect` may be problematic or unexpected, perhaps in the context of MPTCP subflows. My initial thoughts are, this has potential. This touches core networking, and the added protocol check, especially around IPv6 and MPTCP subflows, all scream "worth fuzing". Sockets, connects/disconnects, and packet handling via loopback and TUN/TAP are all easily reachable. Now, I should double check the specific configuration dependencies and the neighboring code around the touched functions. I'll use `read-file` or `grepper` to inspect surrounding code in `net/ipv6/tcp_ipv6.c` and `net/mptcp/protocol.c`. |
| 4/2 | 2026/11/04 23:18 | tool | grepper |
0mArgs:{
"Expression": "tcp_v6_disconnect",
"PathPrefixes": [
"net/ipv6/"
]
}Results: {
"Output": "net/ipv6/tcp_ipv6.c=2086=static int tcp_v6_init_sock(struct sock *sk)\n--\nnet/ipv6/tcp_ipv6.c-2101-\nnet/ipv6/tcp_ipv6.c:2102:static int tcp_v6_disconnect(struct sock *sk, int flags)\nnet/ipv6/tcp_ipv6.c-2103-{\n--\nnet/ipv6/tcp_ipv6.c=2299=struct proto tcpv6_prot = {\n--\nnet/ipv6/tcp_ipv6.c-2304-\t.connect\t\t= tcp_v6_connect,\nnet/ipv6/tcp_ipv6.c:2305:\t.disconnect\t\t= tcp_v6_disconnect,\nnet/ipv6/tcp_ipv6.c-2306-\t.accept\t\t\t= inet_csk_accept,\n"
} |
| 5/2 | 2026/11/04 23:18 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 5924 output: 39 thoughts: 62 Thoughts: Okay, let's dive into this. **Examining IPv6 TCP Restoration** Alright, my first instinct is to zero in on `tcp_v6_restore_af_ops` and related functions within `net/ipv6/tcp_ipv6.c`. That's where the core IPv6-specific TCP operation restoration logic should reside, and I want to refresh my memory on the details of this module. Let's quickly get situated; I'll scan through lines 130 to 265 in `net/ipv6/tcp_ipv6.c` to get a good sense of the layout. With that context, I'll be able to quickly see if any of the core assumptions I had about this code base are still valid, or if I need to adjust them. |
| 6/2 | 2026/11/04 23:19 | tool | read-file |
0mArgs:{
"File": "net/ipv6/tcp_ipv6.c",
"FirstLine": 130,
"LineCount": 50
}Results: {
"Contents": " 130:\t\treturn BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr, \u0026addr_len);\n 131:\t}\n 132:\t\n 133:\t/* Undo the v4-mapped setup done by tcp_v6_connect(). */\n 134:\tstatic void tcp_v6_restore_af_ops(struct sock *sk)\n 135:\t{\n 136:\t\t/* Paired with READ_ONCE() in tcp_(get|set)sockopt() */\n 137:\t\tWRITE_ONCE(inet_csk(sk)-\u003eicsk_af_ops, \u0026ipv6_specific);\n 138:\t\tif (sk_is_mptcp(sk))\n 139:\t\t\tmptcpv6_handle_mapped(sk, false);\n 140:\t\tsk-\u003esk_backlog_rcv = tcp_v6_do_rcv;\n 141:\t#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)\n 142:\t\ttcp_sk(sk)-\u003eaf_specific = \u0026tcp_sock_ipv6_specific;\n 143:\t#endif\n 144:\t}\n 145:\t\n 146:\tstatic int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,\n 147:\t\t\t\t int addr_len)\n 148:\t{\n 149:\t\tstruct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;\n 150:\t\tstruct inet_connection_sock *icsk = inet_csk(sk);\n 151:\t\tstruct inet_timewait_death_row *tcp_death_row;\n 152:\t\tstruct ipv6_pinfo *np = tcp_inet6_sk(sk);\n 153:\t\tstruct in6_addr *saddr = NULL, *final_p;\n 154:\t\tstruct inet_sock *inet = inet_sk(sk);\n 155:\t\tstruct tcp_sock *tp = tcp_sk(sk);\n 156:\t\tstruct net *net = sock_net(sk);\n 157:\t\tstruct ipv6_txoptions *opt;\n 158:\t\tstruct dst_entry *dst;\n 159:\t\tstruct flowi6 *fl6;\n 160:\t\tint addr_type;\n 161:\t\tint err;\n 162:\t\n 163:\t\tif (addr_len \u003c SIN6_LEN_RFC2133)\n 164:\t\t\treturn -EINVAL;\n 165:\t\n 166:\t\tif (usin-\u003esin6_family != AF_INET6)\n 167:\t\t\treturn -EAFNOSUPPORT;\n 168:\t\n 169:\t\tif (psp_sk_assoc(sk))\n 170:\t\t\treturn -EINVAL;\n 171:\t\n 172:\t\tfl6 = \u0026inet_sk(sk)-\u003ecork.fl.u.ip6;\n 173:\t\tmemset(fl6, 0, sizeof(*fl6));\n 174:\t\n 175:\t\tif (inet6_test_bit(SNDFLOW, sk)) {\n 176:\t\t\tfl6-\u003eflowlabel = usin-\u003esin6_flowinfo \u0026 IPV6_FLOWINFO_MASK;\n 177:\t\t\tIP6_ECN_flow_init(fl6-\u003eflowlabel);\n 178:\t\t\tif (fl6-\u003eflowlabel \u0026 IPV6_FLOWLABEL_MASK) {\n 179:\t\t\t\tstruct ip6_flowlabel *flowlabel;\n"
} |
| 7/2 | 2026/11/04 23:19 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 7122 output: 39 thoughts: 52 Thoughts: Okay, let's dive into this. **Examining IPv6 Mapped Connections in `tcp_ipv6.c`** Alright, I need to refresh my memory on how v4-mapped connections are specifically established and managed within the IPv6 TCP stack. My focus is going to be on the `tcp_v6_connect` function. I remember this is where the crucial connection initiation logic happens for IPv6. I think the key lies in understanding how the kernel handles the translation, and the interaction with the underlying v4 stack in that case. I'm going to zero in on lines 200 through 260 of `net/ipv6/tcp_ipv6.c` to see how it's handled. I'm hoping this chunk contains the setup process, paying close attention to how the mapped IPv4 address is presented to the underlying TCP layer. I need to understand the data structures involved, the sequence of operations, and any special considerations for these "dual-stack" connections. This context should clarify the interplay between the IPv6 and IPv4 stacks. |
| 8/2 | 2026/11/04 23:20 | tool | read-file |
0mArgs:{
"File": "net/ipv6/tcp_ipv6.c",
"FirstLine": 210,
"LineCount": 60
}Results: {
"Contents": " 210:\t\t\t\tif (!sk_dev_equal_l3scope(sk, usin-\u003esin6_scope_id))\n 211:\t\t\t\t\treturn -EINVAL;\n 212:\t\n 213:\t\t\t\tsk-\u003esk_bound_dev_if = usin-\u003esin6_scope_id;\n 214:\t\t\t}\n 215:\t\n 216:\t\t\t/* Connect to link-local address requires an interface */\n 217:\t\t\tif (!sk-\u003esk_bound_dev_if)\n 218:\t\t\t\treturn -EINVAL;\n 219:\t\t}\n 220:\t\n 221:\t\tif (tp-\u003erx_opt.ts_recent_stamp \u0026\u0026\n 222:\t\t !ipv6_addr_equal(\u0026sk-\u003esk_v6_daddr, \u0026usin-\u003esin6_addr)) {\n 223:\t\t\ttp-\u003erx_opt.ts_recent = 0;\n 224:\t\t\ttp-\u003erx_opt.ts_recent_stamp = 0;\n 225:\t\t\tWRITE_ONCE(tp-\u003ewrite_seq, 0);\n 226:\t\t}\n 227:\t\n 228:\t\tsk-\u003esk_v6_daddr = usin-\u003esin6_addr;\n 229:\t\tnp-\u003eflow_label = fl6-\u003eflowlabel;\n 230:\t\n 231:\t\t/*\n 232:\t\t *\tTCP over IPv4\n 233:\t\t */\n 234:\t\n 235:\t\tif (addr_type \u0026 IPV6_ADDR_MAPPED) {\n 236:\t\t\tu32 exthdrlen = icsk-\u003eicsk_ext_hdr_len;\n 237:\t\t\tstruct sockaddr_in sin;\n 238:\t\n 239:\t\t\tif (ipv6_only_sock(sk))\n 240:\t\t\t\treturn -ENETUNREACH;\n 241:\t\n 242:\t\t\tsin.sin_family = AF_INET;\n 243:\t\t\tsin.sin_port = usin-\u003esin6_port;\n 244:\t\t\tsin.sin_addr.s_addr = usin-\u003esin6_addr.s6_addr32[3];\n 245:\t\n 246:\t\t\t/* Paired with READ_ONCE() in tcp_(get|set)sockopt() */\n 247:\t\t\tWRITE_ONCE(icsk-\u003eicsk_af_ops, \u0026ipv6_mapped);\n 248:\t\t\tif (sk_is_mptcp(sk))\n 249:\t\t\t\tmptcpv6_handle_mapped(sk, true);\n 250:\t\t\tsk-\u003esk_backlog_rcv = tcp_v4_do_rcv;\n 251:\t#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)\n 252:\t\t\ttp-\u003eaf_specific = \u0026tcp_sock_ipv6_mapped_specific;\n 253:\t#endif\n 254:\t\n 255:\t\t\terr = tcp_v4_connect(sk, (struct sockaddr_unsized *)\u0026sin, sizeof(sin));\n 256:\t\n 257:\t\t\tif (err) {\n 258:\t\t\t\ticsk-\u003eicsk_ext_hdr_len = exthdrlen;\n 259:\t\t\t\ttcp_v6_restore_af_ops(sk);\n 260:\t\t\t\tgoto failure;\n 261:\t\t\t}\n 262:\t\t\tnp-\u003esaddr = sk-\u003esk_v6_rcv_saddr;\n 263:\t\n 264:\t\t\treturn err;\n 265:\t\t}\n 266:\t\n 267:\t\tif (!ipv6_addr_any(\u0026sk-\u003esk_v6_rcv_saddr))\n 268:\t\t\tsaddr = \u0026sk-\u003esk_v6_rcv_saddr;\n 269:\t\n"
} |
| 9/2 | 2026/11/04 23:20 | llm | patch-evaluator |
2mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 8441 output: 38 thoughts: 756 Thoughts: **Analyzing a Potential IPv6-to-IPv4 Mapping Vulnerability** Okay, here's what I'm seeing. When an IPv6 TCP socket establishes a connection to an IPv4-mapped address (like `::ffff:x.x.x.x`), the system sets up some internal structures: `icsk->icsk_af_ops` is assigned to `ipv6_mapped`, if it is an MPTCP socket, `mptcpv6_handle_mapped` is called, `sk->sk_backlog_rcv` is set to `tcp_v4_do_rcv`, and `tp->af_specific` is updated. Then, `tcp_v4_connect` is invoked. The problem lies in what happens *after* that initial connection. It seems that, in the past, even if the socket was later disconnected, perhaps by closing the socket or connecting with `AF_UNSPEC`, it retained the `sk->sk_backlog_rcv = tcp_v4_do_rcv` setting. If that socket was then reused—say, for `listen()` or a native IPv6 connection—or if IPv6 packets arrived on it, the `tcp_v4_do_rcv` function would be called with IPv6 packets! Now, the `tcp_v4_do_rcv` function, as implemented in `net/ipv4/tcp_ipv4.c`, *assumes* it's receiving an IPv4 packet. Specifically, it checks `skb->protocol != htons(ETH_P_IP)`. If the packet isn't IPv4, it discards it. The problem is that previously the code didn't handle the case where it might be IPv6. This could lead to a whole host of problems: crashes, memory corruption, type confusion—the whole gamut of nasty things that happen when you feed the wrong data to the wrong function. Fortunately, a fix seems to have been implemented, `tcp_v6_disconnect` was added. This function is called during the disconnect process. If the socket still has `sk->sk_backlog_rcv = tcp_v4_do_rcv`, it means it's stuck in this potentially vulnerable state. Then, `tcp_v6_restore_af_ops(sk)` is called to resolve this. In the context of MPTCP, I see there's a safety check: `WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, 0))` and `WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, O_NONBLOCK))`. Critically, this now calls the subflow's `disconnect` method. So if `ssk` is an IPv6 subflow socket, it means the `tcp_v6_disconnect` will be called. My hypothesis is the issue was resolved by adding `tcp_v6_disconnect`. Let me examine `net/mptcp/protocol.c` around the key lines you mentioned (2608 and 3287) to better understand the interaction between IPv6 and MPTCP, to make certain this change is correct. |
| 10/2 | 2026/11/04 23:23 | tool | read-file |
0mArgs:{
"File": "net/mptcp/protocol.c",
"FirstLine": 2600,
"LineCount": 25
}Results: {
"Contents": "2600:\t * TCP_CLOSE state\n2601:\t */\n2602:\tstatic void __mptcp_subflow_disconnect(struct sock *ssk,\n2603:\t\t\t\t\t struct mptcp_subflow_context *subflow,\n2604:\t\t\t\t\t bool fastclosing)\n2605:\t{\n2606:\t\tif (((1 \u003c\u003c ssk-\u003esk_state) \u0026 (TCPF_CLOSE | TCPF_LISTEN)) ||\n2607:\t\t fastclosing) {\n2608:\t\t\t/* The MPTCP code never wait on the subflow sockets, TCP-level\n2609:\t\t\t * disconnect should never fail\n2610:\t\t\t */\n2611:\t\t\tWARN_ON_ONCE(ssk-\u003esk_prot-\u003edisconnect(ssk, 0));\n2612:\t\t\tmptcp_subflow_ctx_reset(subflow);\n2613:\t\t} else {\n2614:\t\t\ttcp_shutdown(ssk, SEND_SHUTDOWN);\n2615:\t\t}\n2616:\t}\n2617:\t\n2618:\tstatic void mptcp_cleanup_ssk_backlog(struct sock *sk, struct sock *ssk)\n2619:\t{\n2620:\t\tstruct mptcp_sock *msk = mptcp_sk(sk);\n2621:\t\tstruct sk_buff *skb;\n2622:\t\n2623:\t\tmptcp_data_lock(sk);\n2624:\t\tlist_for_each_entry(skb, \u0026msk-\u003ebacklog_list, list) {\n"
} |
| 11/2 | 2026/11/04 23:23 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 10334 output: 38 thoughts: 22 Thoughts: Here's my summary, as if I were thinking these thoughts: **Analyzing `net/mptcp/protocol.c` - Line 3280** Okay, I need to get into the details of this MPTCP implementation. Let's zero in on line 3280 within `net/mptcp/protocol.c`. That's where the magic probably happens... or where things might go horribly wrong. I need to understand the precise state machine transition or data structure manipulation that's occurring at that specific point. Line numbers are a good starting point for pinpointing control flow issues, or understanding how packet processing impacts key variables. I'm guessing that line might be dealing with either a critical handshake step, a data retransmission mechanism, or even a congestion control adjustment. Let's see what's what. |
| 12/2 | 2026/11/04 23:24 | tool | read-file |
0mArgs:{
"File": "net/mptcp/protocol.c",
"FirstLine": 3280,
"LineCount": 25
}Results: {
"Contents": "3280:\tvoid mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)\n3281:\t{\n3282:\t\tlock_sock(ssk);\n3283:\t\n3284:\t\tswitch (ssk-\u003esk_state) {\n3285:\t\tcase TCP_LISTEN:\n3286:\t\t\tif (!(how \u0026 RCV_SHUTDOWN))\n3287:\t\t\t\tbreak;\n3288:\t\t\tfallthrough;\n3289:\t\tcase TCP_SYN_SENT:\n3290:\t\t\tWARN_ON_ONCE(ssk-\u003esk_prot-\u003edisconnect(ssk, O_NONBLOCK));\n3291:\t\t\tbreak;\n3292:\t\tdefault:\n3293:\t\t\tif (__mptcp_check_fallback(mptcp_sk(sk))) {\n3294:\t\t\t\tpr_debug(\"Fallback\\n\");\n3295:\t\t\t\tssk-\u003esk_shutdown |= how;\n3296:\t\t\t\ttcp_shutdown(ssk, how);\n3297:\t\n3298:\t\t\t\t/* simulate the data_fin ack reception to let the state\n3299:\t\t\t\t * machine move forward\n3300:\t\t\t\t */\n3301:\t\t\t\tWRITE_ONCE(mptcp_sk(sk)-\u003esnd_una, mptcp_sk(sk)-\u003esnd_nxt);\n3302:\t\t\t\tmptcp_schedule_work(sk);\n3303:\t\t\t} else {\n3304:\t\t\t\tpr_debug(\"Sending DATA_FIN on subflow %p\\n\", ssk);\n"
} |
| 13/2 | 2026/11/04 23:24 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 10974 output: 31 thoughts: 302 Thoughts: **Fuzzing This is a No-Brainer** Okay, this is absolutely ripe for fuzzing. The networking code here is definitely where the interesting bugs hide. My reasoning? Well, first, we've got core network code within reach – TCP for IPv4 and IPv6, and even MPTCP! That's a huge potential attack surface right there. Second, the changes are particularly juicy. We're seeing modifications to socket protocol handlers and disconnect logic, specifically things like `tcp_v6_disconnect` and `tcp_v6_restore_af_ops`. There are also new checks, like `skb->protocol != htons(ETH_P_IP)`, which always catch my attention, and the all-important alteration of indirect function calls with `ssk->sk_prot->disconnect(...)`. The indirect calls are always fun, as are the state machines involved. Third, and this is the real kicker, the edge cases here practically scream for a fuzzer's attention. I'm thinking about things like IPv4-mapped IPv6 sockets, disconnect/reconnect sequences, listening processes and backlog processing, MPTCP subflow resets and shutdowns, and protocol mismatches during packet processing. These are the kinds of areas that can *easily* expose state machine issues, race conditions, or even blatant assertion failures, which is what I'm looking for. Now, let's make sure we've got the Kconfig dependencies covered. We need to know what features need to be enabled for the modified code to even be active. In `net/ipv4/tcp_ipv4.c`: `CONFIG_INET`, of course. In `net/ipv6/tcp_ipv6.c`: `CONFIG_IPV6`, naturally, and also `CONFIG_TCP_MD5SIG`, `CONFIG_TCP_AO` as they're optional features in `tcp_v6_restore_af_ops`, but that should be covered by my fuzzer. In `net/mptcp/protocol.c`: `CONFIG_MPTCP`. Right, time to check Kconfig to verify MPTCP and IPv6 are enabled, before the fuzzing begins. |
| 14/2 | 2026/11/04 23:25 | tool | grepper |
0mArgs:{
"Expression": "config MPTCP",
"PathPrefixes": [
"net/mptcp/"
]
}Results: {
"Output": "net/mptcp/Kconfig-1-\nnet/mptcp/Kconfig:2:config MPTCP\nnet/mptcp/Kconfig-3-\tbool \"MPTCP: Multipath TCP\"\n--\nnet/mptcp/Kconfig=16=config INET_MPTCP_DIAG\n--\nnet/mptcp/Kconfig-19-\nnet/mptcp/Kconfig:20:config MPTCP_IPV6\nnet/mptcp/Kconfig-21-\tbool \"MPTCP: IPv6 support for Multipath TCP\"\n--\nnet/mptcp/Kconfig-24-\nnet/mptcp/Kconfig:25:config MPTCP_KUNIT_TEST\nnet/mptcp/Kconfig-26-\ttristate \"This builds the MPTCP KUnit tests\" if !KUNIT_ALL_TESTS\n"
} |
| 15/2 | 2026/11/04 23:25 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 11993 output: 34 thoughts: 22 Thoughts: Here's a summary of my thought process, as requested: **Diving into Kconfig for MPTCP Configuration** Okay, time to get granular. I need to understand the configuration options for Multipath TCP, so let's start by examining the core configuration file. Specifically, I'm going to zero in on lines 1 through 25 of `net/mptcp/Kconfig`. This should give me a good initial overview of the general structure and perhaps the top-level dependencies or enable/disable flags for MPTCP as a whole. I expect to see the basic module selection (yes, no, m), possibly some default values, and maybe even a brief description of the MPTCP feature set if I'm lucky. I am anticipating this is where I will see the highest level flags. |
| 16/2 | 2026/11/04 23:26 | tool | read-file |
0mArgs:{
"File": "net/mptcp/Kconfig",
"FirstLine": 1,
"LineCount": 25
}Results: {
"Contents": " 1:\t\n 2:\tconfig MPTCP\n 3:\t\tbool \"MPTCP: Multipath TCP\"\n 4:\t\tdepends on INET\n 5:\t\tselect SKB_EXTENSIONS\n 6:\t\tselect CRYPTO_LIB_SHA256\n 7:\t\tselect CRYPTO_LIB_UTILS\n 8:\t\thelp\n 9:\t\t Multipath TCP (MPTCP) connections send and receive data over multiple\n 10:\t\t subflows in order to utilize multiple network paths. Each subflow\n 11:\t\t uses the TCP protocol, and TCP options carry header information for\n 12:\t\t MPTCP.\n 13:\t\n 14:\tif MPTCP\n 15:\t\n 16:\tconfig INET_MPTCP_DIAG\n 17:\t\tdepends on INET_DIAG\n 18:\t\tdef_tristate INET_DIAG\n 19:\t\n 20:\tconfig MPTCP_IPV6\n 21:\t\tbool \"MPTCP: IPv6 support for Multipath TCP\"\n 22:\t\tdepends on IPV6=y\n 23:\t\tdefault y\n 24:\t\n 25:\tconfig MPTCP_KUNIT_TEST\n"
} |
| 17/2 | 2026/11/04 23:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 12530 output: 23 thoughts: 63 Thoughts: Okay, here's my assessment of that line of reasoning, presented as my own thought process: **MPTCP, IPv6, and the Mapping Function - My Analysis** Right, so `MPTCP_IPV6` is clearly conditional on `IPV6=y`. That's standard and makes perfect sense. No surprises there. But now, what catches my attention is the link to `mptcpv6_handle_mapped` via `sk_is_mptcp(sk)`. This suggests that the mapping function is only being used for MPTCP sockets. I need to understand that relationship more precisely. It indicates that the system is going to call `mptcpv6_handle_mapped` only if the socket in question is, in fact, an MPTCP socket. I will need to delve further into what `mptcpv6_handle_mapped` actually does, of course, and whether that fits into the expected IPv6 MPTCP design and the whole dual-stack environment. The main thing is to find that definition and see the interaction in a complete context. |
| 18/2 | 2026/11/04 23:27 | tool | grepper |
0mArgs:{
"Expression": "mptcpv6_handle_mapped"
}Results: {
"Output": "include/net/mptcp.h=323=int mptcpv6_init(void);\ninclude/net/mptcp.h:324:void mptcpv6_handle_mapped(struct sock *sk, bool mapped);\ninclude/net/mptcp.h-325-#elif IS_ENABLED(CONFIG_IPV6)\ninclude/net/mptcp.h=326=static inline int mptcpv6_init(void) { return 0; }\ninclude/net/mptcp.h:327:static inline void mptcpv6_handle_mapped(struct sock *sk, bool mapped) { }\ninclude/net/mptcp.h-328-#endif\n--\nnet/ipv6/tcp_ipv6.c=134=static void tcp_v6_restore_af_ops(struct sock *sk)\n--\nnet/ipv6/tcp_ipv6.c-138-\tif (sk_is_mptcp(sk))\nnet/ipv6/tcp_ipv6.c:139:\t\tmptcpv6_handle_mapped(sk, false);\nnet/ipv6/tcp_ipv6.c-140-\tsk-\u003esk_backlog_rcv = tcp_v6_do_rcv;\n--\nnet/ipv6/tcp_ipv6.c=146=static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,\n--\nnet/ipv6/tcp_ipv6.c-248-\t\tif (sk_is_mptcp(sk))\nnet/ipv6/tcp_ipv6.c:249:\t\t\tmptcpv6_handle_mapped(sk, true);\nnet/ipv6/tcp_ipv6.c-250-\t\tsk-\u003esk_backlog_rcv = tcp_v4_do_rcv;\n--\nnet/ipv6/tcp_ipv6.c=1357=static void tcp_v6_mapped_child_init(struct sock *newsk, const struct sock *sk)\n--\nnet/ipv6/tcp_ipv6.c-1370-\tif (sk_is_mptcp(newsk))\nnet/ipv6/tcp_ipv6.c:1371:\t\tmptcpv6_handle_mapped(newsk, true);\nnet/ipv6/tcp_ipv6.c-1372-\tnewsk-\u003esk_backlog_rcv = tcp_v4_do_rcv;\n--\nnet/mptcp/subflow.c=1599=subflow_default_af_ops(struct sock *sk)\n--\nnet/mptcp/subflow.c-1608-#if IS_ENABLED(CONFIG_MPTCP_IPV6)\nnet/mptcp/subflow.c:1609:void mptcpv6_handle_mapped(struct sock *sk, bool mapped)\nnet/mptcp/subflow.c-1610-{\n"
} |
| 19/2 | 2026/11/04 23:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 13586 output: 36 thoughts: 2722 Thoughts: **Focus Symbol Determination: A Deep Dive** Okay, here's the breakdown of my thinking regarding these `FocusSymbols`. The core issue revolves around IPv6 sockets using IPv4-mapped addresses, and specifically, how disconnections and MPTCP subflows are handled. The patch addresses a bug where, upon disconnection or in MPTCP, the socket might retain IPv4-specific operations, leading to potential issues with IPv6 packets or other non-IPv4 traffic. I am trying to identify which symbols, if added to `FocusSymbols`, will provide the most benefit, and not dilute the focus. First, I need to confirm the relevant configurations: `INET`, `IPV6`, `MPTCP`, and `MPTCP_IPV6` are certainly relevant. Now, it's time to examine the key functions modified or newly added by the patch. I initially considered `tcp_v4_do_rcv`. It's definitely modified with a protocol check (`skb->protocol != htons(ETH_P_IP)`), so the patch touches it. However, it's a hot-path function called for every incoming IPv4 TCP packet. The syzkaller guidelines explicitly advise against listing "ubiquitous lifecycle hot-paths" because it would dilute the fuzzing effort. But wait, is it truly ubiquitous? While any TCP test calls it, is it called by *almost* every program in the corpus? No. This function is specific to TCP IPv4 reception. The patch *did* add a specific check to this function, however. Okay, let's look at the other functions. `tcp_v6_disconnect` is a new function added in `net/ipv6/tcp_ipv6.c`. It's definitely a target. `tcp_v6_connect` is relevant, and calls `tcp_v6_restore_af_ops`. Also, `__mptcp_subflow_disconnect` and `mptcp_subflow_shutdown` now call `ssk->sk_prot->disconnect(...)`. These functions are specific to IPv6 and MPTCP, not general TCP IPv4. Here is the important point: Will `tcp_v6_restore_af_ops` be inlined? `tcp_v6_disconnect` *calls* it, and it's static. But, its address is taken within `struct proto tcpv6_prot`, so it *cannot* be completely inlined and eliminated. It will definitely exist as a symbol! My main question becomes: should I include `tcp_v4_do_rcv`? Its inclusion would mean any test that sends an IPv4 TCP packet will hit this symbol and be prioritized. Does the patch actually change it in a way that is relevant to IPv6-mapped sockets? Yes. The patch explicitly adds logic to it: `if (unlikely(skb->protocol != htons(ETH_P_IP)))`. This guards against a very specific scenario, where an IPv6 socket, connected to an IPv4-mapped address, might have IPv6 (or other non-IPv4) packets misdirected to it. This happens when the `sk->sk_backlog_rcv = tcp_v4_do_rcv`. This function, if an IPv6 packet arrives while the socket is locked and queued to the backlog, it calls `tcp_v4_do_rcv`. It was modified to guard against this exact scenario. However, I'm worried about diluting the focus. If *any* IPv4 TCP packet reception prioritizes a test, will this be too broad? The core of the bug is v4-mapped disconnect and MPTCP, which are the main focus of this patch. I am re-reading the guidelines: they state to "TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS". `tcp_v4_do_rcv` *is* directly altered! Is this function ubiquitous? No, it's only called on IPv4 TCP packets. So, the key functions that I believe provide the most direct focus, without undue dilution, are: - `tcp_v6_disconnect` - `tcp_v6_connect` - `__mptcp_subflow_disconnect` - `mptcp_subflow_shutdown` I'm leaning towards *including* `tcp_v4_do_rcv`. Given the context of the bug, and the explicit changes made to guard against it, this symbol is directly tied to the core issue addressed by the patch. While it might slightly broaden the scope, it will also ensure focused testing of IPv4-mapped socket scenarios. |
| 20/2 | 2026/11/04 23:28 | tool | grepper |
0mArgs:{
"Expression": "skb-\u003eprotocol",
"PathPrefixes": [
"net/ipv6/tcp_ipv6.c"
]
}Results: {
"Output": "net/ipv6/tcp_ipv6.c=1325=static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)\nnet/ipv6/tcp_ipv6.c-1326-{\nnet/ipv6/tcp_ipv6.c:1327:\tif (skb-\u003eprotocol == htons(ETH_P_IP))\nnet/ipv6/tcp_ipv6.c-1328-\t\treturn tcp_v4_conn_request(sk, skb);\n--\nnet/ipv6/tcp_ipv6.c=1391=static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,\n--\nnet/ipv6/tcp_ipv6.c-1412-\nnet/ipv6/tcp_ipv6.c:1413:\tif (skb-\u003eprotocol == htons(ETH_P_IP))\nnet/ipv6/tcp_ipv6.c-1414-\t\treturn tcp_v4_syn_recv_sock(sk, skb, req, dst,\n--\nnet/ipv6/tcp_ipv6.c=1576=int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)\n--\nnet/ipv6/tcp_ipv6.c-1590-\nnet/ipv6/tcp_ipv6.c:1591:\tif (skb-\u003eprotocol == htons(ETH_P_IP))\nnet/ipv6/tcp_ipv6.c-1592-\t\treturn tcp_v4_do_rcv(sk, skb);\n"
} |
| 21/2 | 2026/11/04 23:28 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17744 output: 36 thoughts: 396 Thoughts: **Analyzing Potential IPv6 Protocol Vulnerability and Inlining Opportunities** Okay, so I'm looking at this code in `tcp_v6_do_rcv` and something immediately jumps out: it's forwarding IPv4 packets to `tcp_v4_do_rcv` based on the Ethernet protocol. This is interesting. The crucial point is that `tcp_v4_do_rcv` wasn't previously checking the protocol type. This means if `sk->sk_backlog_rcv` was set to `tcp_v4_do_rcv`, as might happen with a v4-mapped address via `tcp_v6_connect`, an IPv6 packet could potentially be handed directly to `tcp_v4_do_rcv` without proper protocol validation. That's a potential vulnerability to be investigated further. Now, let's switch gears and consider inlining. I need to understand what the compiler is likely to optimize. Let's start with `tcp_v6_restore_af_ops`. It's a `static void` function, so it's only visible within the current compilation unit. Given that it has only a few call sites, I'd expect GCC or Clang to inline that function quite readily, potentially eliminating the overhead entirely. What about other functions? `tcp_v6_disconnect` is assigned to `tcpv6_prot.disconnect`, so a pointer is taken. That eliminates inlining. The same logic applies to `tcp_v6_connect` as it is also assigned to `tcpv6_prot.connect`. Finally, to understand the MPTCP interactions, I want to trace the call to `__mptcp_subflow_disconnect`, so I'll check its call sites in `net/mptcp/protocol.c`. |
| 22/2 | 2026/11/04 23:30 | tool | grepper |
0mArgs:{
"Expression": "__mptcp_subflow_disconnect",
"PathPrefixes": [
"net/mptcp/"
]
}Results: {
"Output": "net/mptcp/protocol.c=2558=bool __mptcp_retransmit_pending_data(struct sock *sk)\n--\nnet/mptcp/protocol.c-2601- */\nnet/mptcp/protocol.c:2602:static void __mptcp_subflow_disconnect(struct sock *ssk,\nnet/mptcp/protocol.c-2603-\t\t\t\t struct mptcp_subflow_context *subflow,\n--\nnet/mptcp/protocol.c=2642=static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,\n--\nnet/mptcp/protocol.c-2693-\tif (!dispose_it) {\nnet/mptcp/protocol.c:2694:\t\t__mptcp_subflow_disconnect(ssk, subflow, msk-\u003efastclosing);\nnet/mptcp/protocol.c-2695-\t\trelease_sock(ssk);\n"
} |
| 23/2 | 2026/11/04 23:30 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18822 output: 35 thoughts: 29 Thoughts: Okay, here's my attempt at summarizing those thoughts from an expert's perspective, using the first person and aiming for a fulsome explanation: **Investigating Subflow Closure in Multipath TCP** Alright, time to dive into this. I'm trying to understand the control flow surrounding subflow closure in Multipath TCP. My immediate thought is, "Where are the key functions involved in shutting down a subflow actually *called*?" Specifically, I want to trace the execution path that leads to `__mptcp_close_ssk`, the internal function that manages the actual socket shutdown on the subflow, and also the broader `mptcp_subflow_shutdown` function, which likely handles more general clean up. I'm thinking, by finding *where* these functions are invoked, I can get a clearer picture of *when* and *why* a subflow is terminated. This will help me understand the scenarios, conditions, and potential issues related to subflow closure within the MPTCP stack. Is it a deliberate close initiated by the application, a congestion control event, a link failure, or something else entirely? The call sites hold the key to the answer, and I know from experience that there are several potential paths. A thorough investigation should clarify things quickly. |
| 24/2 | 2026/11/04 23:30 | tool | grepper |
0mArgs:{
"Expression": "mptcp_subflow_shutdown",
"PathPrefixes": [
"net/mptcp/"
]
}Results: {
"Output": "net/mptcp/pm.c=765=static void mptcp_pm_rm_addr_or_subflow(struct mptcp_sock *msk,\n--\nnet/mptcp/pm.c-808-\t\t\tspin_unlock_bh(\u0026msk-\u003epm.lock);\nnet/mptcp/pm.c:809:\t\t\tmptcp_subflow_shutdown(sk, ssk, how);\nnet/mptcp/pm.c-810-\t\t\tremoved |= subflow-\u003erequest_join;\n--\nnet/mptcp/pm_userspace.c=496=int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info)\n--\nnet/mptcp/pm_userspace.c-563-\tspin_unlock_bh(\u0026msk-\u003epm.lock);\nnet/mptcp/pm_userspace.c:564:\tmptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN);\nnet/mptcp/pm_userspace.c-565-\tmptcp_close_ssk(sk, ssk, mptcp_subflow_ctx(ssk));\n--\nnet/mptcp/protocol.c=3272=void mptcp_cancel_work(struct sock *sk)\n--\nnet/mptcp/protocol.c-3279-\nnet/mptcp/protocol.c:3280:void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)\nnet/mptcp/protocol.c-3281-{\n--\nnet/mptcp/protocol.c=3368=static void mptcp_check_send_data_fin(struct sock *sk)\n--\nnet/mptcp/protocol.c-3388-\nnet/mptcp/protocol.c:3389:\t\tmptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN);\nnet/mptcp/protocol.c-3390-\t}\n--\nnet/mptcp/protocol.h=837=void __init mptcp_subflow_init(void);\nnet/mptcp/protocol.h:838:void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);\nnet/mptcp/protocol.h-839-void mptcp_close_ssk(struct sock *sk, struct sock *ssk,\n"
} |
| 25/2 | 2026/11/04 23:30 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19788 output: 35 thoughts: 91 Thoughts: Okay, here's my understanding, framed as my internal thought process: **MPTCP Subflow Shutdown: A Quick Dive** Right, let's break this down. I see that `mptcp_subflow_shutdown` is a visible function exposed from within `net/mptcp/`, meaning it's available for other parts of the kernel to call. Now, I need to understand how it works. I've noted that `__mptcp_close_ssk` resides within `net/mptcp/protocol.c`. Interestingly, the public function `mptcp_close_ssk` appears to simply call this internal function `__mptcp_close_ssk`. That's a classic internal implementation detail exposed via a "wrapper" function. My next step is clearly to examine `mptcp_close_ssk` directly to understand its behavior, since it's the externally accessible entry point. |
| 26/2 | 2026/11/04 23:31 | tool | grepper |
0mArgs:{
"Expression": "mptcp_close_ssk\\(",
"PathPrefixes": [
"net/mptcp/"
]
}Results: {
"Output": "net/mptcp/pm.c=765=static void mptcp_pm_rm_addr_or_subflow(struct mptcp_sock *msk,\n--\nnet/mptcp/pm.c-812-\t\t\t/* the following takes care of updating the subflows counter */\nnet/mptcp/pm.c:813:\t\t\tmptcp_close_ssk(sk, ssk, subflow);\nnet/mptcp/pm.c-814-\t\t\tspin_lock_bh(\u0026msk-\u003epm.lock);\n--\nnet/mptcp/pm_userspace.c=496=int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info)\n--\nnet/mptcp/pm_userspace.c-564-\tmptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN);\nnet/mptcp/pm_userspace.c:565:\tmptcp_close_ssk(sk, ssk, mptcp_subflow_ctx(ssk));\nnet/mptcp/pm_userspace.c-566-\tMPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);\n--\nnet/mptcp/protocol.c=2558=bool __mptcp_retransmit_pending_data(struct sock *sk)\n--\nnet/mptcp/protocol.c-2594-\nnet/mptcp/protocol.c:2595:/* flags for __mptcp_close_ssk() */\nnet/mptcp/protocol.c-2596-#define MPTCP_CF_PUSH\t\tBIT(1)\n--\nnet/mptcp/protocol.c=2618=static void mptcp_cleanup_ssk_backlog(struct sock *sk, struct sock *ssk)\n--\nnet/mptcp/protocol.c-2641- */\nnet/mptcp/protocol.c:2642:static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,\nnet/mptcp/protocol.c-2643-\t\t\t struct mptcp_subflow_context *subflow,\n--\nnet/mptcp/protocol.c-2747-\nnet/mptcp/protocol.c:2748:void mptcp_close_ssk(struct sock *sk, struct sock *ssk,\nnet/mptcp/protocol.c-2749-\t\t struct mptcp_subflow_context *subflow)\n--\nnet/mptcp/protocol.c-2764-\nnet/mptcp/protocol.c:2765:\t__mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH);\nnet/mptcp/protocol.c-2766-}\n--\nnet/mptcp/protocol.c=2773=static void __mptcp_close_subflow(struct sock *sk)\n--\nnet/mptcp/protocol.c-2793-\nnet/mptcp/protocol.c:2794:\t\tmptcp_close_ssk(sk, ssk, subflow);\nnet/mptcp/protocol.c-2795-\t}\n--\nnet/mptcp/protocol.c=3122=static void mptcp_worker(struct work_struct *work)\n--\nnet/mptcp/protocol.c-3149-\t\tmptcp_for_each_subflow_safe(msk, subflow, tmp)\nnet/mptcp/protocol.c:3150:\t\t\t__mptcp_close_ssk(sk, subflow-\u003etcp_sock, subflow, 0);\nnet/mptcp/protocol.c-3151-\t\tmptcp_close_wake_up(sk);\n--\nnet/mptcp/protocol.c=3569=static void mptcp_destroy_common(struct mptcp_sock *msk)\n--\nnet/mptcp/protocol.c-3578-\tmptcp_for_each_subflow_safe(msk, subflow, tmp)\nnet/mptcp/protocol.c:3579:\t\t__mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, 0);\nnet/mptcp/protocol.c-3580-\n--\nnet/mptcp/protocol.c=4027=bool mptcp_finish_join(struct sock *ssk)\n--\nnet/mptcp/protocol.c-4079-\t\t/* In case of later failures, __mptcp_flush_join_list() will\nnet/mptcp/protocol.c:4080:\t\t * properly orphan the ssk via mptcp_close_ssk().\nnet/mptcp/protocol.c-4081-\t\t */\n--\nnet/mptcp/protocol.c=4104=static int mptcp_ioctl_outq(const struct mptcp_sock *msk, u64 v)\n--\nnet/mptcp/protocol.c-4119-\t\t/* the first subflow is disconnected after close - see\nnet/mptcp/protocol.c:4120:\t\t * __mptcp_close_ssk(). tcp_disconnect() moves the write_seq\nnet/mptcp/protocol.c-4121-\t\t * so ignore that status, too.\n--\nnet/mptcp/protocol.c=4416=static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,\n--\nnet/mptcp/protocol.c-4472-\t\t\t\tmptcp_set_state(newsk, TCP_CLOSE);\nnet/mptcp/protocol.c:4473:\t\t\tmptcp_close_ssk(newsk, msk-\u003efirst,\nnet/mptcp/protocol.c-4474-\t\t\t\t\tmptcp_subflow_ctx(msk-\u003efirst));\n--\nnet/mptcp/protocol.h=717=static inline void mptcp_borrow_fwdmem(struct sock *sk, struct sk_buff *skb)\n--\nnet/mptcp/protocol.h-721-\t/* The subflow just lend the skb fwd memory; if the subflow meanwhile\nnet/mptcp/protocol.h:722:\t * closed, mptcp_close_ssk() already released the ssk rcv memory.\nnet/mptcp/protocol.h-723-\t */\n--\nnet/mptcp/protocol.h=838=void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);\nnet/mptcp/protocol.h:839:void mptcp_close_ssk(struct sock *sk, struct sock *ssk,\nnet/mptcp/protocol.h-840-\t\t struct mptcp_subflow_context *subflow);\n--\nnet/mptcp/subflow.c=1920=static void subflow_state_change(struct sock *sk)\n--\nnet/mptcp/subflow.c-1927-\t/* Rx queue processing is unneeded, error reporting will take place at\nnet/mptcp/subflow.c:1928:\t * __mptcp_close_ssk() time and subflow reset can't happen in case of\nnet/mptcp/subflow.c-1929-\t * fallback: subflow_sched_work_if_closed() would be a no-op.\n--\nnet/mptcp/subflow.c=2062=static void subflow_ulp_release(struct sock *ssk)\n--\nnet/mptcp/subflow.c-2073-\t\t/* if the msk has been orphaned, keep the ctx\nnet/mptcp/subflow.c:2074:\t\t * alive, will be freed by __mptcp_close_ssk(),\nnet/mptcp/subflow.c-2075-\t\t * when the subflow is still unaccepted\n"
} |
| 27/2 | 2026/11/04 23:31 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22125 output: 249 thoughts: 1669 Thoughts: **Analysis of Patch for Network Protocol Handling** Okay, let's break this down. My initial thought is to identify the critical functions and configurations altered by this patch, ensuring we can provide the fuzzer with the right information. First, I see that `mptcp_subflow_shutdown` and `__mptcp_subflow_disconnect` are involved, specifically related to closing subflows, which likely touches MPTCP behavior. `tcp_v6_disconnect` is the new handler for IPv6 sockets, indicating a change in IPv6 TCP connection teardown. Also, `tcp_v6_connect` is relevant since `tcp_v6_restore_af_ops` is called within it on connection failures. And, `tcp_v4_do_rcv` has a new protocol check, suggesting modifications in receiving packets. Now, let's confirm the files impacted: `net/ipv4/tcp_ipv4.c`, `net/ipv6/tcp_ipv6.c`, and `net/mptcp/protocol.c`. That confirms the focus is on v4, v6 and MPTCP. The critical symbols seem to be: `tcp_v6_disconnect`, `tcp_v6_restore_af_ops`, `tcp_v4_do_rcv`, `__mptcp_subflow_disconnect`, and `mptcp_subflow_shutdown`. However, before including `tcp_v4_do_rcv`, I need to confirm whether it is suitable as a `FocusSymbol`. The instructions are clear: avoid ubiquitous, hot-path functions. This means avoiding the common functions which are called by almost every program. So, functions like `kmalloc`, `kfree`, or `mutex_lock` are out. But, `tcp_v4_do_rcv` *was* directly modified and the protocol mismatch check is now there. Therefore, `tcp_v4_do_rcv` is directly related to the change, and makes sense to include it. Now, let's review what is directly altered: `tcp_v6_disconnect` and `tcp_v6_restore_af_ops`. Also, `tcp_v6_connect` which calls `tcp_v6_restore_af_ops` on error. Then `mptcp_subflow_shutdown` and `__mptcp_subflow_disconnect` which have altered calls. A key point is checking if `tcp_v6_restore_af_ops` and `__mptcp_subflow_disconnect` are static and inlined. If inlined, they may not have distinct symbol addresses, and syzkaller will need distinct symbol coverage. However, `tcp_v6_disconnect` and `tcp_v6_connect` call `tcp_v6_restore_af_ops` and are non-static. The callers of `__mptcp_subflow_disconnect` are `__mptcp_close_ssk` and `mptcp_close_ssk`. And, `mptcp_subflow_shutdown` is non-static. Finally, the required configurations: `INET`, `IPV6`, `MPTCP`, and `MPTCP_IPV6`. I'll double-check to be sure, in `net/ipv6/tcp_ipv6.c` the `CONFIG_TCP_MD5SIG` and `CONFIG_TCP_AO` are optional, not core. Also in `net/mptcp/Kconfig`, it confirms that `MPTCP` needs `INET` and `MPTCP_IPV6` needs `IPV6=y`. Therefore, the `set-results` parameters are as follows: * `WorthFuzzing`: `true` * `FocusSymbols`: `tcp_v6_disconnect`, `tcp_v6_restore_af_ops`, `tcp_v6_connect`, `tcp_v4_do_rcv`, `__mptcp_subflow_disconnect`, `mptcp_subflow_shutdown`, `mptcp_close_ssk` * `EnableConfigs`: `INET`, `IPV6`, `MPTCP`, `MPTCP_IPV6` * `Reasoning`: This patch addresses protocol handling and `af_ops` restoration when disconnecting v4-mapped IPv6 TCP sockets and MPTCP subflows, modifying reachable core networking code in TCP and MPTCP. Ready to invoke `set-results`. |
| 28/2 | 2026/11/04 23:32 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"INET",
"IPV6",
"MPTCP",
"MPTCP_IPV6"
],
"FocusSymbols": [
"tcp_v6_disconnect",
"tcp_v6_restore_af_ops",
"tcp_v6_connect",
"tcp_v4_do_rcv",
"__mptcp_subflow_disconnect",
"mptcp_subflow_shutdown",
"mptcp_close_ssk"
],
"Reasoning": "The patch modifies core TCP IPv4, IPv6, and MPTCP networking code. Specifically, it introduces tcp_v6_disconnect to properly restore IPv6 af_ops and backlog handler when disconnecting IPv4-mapped IPv6 sockets, checks for invalid protocol packets in tcp_v4_do_rcv, and updates MPTCP subflow disconnect/shutdown logic to invoke protocol-specific disconnect callbacks instead of hardcoded tcp_disconnect. This reachable code path can be exercised via socket API calls (connect, disconnect, listen, and MPTCP subflow management) and warrants fuzzing.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"INET",
"IPV6",
"MPTCP",
"MPTCP_IPV6"
],
"FocusSymbols": [
"tcp_v6_disconnect",
"tcp_v6_restore_af_ops",
"tcp_v6_connect",
"tcp_v4_do_rcv",
"__mptcp_subflow_disconnect",
"mptcp_subflow_shutdown",
"mptcp_close_ssk"
],
"Reasoning": "The patch modifies core TCP IPv4, IPv6, and MPTCP networking code. Specifically, it introduces tcp_v6_disconnect to properly restore IPv6 af_ops and backlog handler when disconnecting IPv4-mapped IPv6 sockets, checks for invalid protocol packets in tcp_v4_do_rcv, and updates MPTCP subflow disconnect/shutdown logic to invoke protocol-specific disconnect callbacks instead of hardcoded tcp_disconnect. This reachable code path can be exercised via socket API calls (connect, disconnect, listen, and MPTCP subflow management) and warrants fuzzing.",
"WorthFuzzing": true
} |
| 29/1 | 2026/11/04 23:32 | action | If |
2mArgs:{
"WorthFuzzing": true
}Results: null |
| 30/2 | 2026/11/04 23:32 | agent | kmsan-evaluator |
2mModel:core Args: null Results: {
"KMSANReasoning": "The patch addresses a protocol confusion issue where IPv6 sockets connected to IPv4-mapped addresses retained IPv4 operations (such as sk_backlog_rcv = tcp_v4_do_rcv and IPv4 icsk_af_ops) after disconnect. It introduces tcp_v6_restore_af_ops() to reset these handlers back to IPv6 during tcp_v6_disconnect(), updates MPTCP to call the polymorphic ssk-\u003esk_prot-\u003edisconnect(), and adds an skb-\u003eprotocol sanity check in tcp_v4_do_rcv().\n\nNo memory allocations are introduced or altered on the stack or heap, no data is copied to user space, and no branching depends on uninitialized data. Any protocol confusion bugs or improper packet handling leading to out-of-bounds reads or invalid state transitions are covered by KASAN and kernel assertions. Therefore, this patch poses no uninitialized memory or info-leak risks, and a dedicated KMSAN fuzzing session is not needed.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit efa149f8ce29656fc2a4dcf0d119efed7642880f
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Nov 4 23:18:01 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a7f9242f1e4290..8fa6564d2b6029 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1836,6 +1836,11 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
{
enum skb_drop_reason reason;
+ if (unlikely(skb->protocol != htons(ETH_P_IP))) {
+ reason = SKB_DROP_REASON_INVALID_PROTO;
+ goto err_discard;
+ }
+
reason = psp_sk_rx_policy_check(sk, skb);
if (reason)
goto err_discard;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e006a30360eae1..a93410aab66e6f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -130,6 +130,19 @@ static int tcp_v6_pre_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
return BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr, &addr_len);
}
+/* Undo the v4-mapped setup done by tcp_v6_connect(). */
+static void tcp_v6_restore_af_ops(struct sock *sk)
+{
+ /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
+ WRITE_ONCE(inet_csk(sk)->icsk_af_ops, &ipv6_specific);
+ if (sk_is_mptcp(sk))
+ mptcpv6_handle_mapped(sk, false);
+ sk->sk_backlog_rcv = tcp_v6_do_rcv;
+#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)
+ tcp_sk(sk)->af_specific = &tcp_sock_ipv6_specific;
+#endif
+}
+
static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
int addr_len)
{
@@ -243,14 +256,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr_unsized *uaddr,
if (err) {
icsk->icsk_ext_hdr_len = exthdrlen;
- /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
- WRITE_ONCE(icsk->icsk_af_ops, &ipv6_specific);
- if (sk_is_mptcp(sk))
- mptcpv6_handle_mapped(sk, false);
- sk->sk_backlog_rcv = tcp_v6_do_rcv;
-#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)
- tp->af_specific = &tcp_sock_ipv6_specific;
-#endif
+ tcp_v6_restore_af_ops(sk);
goto failure;
}
np->saddr = sk->sk_v6_rcv_saddr;
@@ -2093,6 +2099,19 @@ static int tcp_v6_init_sock(struct sock *sk)
return 0;
}
+static int tcp_v6_disconnect(struct sock *sk, int flags)
+{
+ int ret = tcp_disconnect(sk, flags);
+
+ /* A socket used for a v4-mapped connection must not keep IPv4
+ * handlers when it is reused for listen() or a native IPv6 connect().
+ */
+ if (sk->sk_backlog_rcv == tcp_v4_do_rcv)
+ tcp_v6_restore_af_ops(sk);
+
+ return ret;
+}
+
#ifdef CONFIG_PROC_FS
/* Proc filesystem TCPv6 sock list dumping. */
static void get_openreq6(struct seq_file *seq,
@@ -2283,7 +2302,7 @@ struct proto tcpv6_prot = {
.close = tcp_close,
.pre_connect = tcp_v6_pre_connect,
.connect = tcp_v6_connect,
- .disconnect = tcp_disconnect,
+ .disconnect = tcp_v6_disconnect,
.accept = inet_csk_accept,
.ioctl = tcp_ioctl,
.init = tcp_v6_init_sock,
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7a22e9388e0e9a..fdfbc7de2ec036 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2608,7 +2608,7 @@ static void __mptcp_subflow_disconnect(struct sock *ssk,
/* The MPTCP code never wait on the subflow sockets, TCP-level
* disconnect should never fail
*/
- WARN_ON_ONCE(tcp_disconnect(ssk, 0));
+ WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, 0));
mptcp_subflow_ctx_reset(subflow);
} else {
tcp_shutdown(ssk, SEND_SHUTDOWN);
@@ -3287,7 +3287,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
break;
fallthrough;
case TCP_SYN_SENT:
- WARN_ON_ONCE(tcp_disconnect(ssk, O_NONBLOCK));
+ WARN_ON_ONCE(ssk->sk_prot->disconnect(ssk, O_NONBLOCK));
break;
default:
if (__mptcp_check_fallback(mptcp_sk(sk))) {
|
| 31/3 | 2026/11/04 23:32 | llm | kmsan-evaluator |
2mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 3641 output: 40 thoughts: 1043 Thoughts: **Analyzing the Kernel Patch for KMSAN Fuzzing Potential** Okay, let's break this down. My goal is to determine if this patch warrants a dedicated KMSAN fuzzing session. It's a network-related patch, so that's already a point in its favor. First, I see a new check in `tcp_v4_do_rcv` in `net/ipv4/tcp_ipv4.c`. It's now explicitly verifying that `skb->protocol` is `ETH_P_IP`. Good, that's a sanity check against protocol confusion. This is a crucial defense against unexpected packets. Then, the IPv6 side is interesting. The patch introduces `tcp_v6_restore_af_ops` and modifies `tcp_v6_disconnect`. This suggests that, under certain circumstances, an IPv6 socket can end up in a state where it's mistakenly using IPv4 handlers. Specifically, when an IPv6 socket connects to an IPv4-mapped address and is later disconnected or reused. If that happened, an IPv6 packet might be handled by IPv4 code. This sounds like the type of memory corruption or type confusion vulnerability I might be looking for! The changes to `tcp_v6_disconnect` and the addition of `tcp_v6_restore_af_ops` are clearly meant to correct this. The `mptcp` change to use `sk->sk_prot->disconnect` is a refactoring, and potentially important as it might have inadvertently exposed an issue during a connection teardown that this patch also addresses. So, the issue is that IPv6 sockets, *after* using an IPv4-mapped address, can end up with incorrect protocol handlers, specifically `tcp_v4_do_rcv`, and therefore vulnerable to protocol confusion. The code attempts to fix this by restoring IPv6 handlers after a disconnect if the socket was previously used for IPv4-mapped connections. I want to investigate how an IPv6 packet would be incorrectly processed by `tcp_v4_do_rcv`. If it makes the bad assumption of `ip_hdr(skb)` on an IPv6 packet, we're likely looking at a memory access vulnerability, which KMSAN should be good at detecting. The newly added check `skb->protocol != htons(ETH_P_IP)` could now prevent the confusion. However, I want to investigate the potential impact of this check on an IPv6 skb. Specifically, I'm thinking of a malformed IPv6 header. A KMSAN session is definitely worth the effort. I'll need to craft a test case that triggers this IPv4-mapped address scenario and then tries to inject IPv6 traffic. I will also have to create a test for the `mptcp` changes, as the potential exposure could be quite large. |
| 32/3 | 2026/11/04 23:34 | tool | read-file |
0mArgs:{
"File": "net/ipv4/tcp_ipv4.c",
"FirstLine": 1830,
"LineCount": 40
}Results: {
"Contents": "1830:\t * We have a potential double-lock case here, so even when\n1831:\t * doing backlog processing we use the BH locking scheme.\n1832:\t * This is because we cannot sleep with the original spinlock\n1833:\t * held.\n1834:\t */\n1835:\tint tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)\n1836:\t{\n1837:\t\tenum skb_drop_reason reason;\n1838:\t\n1839:\t\tif (unlikely(skb-\u003eprotocol != htons(ETH_P_IP))) {\n1840:\t\t\treason = SKB_DROP_REASON_INVALID_PROTO;\n1841:\t\t\tgoto err_discard;\n1842:\t\t}\n1843:\t\n1844:\t\treason = psp_sk_rx_policy_check(sk, skb);\n1845:\t\tif (reason)\n1846:\t\t\tgoto err_discard;\n1847:\t\n1848:\t\tif (sk-\u003esk_state == TCP_ESTABLISHED) { /* Fast path */\n1849:\t\t\tstruct dst_entry *dst;\n1850:\t\n1851:\t\t\tdst = rcu_dereference_protected(sk-\u003esk_rx_dst,\n1852:\t\t\t\t\t\t\tlockdep_sock_is_held(sk));\n1853:\t\n1854:\t\t\tsock_rps_save_rxhash(sk, skb);\n1855:\t\t\tsk_mark_napi_id(sk, skb);\n1856:\t\t\tif (dst \u0026\u0026 unlikely(dst != skb_dst(skb))) {\n1857:\t\t\t\tif (sk-\u003esk_rx_dst_ifindex != skb-\u003eskb_iif ||\n1858:\t\t\t\t !INDIRECT_CALL_1(dst-\u003eops-\u003echeck, ipv4_dst_check,\n1859:\t\t\t\t\t\t dst, 0)) {\n1860:\t\t\t\t\tRCU_INIT_POINTER(sk-\u003esk_rx_dst, NULL);\n1861:\t\t\t\t\tdst_release(dst);\n1862:\t\t\t\t}\n1863:\t\t\t}\n1864:\t\t\ttcp_rcv_established(sk, skb);\n1865:\t\t\treturn 0;\n1866:\t\t}\n1867:\t\n1868:\t\tif (tcp_checksum_complete(skb))\n1869:\t\t\tgoto csum_err;\n"
} |
| 33/3 | 2026/11/04 23:34 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 5968 output: 236 thoughts: 1325 Thoughts: **KMSAN Evaluation: No Need for Dedicated Fuzzing**
Alright, let's break this down. My primary concern here is determining if this patch necessitates a KMSAN run, and I'm leaning heavily towards "no". First, I need to evaluate this from the perspective of potential KMSAN-specific issues.
The changes themselves are focused on correcting a socket protocol confusion bug. Specifically, we're fixing a scenario where an IPv6 socket, after connecting to a v4-mapped address and disconnecting, could retain IPv4 callbacks. Subsequently, if reused, the incoming IPv6 traffic might be handled by IPv4 routines, leading to all sorts of nasty consequences: bad casts, out-of-bounds reads, incorrect packet processing, the usual memory corruption suspects.
My first check is to determine if any uninitialized memory concerns exist. I have considered a series of concerns:
1. **Does it touch user/kernel boundary?**
It seems that there are no interactions with `copy_to_user`, `put_user`, netlink messages, or ioctl outputs.
2. **Does the patch depend on uninitialized variables or struct fields?**
It relies on an `skb->protocol` check, which is always initialized by network stack upon packet reception. `sk->sk_backlog_rcv` is always initialized by `sk` creation/connection routines.
3. **Are new allocations introduced, or complex uninitialized data structures used?**
There are no new allocations nor any modification to existing ones.
4. **Are existing buffers accessed in ways that could expose uninitialized data?**
The code adds a protocol validation check, restores socket callbacks on disconnect, and calls virtualized disconnect routines. Pointers and structures being utilized are statically initialized.
This patch simply resets the socket callbacks back to IPv6 and checks the `skb->protocol` in `tcp_v4_do_rcv`. Crucially, this isn't introducing a new pathway for uninitialized memory use or info-leaks, KMSAN's specialty. We're talking about restoring the correct state, not introducing a new error.
Now, let's contrast this with KASAN and the standard bug detectors. The potential issues here – the type mismatches, the incorrect casts, the out-of-bounds accesses – they all fall squarely into the domain of what KASAN, LOCKDEP, and other existing kernel bug detectors are designed to catch. We're essentially dealing with the standard vulnerabilities that these tools are very good at identifying.
The patch includes the following changes:
* Validates the `skb->protocol` in `tcp_v4_do_rcv`.
* Introduces `tcp_v6_restore_af_ops()` to restore IPv6 operations on IPv6 sockets that have previously connected to IPv4-mapped addresses.
* Implements `tcp_v6_disconnect()` to call `tcp_v6_restore_af_ops()` upon disconnection.
* Updates MPTCP disconnect calls to invoke `ssk->sk_prot->disconnect()` dynamically.
Given the nature of the changes – protocol handler restoration, protocol validation – and considering the lack of any introduction of uninitialized memory risks, a dedicated KMSAN fuzzing session is not only unwarranted but also an inefficient use of resources. This is firmly a KASAN issue, if it's an issue at all. My analysis is complete.
|
| 34/3 | 2026/11/04 23:35 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch addresses a protocol confusion issue where IPv6 sockets connected to IPv4-mapped addresses retained IPv4 operations (such as sk_backlog_rcv = tcp_v4_do_rcv and IPv4 icsk_af_ops) after disconnect. It introduces tcp_v6_restore_af_ops() to reset these handlers back to IPv6 during tcp_v6_disconnect(), updates MPTCP to call the polymorphic ssk-\u003esk_prot-\u003edisconnect(), and adds an skb-\u003eprotocol sanity check in tcp_v4_do_rcv().\n\nNo memory allocations are introduced or altered on the stack or heap, no data is copied to user space, and no branching depends on uninitialized data. Any protocol confusion bugs or improper packet handling leading to out-of-bounds reads or invalid state transitions are covered by KASAN and kernel assertions. Therefore, this patch poses no uninitialized memory or info-leak risks, and a dedicated KMSAN fuzzing session is not needed.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch addresses a protocol confusion issue where IPv6 sockets connected to IPv4-mapped addresses retained IPv4 operations (such as sk_backlog_rcv = tcp_v4_do_rcv and IPv4 icsk_af_ops) after disconnect. It introduces tcp_v6_restore_af_ops() to reset these handlers back to IPv6 during tcp_v6_disconnect(), updates MPTCP to call the polymorphic ssk-\u003esk_prot-\u003edisconnect(), and adds an skb-\u003eprotocol sanity check in tcp_v4_do_rcv().\n\nNo memory allocations are introduced or altered on the stack or heap, no data is copied to user space, and no branching depends on uninitialized data. Any protocol confusion bugs or improper packet handling leading to out-of-bounds reads or invalid state transitions are covered by KASAN and kernel assertions. Therefore, this patch poses no uninitialized memory or info-leak risks, and a dedicated KMSAN fuzzing session is not needed.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|