| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/22 16:57 | flow | patch-triage |
4mArgs:null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_STREAM_PARSER",
"NET",
"INET",
"CGROUP_BPF"
],
"FocusSymbols": [
"sk_psock_start_strp",
"sk_psock_stop_strp",
"sk_psock_start_verdict",
"sk_psock_stop_verdict",
"sk_psock_drop",
"sock_map_del_link",
"sock_map_init_proto",
"sock_map_link",
"sock_map_update_elem_sys"
],
"KMSANReasoning": "The patch introduces READ_ONCE and WRITE_ONCE annotations to prevent compiler reordering and data races when accessing function pointers (such as `sk-\u003esk_prot`, `psock-\u003esaved_data_ready`, and `psock-\u003epsock_update_sk_prot`) in skmsg and sock_map. All newly introduced local variables are immediately initialized via READ_ONCE before being checked or invoked. The patch does not touch any data copying to userspace (no info-leaks), does not alter buffer allocations, sizes, or bounds, and introduces no risk of accessing uninitialized memory. Any concurrency issues, races, or invalid pointer dereferences are under the scope of KCSAN/KASAN, making a dedicated KMSAN fuzzing session unnecessary.",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies BPF sockmap and skmsg handling by introducing READ_ONCE/WRITE_ONCE memory ordering primitives around psock proto update callbacks (psock_update_sk_prot), data_ready callbacks (saved_data_ready), and protocol structure references (sk-\u003esk_prot) across skmsg and sockmap setup/teardown paths. These paths are reachable from userspace via BPF sockmap syscall operations and socket events, where concurrent socket updates and closures have historically been prone to race conditions and lifetime issues. Therefore, this warrants fuzzing.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/22 16:57 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 2f5a3ff7ad7529fe5574fc99ced96d2895c5e087\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Oct 22 16:57:46 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/skmsg.h b/include/linux/skmsg.h\nindex d5e35f24738d5..cb17426f63beb 100644\n--- a/include/linux/skmsg.h\n+++ b/include/linux/skmsg.h\n@@ -488,8 +488,11 @@ static inline void sk_psock_cork_free(struct sk_psock *psock)\n static inline void sk_psock_restore_proto(struct sock *sk,\n \t\t\t\t\t struct sk_psock *psock)\n {\n-\tif (psock-\u003epsock_update_sk_prot)\n-\t\tpsock-\u003epsock_update_sk_prot(sk, psock, true);\n+\tint (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);\n+\n+\tupdate_proto = READ_ONCE(psock-\u003epsock_update_sk_prot);\n+\tif (update_proto)\n+\t\tupdate_proto(sk, psock, true);\n }\n \n static inline struct sk_psock *sk_psock_get(struct sock *sk)\ndiff --git a/net/core/skmsg.c b/net/core/skmsg.c\nindex df385a5a961e8..54d832039f094 100644\n--- a/net/core/skmsg.c\n+++ b/net/core/skmsg.c\n@@ -1167,22 +1167,25 @@ int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock)\n \n void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)\n {\n-\tif (psock-\u003esaved_data_ready)\n+\tif (READ_ONCE(psock-\u003esaved_data_ready))\n \t\treturn;\n \n-\tpsock-\u003esaved_data_ready = sk-\u003esk_data_ready;\n+\tWRITE_ONCE(psock-\u003esaved_data_ready, READ_ONCE(sk-\u003esk_data_ready));\n \tWRITE_ONCE(sk-\u003esk_data_ready, sk_psock_strp_data_ready);\n \tWRITE_ONCE(sk-\u003esk_write_space, sk_psock_write_space);\n }\n \n void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)\n {\n+\tvoid (*saved_data_ready)(struct sock *sk);\n+\n \tpsock_set_prog(\u0026psock-\u003eprogs.stream_parser, NULL);\n \n-\tif (!psock-\u003esaved_data_ready)\n+\tsaved_data_ready = READ_ONCE(psock-\u003esaved_data_ready);\n+\tif (!saved_data_ready)\n \t\treturn;\n \n-\tWRITE_ONCE(sk-\u003esk_data_ready, psock-\u003esaved_data_ready);\n+\tWRITE_ONCE(sk-\u003esk_data_ready, saved_data_ready);\n \tWRITE_ONCE(psock-\u003esaved_data_ready, NULL);\n \tstrp_stop(\u0026psock-\u003estrp);\n }\n@@ -1260,22 +1263,25 @@ static void sk_psock_verdict_data_ready(struct sock *sk)\n \n void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock)\n {\n-\tif (psock-\u003esaved_data_ready)\n+\tif (READ_ONCE(psock-\u003esaved_data_ready))\n \t\treturn;\n \n-\tpsock-\u003esaved_data_ready = sk-\u003esk_data_ready;\n+\tWRITE_ONCE(psock-\u003esaved_data_ready, READ_ONCE(sk-\u003esk_data_ready));\n \tWRITE_ONCE(sk-\u003esk_data_ready, sk_psock_verdict_data_ready);\n \tWRITE_ONCE(sk-\u003esk_write_space, sk_psock_write_space);\n }\n \n void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)\n {\n+\tvoid (*saved_data_ready)(struct sock *sk);\n+\n \tpsock_set_prog(\u0026psock-\u003eprogs.stream_verdict, NULL);\n \tpsock_set_prog(\u0026psock-\u003eprogs.skb_verdict, NULL);\n \n-\tif (!psock-\u003esaved_data_ready)\n+\tsaved_data_ready = READ_ONCE(psock-\u003esaved_data_ready);\n+\tif (!saved_data_ready)\n \t\treturn;\n \n-\tWRITE_ONCE(sk-\u003esk_data_ready, psock-\u003esaved_data_ready);\n-\tpsock-\u003esaved_data_ready = NULL;\n+\tWRITE_ONCE(sk-\u003esk_data_ready, saved_data_ready);\n+\tWRITE_ONCE(psock-\u003esaved_data_ready, NULL);\n }\ndiff --git a/net/core/sock_map.c b/net/core/sock_map.c\nindex 38df842843289..4dc69316ac170 100644\n--- a/net/core/sock_map.c\n+++ b/net/core/sock_map.c\n@@ -145,6 +145,7 @@ static void sock_map_del_link(struct sock *sk,\n {\n \tbool strp_stop = false, verdict_stop = false;\n \tstruct sk_psock_link *link, *tmp;\n+\tint (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);\n \n \tspin_lock_bh(\u0026psock-\u003elink_lock);\n \tlist_for_each_entry_safe(link, tmp, \u0026psock-\u003elink, list) {\n@@ -152,11 +153,11 @@ static void sock_map_del_link(struct sock *sk,\n \t\t\tstruct bpf_map *map = link-\u003emap;\n \t\t\tstruct sk_psock_progs *progs = sock_map_progs(map);\n \n-\t\t\tif (psock-\u003esaved_data_ready \u0026\u0026 progs-\u003estream_parser)\n+\t\t\tif (READ_ONCE(psock-\u003esaved_data_ready) \u0026\u0026 progs-\u003estream_parser)\n \t\t\t\tstrp_stop = true;\n-\t\t\tif (psock-\u003esaved_data_ready \u0026\u0026 progs-\u003estream_verdict)\n+\t\t\tif (READ_ONCE(psock-\u003esaved_data_ready) \u0026\u0026 progs-\u003estream_verdict)\n \t\t\t\tverdict_stop = true;\n-\t\t\tif (psock-\u003esaved_data_ready \u0026\u0026 progs-\u003eskb_verdict)\n+\t\t\tif (READ_ONCE(psock-\u003esaved_data_ready) \u0026\u0026 progs-\u003eskb_verdict)\n \t\t\t\tverdict_stop = true;\n \t\t\tlist_del(\u0026link-\u003elist);\n \t\t\tsk_psock_free_link(link);\n@@ -171,8 +172,9 @@ static void sock_map_del_link(struct sock *sk,\n \t\tif (verdict_stop)\n \t\t\tsk_psock_stop_verdict(sk, psock);\n \n-\t\tif (psock-\u003epsock_update_sk_prot)\n-\t\t\tpsock-\u003epsock_update_sk_prot(sk, psock, false);\n+\t\tupdate_proto = READ_ONCE(psock-\u003epsock_update_sk_prot);\n+\t\tif (update_proto)\n+\t\t\tupdate_proto(sk, psock, false);\n \t\twrite_unlock_bh(\u0026sk-\u003esk_callback_lock);\n \t}\n }\n@@ -189,10 +191,13 @@ static void sock_map_unref(struct sock *sk, void *link_raw)\n \n static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)\n {\n-\tif (!sk-\u003esk_prot-\u003epsock_update_sk_prot)\n+\tint (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);\n+\n+\tupdate_proto = READ_ONCE(sk-\u003esk_prot)-\u003epsock_update_sk_prot;\n+\tif (!update_proto)\n \t\treturn -EINVAL;\n-\tpsock-\u003epsock_update_sk_prot = sk-\u003esk_prot-\u003epsock_update_sk_prot;\n-\treturn sk-\u003esk_prot-\u003epsock_update_sk_prot(sk, psock, false);\n+\tWRITE_ONCE(psock-\u003epsock_update_sk_prot, update_proto);\n+\treturn update_proto(sk, psock, false);\n }\n \n static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)\n@@ -202,7 +207,7 @@ static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)\n \trcu_read_lock();\n \tpsock = sk_psock(sk);\n \tif (psock) {\n-\t\tif (sk-\u003esk_prot-\u003eclose != sock_map_close) {\n+\t\tif (READ_ONCE(sk-\u003esk_prot)-\u003eclose != sock_map_close) {\n \t\t\tpsock = ERR_PTR(-EBUSY);\n \t\t\tgoto out;\n \t\t}\n@@ -303,7 +308,8 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)\n \t}\n \n \twrite_lock_bh(\u0026sk-\u003esk_callback_lock);\n-\tif (stream_parser \u0026\u0026 stream_verdict \u0026\u0026 !psock-\u003esaved_data_ready) {\n+\tif (stream_parser \u0026\u0026 stream_verdict \u0026\u0026\n+\t !READ_ONCE(psock-\u003esaved_data_ready)) {\n \t\tif (sk_is_tcp(sk))\n \t\t\tret = sk_psock_init_strp(sk, psock);\n \t\telse\n@@ -314,9 +320,11 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)\n \t\t\tgoto out;\n \t\t}\n \t\tsk_psock_start_strp(sk, psock);\n-\t} else if (!stream_parser \u0026\u0026 stream_verdict \u0026\u0026 !psock-\u003esaved_data_ready) {\n+\t} else if (!stream_parser \u0026\u0026 stream_verdict \u0026\u0026\n+\t\t !READ_ONCE(psock-\u003esaved_data_ready)) {\n \t\tsk_psock_start_verdict(sk,psock);\n-\t} else if (!stream_verdict \u0026\u0026 skb_verdict \u0026\u0026 !psock-\u003esaved_data_ready) {\n+\t} else if (!stream_verdict \u0026\u0026 skb_verdict \u0026\u0026\n+\t\t !READ_ONCE(psock-\u003esaved_data_ready)) {\n \t\tsk_psock_start_verdict(sk, psock);\n \t}\n \twrite_unlock_bh(\u0026sk-\u003esk_callback_lock);\n@@ -536,7 +544,7 @@ static bool sock_map_redirect_allowed(const struct sock *sk)\n \n static bool sock_map_sk_is_suitable(const struct sock *sk)\n {\n-\treturn !!sk-\u003esk_prot-\u003epsock_update_sk_prot;\n+\treturn !!READ_ONCE(sk-\u003esk_prot)-\u003epsock_update_sk_prot;\n }\n \n static bool sock_map_sk_state_allowed(const struct sock *sk)\n"
} |
| 2/1 | 2026/10/22 16:57 | agent | patch-evaluator |
4mModel:core Args: null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_STREAM_PARSER",
"NET",
"INET",
"CGROUP_BPF"
],
"FocusSymbols": [
"sk_psock_start_strp",
"sk_psock_stop_strp",
"sk_psock_start_verdict",
"sk_psock_stop_verdict",
"sk_psock_drop",
"sock_map_del_link",
"sock_map_init_proto",
"sock_map_link",
"sock_map_update_elem_sys"
],
"Reasoning": "The patch modifies BPF sockmap and skmsg handling by introducing READ_ONCE/WRITE_ONCE memory ordering primitives around psock proto update callbacks (psock_update_sk_prot), data_ready callbacks (saved_data_ready), and protocol structure references (sk-\u003esk_prot) across skmsg and sockmap setup/teardown paths. These paths are reachable from userspace via BPF sockmap syscall operations and socket events, where concurrent socket updates and closures have historically been prone to race conditions and lifetime issues. Therefore, this 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 2f5a3ff7ad7529fe5574fc99ced96d2895c5e087
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 22 16:57:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index d5e35f24738d5..cb17426f63beb 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -488,8 +488,11 @@ static inline void sk_psock_cork_free(struct sk_psock *psock)
static inline void sk_psock_restore_proto(struct sock *sk,
struct sk_psock *psock)
{
- if (psock->psock_update_sk_prot)
- psock->psock_update_sk_prot(sk, psock, true);
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
+
+ update_proto = READ_ONCE(psock->psock_update_sk_prot);
+ if (update_proto)
+ update_proto(sk, psock, true);
}
static inline struct sk_psock *sk_psock_get(struct sock *sk)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index df385a5a961e8..54d832039f094 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1167,22 +1167,25 @@ int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock)
void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)
{
- if (psock->saved_data_ready)
+ if (READ_ONCE(psock->saved_data_ready))
return;
- psock->saved_data_ready = sk->sk_data_ready;
+ WRITE_ONCE(psock->saved_data_ready, READ_ONCE(sk->sk_data_ready));
WRITE_ONCE(sk->sk_data_ready, sk_psock_strp_data_ready);
WRITE_ONCE(sk->sk_write_space, sk_psock_write_space);
}
void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)
{
+ void (*saved_data_ready)(struct sock *sk);
+
psock_set_prog(&psock->progs.stream_parser, NULL);
- if (!psock->saved_data_ready)
+ saved_data_ready = READ_ONCE(psock->saved_data_ready);
+ if (!saved_data_ready)
return;
- WRITE_ONCE(sk->sk_data_ready, psock->saved_data_ready);
+ WRITE_ONCE(sk->sk_data_ready, saved_data_ready);
WRITE_ONCE(psock->saved_data_ready, NULL);
strp_stop(&psock->strp);
}
@@ -1260,22 +1263,25 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock)
{
- if (psock->saved_data_ready)
+ if (READ_ONCE(psock->saved_data_ready))
return;
- psock->saved_data_ready = sk->sk_data_ready;
+ WRITE_ONCE(psock->saved_data_ready, READ_ONCE(sk->sk_data_ready));
WRITE_ONCE(sk->sk_data_ready, sk_psock_verdict_data_ready);
WRITE_ONCE(sk->sk_write_space, sk_psock_write_space);
}
void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)
{
+ void (*saved_data_ready)(struct sock *sk);
+
psock_set_prog(&psock->progs.stream_verdict, NULL);
psock_set_prog(&psock->progs.skb_verdict, NULL);
- if (!psock->saved_data_ready)
+ saved_data_ready = READ_ONCE(psock->saved_data_ready);
+ if (!saved_data_ready)
return;
- WRITE_ONCE(sk->sk_data_ready, psock->saved_data_ready);
- psock->saved_data_ready = NULL;
+ WRITE_ONCE(sk->sk_data_ready, saved_data_ready);
+ WRITE_ONCE(psock->saved_data_ready, NULL);
}
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 38df842843289..4dc69316ac170 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -145,6 +145,7 @@ static void sock_map_del_link(struct sock *sk,
{
bool strp_stop = false, verdict_stop = false;
struct sk_psock_link *link, *tmp;
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
spin_lock_bh(&psock->link_lock);
list_for_each_entry_safe(link, tmp, &psock->link, list) {
@@ -152,11 +153,11 @@ static void sock_map_del_link(struct sock *sk,
struct bpf_map *map = link->map;
struct sk_psock_progs *progs = sock_map_progs(map);
- if (psock->saved_data_ready && progs->stream_parser)
+ if (READ_ONCE(psock->saved_data_ready) && progs->stream_parser)
strp_stop = true;
- if (psock->saved_data_ready && progs->stream_verdict)
+ if (READ_ONCE(psock->saved_data_ready) && progs->stream_verdict)
verdict_stop = true;
- if (psock->saved_data_ready && progs->skb_verdict)
+ if (READ_ONCE(psock->saved_data_ready) && progs->skb_verdict)
verdict_stop = true;
list_del(&link->list);
sk_psock_free_link(link);
@@ -171,8 +172,9 @@ static void sock_map_del_link(struct sock *sk,
if (verdict_stop)
sk_psock_stop_verdict(sk, psock);
- if (psock->psock_update_sk_prot)
- psock->psock_update_sk_prot(sk, psock, false);
+ update_proto = READ_ONCE(psock->psock_update_sk_prot);
+ if (update_proto)
+ update_proto(sk, psock, false);
write_unlock_bh(&sk->sk_callback_lock);
}
}
@@ -189,10 +191,13 @@ static void sock_map_unref(struct sock *sk, void *link_raw)
static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)
{
- if (!sk->sk_prot->psock_update_sk_prot)
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
+
+ update_proto = READ_ONCE(sk->sk_prot)->psock_update_sk_prot;
+ if (!update_proto)
return -EINVAL;
- psock->psock_update_sk_prot = sk->sk_prot->psock_update_sk_prot;
- return sk->sk_prot->psock_update_sk_prot(sk, psock, false);
+ WRITE_ONCE(psock->psock_update_sk_prot, update_proto);
+ return update_proto(sk, psock, false);
}
static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)
@@ -202,7 +207,7 @@ static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)
rcu_read_lock();
psock = sk_psock(sk);
if (psock) {
- if (sk->sk_prot->close != sock_map_close) {
+ if (READ_ONCE(sk->sk_prot)->close != sock_map_close) {
psock = ERR_PTR(-EBUSY);
goto out;
}
@@ -303,7 +308,8 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
}
write_lock_bh(&sk->sk_callback_lock);
- if (stream_parser && stream_verdict && !psock->saved_data_ready) {
+ if (stream_parser && stream_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
if (sk_is_tcp(sk))
ret = sk_psock_init_strp(sk, psock);
else
@@ -314,9 +320,11 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
goto out;
}
sk_psock_start_strp(sk, psock);
- } else if (!stream_parser && stream_verdict && !psock->saved_data_ready) {
+ } else if (!stream_parser && stream_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
sk_psock_start_verdict(sk,psock);
- } else if (!stream_verdict && skb_verdict && !psock->saved_data_ready) {
+ } else if (!stream_verdict && skb_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
sk_psock_start_verdict(sk, psock);
}
write_unlock_bh(&sk->sk_callback_lock);
@@ -536,7 +544,7 @@ static bool sock_map_redirect_allowed(const struct sock *sk)
static bool sock_map_sk_is_suitable(const struct sock *sk)
{
- return !!sk->sk_prot->psock_update_sk_prot;
+ return !!READ_ONCE(sk->sk_prot)->psock_update_sk_prot;
}
static bool sock_map_sk_state_allowed(const struct sock *sk)
|
| 3/2 | 2026/10/22 16:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 5665 output: 36 thoughts: 522 Thoughts: **Analyzing a Network Patch for Fuzzing Potential** Okay, let's break this down. My initial assessment is: is this patch fuzzable, what are the relevant configurations, and which symbols are key? The patch touches `include/linux/skmsg.h`, `net/core/skmsg.c`, and `net/core/sock_map.c`. Immediately, I see this is BPF sockmap/skmsg code within the `net/core` subsystem. Excellent! Is this reachable? Absolutely. This is core networking and BPF functionality. Syzkaller and other standard BPF syscalls like `BPF_MAP_CREATE`, `BPF_MAP_UPDATE_ELEM`, and functions like `sockmap`, `sockhash` and program attachment (`BPF_SK_SKB_STREAM_PARSER`, `BPF_SK_SKB_STREAM_VERDICT`, etc.) will hit this code heavily. Now, let's apply the core philosophy for fuzzing targets: does this fit? Any modifications to BPF, core networking, and concurrency/locking are golden. Refactorings that introduce new locking/memory access patterns are interesting too. This patch adds `READ_ONCE` and `WRITE_ONCE` annotations to protect concurrent accesses to `psock->saved_data_ready`, `psock->psock_update_sk_prot`, and `sk->sk_prot` in sock_map and skmsg. Perfect. This screams race conditions related to psock lifecycle, data_ready, proto update, tear-down, close, and `sock_map_del_link`. These are well-known bug sources and a hot fuzzing target. Therefore, WorthFuzzing=true. Next, I need to know the configs. I'll grep to determine what configurations are needed to build and reach these files, specifically `net/core/skmsg.c` and `net/core/sock_map.c`. |
| 4/2 | 2026/10/22 16:58 | tool | grepper |
0mArgs:{
"Expression": "(skmsg|sock_map)\\.o",
"PathPrefixes": [
"net/core/Makefile"
]
}Results: {
"Output": "net/core/Makefile=43=obj-$(CONFIG_FAILOVER) += failover.o\nnet/core/Makefile:44:obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o\nnet/core/Makefile:45:obj-$(CONFIG_BPF_SYSCALL) += sock_map.o\nnet/core/Makefile-46-obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o\n"
} |
| 5/2 | 2026/10/22 16:58 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 6764 output: 40 thoughts: 71 Thoughts: Here's my summary, as I delve into this Makefile and related configurations: **Analyzing Network Socket Messaging and BPF System Calls** Okay, so I'm looking at `net/core/Makefile` and it's quite straightforward. I see two interesting dependencies being introduced based on configuration flags: `skmsg.o` is built if `CONFIG_NET_SOCK_MSG` is set, and `sock_map.o` is built if `CONFIG_BPF_SYSCALL` is enabled. It's standard kernel build system stuff, really. My next immediate thought is to understand *exactly* what these configuration options control. I need to refresh my memory on what `NET_SOCK_MSG` and `BPF_SYSCALL` actually *do*. I know they're related to network functionality, but the specific implications need clarification. So, I'll jump into the `Kconfig` files and locate those options. I need to understand the relationship between the options and the underlying features, so I can accurately assess the impacts. I need the big picture to really understand the implications of these dependencies in the grand scheme. |
| 6/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "config NET_SOCK_MSG",
"PathPrefixes": [
"net/Kconfig",
"net/core/Kconfig"
]
}Results: {
"Output": "net/Kconfig=475=config NET_SELFTESTS\n--\nnet/Kconfig-478-\nnet/Kconfig:479:config NET_SOCK_MSG\nnet/Kconfig-480-\tbool\n"
} |
| 7/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 7183 output: 20 thoughts: 13 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Analyzing the Selection of `NET_SOCK_MSG`** Alright, so the focus is on the selection of `NET_SOCK_MSG`. That's interesting. I immediately start running through my mental checklists. What context is driving this selection? Are we talking about a kernel module, a user-space application using a specific socket API, or something else entirely? The implication here is that someone, or some piece of code, is *choosing* this specific message type. That's the key. This isn't just a passive reception; it's an active decision. I need to quickly assess the environment. Is this related to a network stack interaction, a custom network protocol, or a more general inter-process communication scheme that leverages sockets? The level of abstraction here is critical. Where does `NET_SOCK_MSG` fit into the grand scheme of the system architecture? What level of the network stack are we at? What are the potential implications of this message type being chosen? Performance, security, reliability—all need to be considered. My mind immediately starts forming a series of questions. Who is making this selection? What alternatives were available, and why was `NET_SOCK_MSG` preferred? Were there other message types considered, and what were the trade-offs? This could be a fascinating place to dig deeper, depending on the context. I'm already formulating hypotheses about the underlying motivations and constraints that influenced this design decision. Let's dig in and figure out the *why* behind this selection! |
| 8/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "select NET_SOCK_MSG"
}Results: {
"Output": "kernel/bpf/Kconfig=27=config BPF_SYSCALL\n--\nkernel/bpf/Kconfig-33-\tselect BINARY_PRINTF\nkernel/bpf/Kconfig:34:\tselect NET_SOCK_MSG if NET\nkernel/bpf/Kconfig-35-\tselect NET_XGRESS if NET\n--\nnet/Kconfig=361=config BPF_STREAM_PARSER\n--\nnet/Kconfig-366-\tselect STREAM_PARSER\nnet/Kconfig:367:\tselect NET_SOCK_MSG\nnet/Kconfig-368-\thelp\n--\nnet/ipv4/Kconfig=382=config INET_ESPINTCP\n--\nnet/ipv4/Kconfig-385-\tselect STREAM_PARSER\nnet/ipv4/Kconfig:386:\tselect NET_SOCK_MSG\nnet/ipv4/Kconfig-387-\tselect XFRM_ESPINTCP\n--\nnet/ipv6/Kconfig=90=config INET6_ESPINTCP\n--\nnet/ipv6/Kconfig-93-\tselect STREAM_PARSER\nnet/ipv6/Kconfig:94:\tselect NET_SOCK_MSG\nnet/ipv6/Kconfig-95-\tselect XFRM_ESPINTCP\n--\nnet/tls/Kconfig=5=config TLS\n--\nnet/tls/Kconfig-10-\tselect CRYPTO_GCM\nnet/tls/Kconfig:11:\tselect NET_SOCK_MSG\nnet/tls/Kconfig-12-\tdefault n\n"
} |
| 9/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 7952 output: 38 thoughts: 64 Thoughts: Okay, let's break this down. **Investigating BPF and Socket Mapping** Alright, so `BPF_SYSCALL` seems to be selecting `NET_SOCK_MSG` if the `NET` option is enabled. That's a key interaction to understand. My next question is, what about `BPF_STREAM_PARSER`? Does the sockmap functionality actually *require* this specific BPF program type? This is important for optimizations and potential security considerations. I need to dig into the code to confirm the dependencies. I should probably start by checking the `net/core/sock_map.c` file, or perhaps the relevant `Kconfig` options, to see if there's a clear dependency declared there. That should shed some light on the relationship. |
| 10/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "BPF_STREAM_PARSER",
"PathPrefixes": [
"net/",
"kernel/bpf/"
]
}Results: {
"Output": "net/Kconfig=354=config BQL\n--\nnet/Kconfig-360-\nnet/Kconfig:361:config BPF_STREAM_PARSER\nnet/Kconfig-362-\tbool \"enable BPF STREAM_PARSER\"\n--\nnet/core/skmsg.c=545=static int sk_psock_skb_ingress_enqueue(struct sk_buff *skb,\n--\nnet/core/skmsg.c-573-\nnet/core/skmsg.c:574:#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)\nnet/core/skmsg.c-575-\tpsock-\u003eingress_bytes += len;\n--\nnet/core/skmsg.c=1061=static void sk_psock_write_space(struct sock *sk)\n--\nnet/core/skmsg.c-1077-\nnet/core/skmsg.c:1078:#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)\nnet/core/skmsg.c-1079-static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb)\n--\nnet/core/skmsg.c=1200=static void sk_psock_done_strp(struct sk_psock *psock)\n--\nnet/core/skmsg.c-1202-}\nnet/core/skmsg.c:1203:#endif /* CONFIG_BPF_STREAM_PARSER */\nnet/core/skmsg.c-1204-\n--\nnet/core/sock_map.c=1486=static int sock_map_prog_link_lookup(struct bpf_map *map, struct bpf_prog ***pprog,\n--\nnet/core/sock_map.c-1500-\t\tbreak;\nnet/core/sock_map.c:1501:#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)\nnet/core/sock_map.c-1502-\tcase BPF_SK_SKB_STREAM_PARSER:\n--\nnet/ipv4/tcp_bpf.c=679=static int tcp_bpf_assert_proto_ops(struct proto *ops)\n--\nnet/ipv4/tcp_bpf.c-688-\nnet/ipv4/tcp_bpf.c:689:#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)\nnet/ipv4/tcp_bpf.c-690-int tcp_bpf_strp_read_sock(struct strparser *strp, read_descriptor_t *desc,\n--\nnet/ipv4/tcp_bpf.c-722-}\nnet/ipv4/tcp_bpf.c:723:#endif /* CONFIG_BPF_STREAM_PARSER */\nnet/ipv4/tcp_bpf.c-724-\n"
} |
| 11/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 8951 output: 37 thoughts: 81 Thoughts: Okay, here's my assessment of that code snippet, delivered as if it's my own thought process: **Diving into `skmsg.c` and Stream Parser Configuration** Alright, that's interesting! I see that the functions `sk_psock_start_strp` and `sk_psock_stop_strp`, which are core to the packet socket stream parser implementation, are wrapped within an `#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)` block in `net/core/skmsg.c`. That's exactly as I would expect it to be. The stream parser features are conditionally compiled based on that BPF configuration flag. No surprises there. I need to confirm the exact location of the functions, as the message mentions it is near line 1167. I’ll make sure to double check the surrounding lines to understand their context within the file, looking for any other relevant dependencies or conditional logic that is worth considering. Understanding the surrounding code helps confirm the stream parser is correctly isolated under the BPF feature. |
| 12/2 | 2026/10/22 16:59 | tool | read-file |
0mArgs:{
"File": "net/core/skmsg.c",
"FirstLine": 1160,
"LineCount": 40
}Results: {
"Contents": "1160:\t\n1161:\t\tif (sk_is_tcp(sk)) {\n1162:\t\t\tpsock-\u003estrp.cb.read_sock = tcp_bpf_strp_read_sock;\n1163:\t\t\tpsock-\u003ecopied_seq = tcp_sk(sk)-\u003ecopied_seq;\n1164:\t\t}\n1165:\t\treturn ret;\n1166:\t}\n1167:\t\n1168:\tvoid sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)\n1169:\t{\n1170:\t\tif (READ_ONCE(psock-\u003esaved_data_ready))\n1171:\t\t\treturn;\n1172:\t\n1173:\t\tWRITE_ONCE(psock-\u003esaved_data_ready, READ_ONCE(sk-\u003esk_data_ready));\n1174:\t\tWRITE_ONCE(sk-\u003esk_data_ready, sk_psock_strp_data_ready);\n1175:\t\tWRITE_ONCE(sk-\u003esk_write_space, sk_psock_write_space);\n1176:\t}\n1177:\t\n1178:\tvoid sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)\n1179:\t{\n1180:\t\tvoid (*saved_data_ready)(struct sock *sk);\n1181:\t\n1182:\t\tpsock_set_prog(\u0026psock-\u003eprogs.stream_parser, NULL);\n1183:\t\n1184:\t\tsaved_data_ready = READ_ONCE(psock-\u003esaved_data_ready);\n1185:\t\tif (!saved_data_ready)\n1186:\t\t\treturn;\n1187:\t\n1188:\t\tWRITE_ONCE(sk-\u003esk_data_ready, saved_data_ready);\n1189:\t\tWRITE_ONCE(psock-\u003esaved_data_ready, NULL);\n1190:\t\tstrp_stop(\u0026psock-\u003estrp);\n1191:\t}\n1192:\t\n1193:\tstatic void sk_psock_done_strp(struct sk_psock *psock)\n1194:\t{\n1195:\t\t/* Parser has been stopped */\n1196:\t\tif (sk_psock_test_state(psock, SK_PSOCK_RX_STRP_ENABLED))\n1197:\t\t\tstrp_done(\u0026psock-\u003estrp);\n1198:\t}\n1199:\t#else\n"
} |
| 13/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 9968 output: 37 thoughts: 82 Thoughts: Here's my take on those lines of code, focusing on what I'm piecing together: **Deep Dive into `skmsg.c` and BPF Stream Parser Integration** Okay, so I'm quickly confirming what I suspected about `sk_psock_start_strp` and `sk_psock_stop_strp`. The fact that they're wrapped in an `#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)` preprocessor directive is spot on. This clearly indicates they're *only* active if the BPF stream parser functionality is enabled in the kernel config. That's good, confirms my mental model, and I can move forward confidently with that understanding. Now, my focus shifts to what's under the `#else` block that follows line 1199 in `net/core/skmsg.c`. The absence of the BPF stream parser shouldn't leave a gaping hole, I need to understand the default path the code will follow when that config option is disabled. What fallback mechanism, or alternative logic, is employed when the stream parser is unavailable? I need to analyze this part to understand the full picture of how the SKMSG subsystem behaves with and without the BPF Stream Parser. I expect to find some alternative, and perhaps older, methods for stream handling, or perhaps a more generic default behavior. Let me dig into that now. |
| 14/2 | 2026/10/22 16:59 | tool | read-file |
0mArgs:{
"File": "net/core/skmsg.c",
"FirstLine": 1200,
"LineCount": 40
}Results: {
"Contents": "1200:\tstatic void sk_psock_done_strp(struct sk_psock *psock)\n1201:\t{\n1202:\t}\n1203:\t#endif /* CONFIG_BPF_STREAM_PARSER */\n1204:\t\n1205:\tstatic int sk_psock_verdict_recv(struct sock *sk, struct sk_buff *skb)\n1206:\t{\n1207:\t\tstruct sk_psock *psock;\n1208:\t\tstruct bpf_prog *prog;\n1209:\t\tint ret = __SK_DROP;\n1210:\t\tint len = skb-\u003elen;\n1211:\t\n1212:\t\trcu_read_lock();\n1213:\t\tpsock = sk_psock(sk);\n1214:\t\tif (unlikely(!psock)) {\n1215:\t\t\tlen = 0;\n1216:\t\t\ttcp_eat_skb(sk, skb);\n1217:\t\t\tsock_drop(sk, skb);\n1218:\t\t\tgoto out;\n1219:\t\t}\n1220:\t\tprog = READ_ONCE(psock-\u003eprogs.stream_verdict);\n1221:\t\tif (!prog)\n1222:\t\t\tprog = READ_ONCE(psock-\u003eprogs.skb_verdict);\n1223:\t\tif (likely(prog)) {\n1224:\t\t\tskb_dst_drop(skb);\n1225:\t\t\tskb_bpf_redirect_clear(skb);\n1226:\t\t\tret = bpf_prog_run_pin_on_cpu(prog, skb);\n1227:\t\t\tret = sk_psock_map_verd(ret, skb_bpf_redirect_fetch(skb));\n1228:\t\t}\n1229:\t\tret = sk_psock_verdict_apply(psock, skb, ret);\n1230:\t\tif (ret \u003c 0)\n1231:\t\t\tlen = ret;\n1232:\tout:\n1233:\t\trcu_read_unlock();\n1234:\t\treturn len;\n1235:\t}\n1236:\t\n1237:\tstatic void sk_psock_verdict_data_ready(struct sock *sk)\n1238:\t{\n1239:\t\tconst struct proto_ops *ops = NULL;\n"
} |
| 15/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 11019 output: 32 thoughts: 80 Thoughts: Okay, here's my summary, tailored as requested: **Assessing Dependencies for BPF Stream Parser Functionality** Right, so I'm diving into this `sk_psock_start_strp` and `sk_psock_stop_strp` code. It's screaming for `CONFIG_BPF_STREAM_PARSER`, which is a key indicator. Now, I need to confirm the underlying environment. Let's start by quickly verifying that `CONFIG_BPF_SYSCALL` is enabled, obviously, and confirm we have `CONFIG_NET` configured. Those are givens, but it's always good to double-check the basics. The real meat of this analysis, though, is digging into the dependencies of `BPF_STREAM_PARSER` itself. That means I need to go straight to `net/Kconfig` and see what else needs to be in place for this feature to be properly enabled and functional. I need a clear picture of what the stream parser relies on. Gotta have the complete context, you know? |
| 16/2 | 2026/10/22 16:59 | tool | read-file |
0mArgs:{
"File": "net/Kconfig",
"FirstLine": 360,
"LineCount": 20
}Results: {
"Contents": " 360:\t\n 361:\tconfig BPF_STREAM_PARSER\n 362:\t\tbool \"enable BPF STREAM_PARSER\"\n 363:\t\tdepends on INET\n 364:\t\tdepends on BPF_SYSCALL\n 365:\t\tdepends on CGROUP_BPF\n 366:\t\tselect STREAM_PARSER\n 367:\t\tselect NET_SOCK_MSG\n 368:\t\thelp\n 369:\t\t Enabling this allows a TCP stream parser to be used with\n 370:\t\t BPF_MAP_TYPE_SOCKMAP.\n 371:\t\n 372:\tconfig NET_FLOW_LIMIT\n 373:\t\tbool \"Net flow limit\"\n 374:\t\tdepends on RPS\n 375:\t\tdefault y\n 376:\t\thelp\n 377:\t\t The network stack has to drop packets when a receive processing CPU's\n 378:\t\t backlog reaches netdev_max_backlog. If a few out of many active flows\n 379:\t\t generate the vast majority of load, drop their traffic earlier to\n"
} |
| 17/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 11651 output: 22 thoughts: 145 Thoughts: **My Analysis of this BPF Dependency Chain** Okay, so I'm looking at this `BPF_STREAM_PARSER` feature and immediately I see it leans on a few things: `INET`, `BPF_SYSCALL`, and `CGROUP_BPF`. That's not entirely surprising, given the nature of stream parsing within the kernel. The more interesting dependency is how `sock_map.o` is built with `CONFIG_BPF_SYSCALL`, and how `skmsg.o` depends on `CONFIG_NET_SOCK_MSG`, which, in turn, is selected by `BPF_SYSCALL`, assuming `NET` is also enabled. Seems like a fairly standard approach given the interaction between these subsystems. Now, let's get into the nitty-gritty. I need to understand the implications of the changes. Specifically, what's been *modified* by this patch? I'll start by listing the functions that have been touched. One function jumps out immediately: `sk_psock_restore_proto` from `include/linux/skmsg.h`. It's a `static inline` function, so I'm going to need to track down its callers. Where it's *used* is going to be key to understanding the ripple effects of this patch. Time to dive into the call sites. |
| 18/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "sk_psock_restore_proto"
}Results: {
"Output": "include/linux/skmsg.h=479=static inline void sk_psock_cork_free(struct sk_psock *psock)\n--\ninclude/linux/skmsg.h-487-\ninclude/linux/skmsg.h:488:static inline void sk_psock_restore_proto(struct sock *sk,\ninclude/linux/skmsg.h-489-\t\t\t\t\t struct sk_psock *psock)\n--\nnet/core/skmsg.c=889=void sk_psock_drop(struct sock *sk, struct sk_psock *psock)\n--\nnet/core/skmsg.c-891-\twrite_lock_bh(\u0026sk-\u003esk_callback_lock);\nnet/core/skmsg.c:892:\tsk_psock_restore_proto(sk, psock);\nnet/core/skmsg.c-893-\trcu_assign_sk_user_data(sk, NULL);\n"
} |
| 19/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 12357 output: 74 thoughts: 283 Thoughts: **Analyzing `sock_map.c` and Related Functions** Okay, so I'm looking at this codebase, specifically the functions related to `sk_psock_restore_proto`, and it's calling `sk_psock_drop`. That's the entry point. Now, to get a handle on the broader context, I need to understand what's interacting with the protocol socket (psock) functionality. I see several other functions that seem relevant, all within `net/core/skmsg.c`: `sk_psock_start_strp`, `sk_psock_stop_strp`, `sk_psock_start_verdict`, and `sk_psock_stop_verdict`. These likely control the start and stop of streaming data to the psock and the start and stop of a verdict. This is an important clue. Now, I need to focus on this `sock_map.c` file. I see some statically declared functions in there: `sock_map_del_link`, `sock_map_init_proto`, `sock_map_psock_get_checked`, `sock_map_link`, and `sock_map_sk_is_suitable`. These are intriguing because they are static; I'll need to figure out who's calling them. I need to understand how these static functions interface with and control the sockets. I'm going to start checking for callers of those static functions in `sock_map.c`. That's where the real insights will lie. Knowing who calls these functions will give me a better understanding of how the core data structures are managed. This information will be key to understanding the underlying mechanics of this code. |
| 20/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "(sock_map_del_link|sock_map_init_proto|sock_map_psock_get_checked|sock_map_link|sock_map_sk_is_suitable)",
"PathPrefixes": [
"net/core/sock_map.c"
]
}Results: {
"Output": "net/core/sock_map.c=132=static void sock_map_add_link(struct sk_psock *psock,\n--\nnet/core/sock_map.c-142-\nnet/core/sock_map.c:143:static void sock_map_del_link(struct sock *sk,\nnet/core/sock_map.c-144-\t\t\t struct sk_psock *psock, void *link_raw)\n--\nnet/core/sock_map.c=182=static void sock_map_unref(struct sock *sk, void *link_raw)\n--\nnet/core/sock_map.c-186-\tif (likely(psock)) {\nnet/core/sock_map.c:187:\t\tsock_map_del_link(sk, psock, link_raw);\nnet/core/sock_map.c-188-\t\tsk_psock_put(sk, psock);\n--\nnet/core/sock_map.c-191-\nnet/core/sock_map.c:192:static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)\nnet/core/sock_map.c-193-{\n--\nnet/core/sock_map.c-202-\nnet/core/sock_map.c:203:static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)\nnet/core/sock_map.c-204-{\n--\nnet/core/sock_map.c-222-\nnet/core/sock_map.c:223:static int sock_map_link(struct bpf_map *map, struct sock *sk)\nnet/core/sock_map.c-224-{\n--\nnet/core/sock_map.c-266-\nnet/core/sock_map.c:267:\tpsock = sock_map_psock_get_checked(sk);\nnet/core/sock_map.c-268-\tif (IS_ERR(psock)) {\n--\nnet/core/sock_map.c-303-\t */\nnet/core/sock_map.c:304:\tret = sock_map_init_proto(sk, psock);\nnet/core/sock_map.c-305-\tif (ret \u003c 0) {\n--\nnet/core/sock_map.c=479=static int sock_map_update_common(struct bpf_map *map, u32 idx,\n--\nnet/core/sock_map.c-497-\nnet/core/sock_map.c:498:\tret = sock_map_link(map, sk);\nnet/core/sock_map.c-499-\tif (ret \u003c 0)\n--\nnet/core/sock_map.c=537=static bool sock_map_redirect_allowed(const struct sock *sk)\n--\nnet/core/sock_map.c-544-\nnet/core/sock_map.c:545:static bool sock_map_sk_is_suitable(const struct sock *sk)\nnet/core/sock_map.c-546-{\n--\nnet/core/sock_map.c=567=int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\n--\nnet/core/sock_map.c-589-\t}\nnet/core/sock_map.c:590:\tif (!sock_map_sk_is_suitable(sk)) {\nnet/core/sock_map.c-591-\t\tret = -EOPNOTSUPP;\n--\nnet/core/sock_map.c=608=static long sock_map_update_elem(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-616-\nnet/core/sock_map.c:617:\tif (!sock_map_sk_is_suitable(sk))\nnet/core/sock_map.c-618-\t\treturn -EOPNOTSUPP;\n--\nnet/core/sock_map.c=633=BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, sops,\n--\nnet/core/sock_map.c-637-\nnet/core/sock_map.c:638:\tif (likely(sock_map_sk_is_suitable(sops-\u003esk) \u0026\u0026\nnet/core/sock_map.c-639-\t\t sock_map_op_okay(sops)))\n--\nnet/core/sock_map.c=1002=static int sock_hash_update_common(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-1020-\nnet/core/sock_map.c:1021:\tret = sock_map_link(map, sk);\nnet/core/sock_map.c-1022-\tif (ret \u003c 0)\n--\nnet/core/sock_map.c=1240=BPF_CALL_4(bpf_sock_hash_update, struct bpf_sock_ops_kern *, sops,\n--\nnet/core/sock_map.c-1244-\nnet/core/sock_map.c:1245:\tif (likely(sock_map_sk_is_suitable(sops-\u003esk) \u0026\u0026\nnet/core/sock_map.c-1246-\t\t sock_map_op_okay(sops)))\n--\nnet/core/sock_map.c=1746=struct sockmap_link {\n--\nnet/core/sock_map.c-1750-\nnet/core/sock_map.c:1751:static void sock_map_link_release(struct bpf_link *link)\nnet/core/sock_map.c-1752-{\n--\nnet/core/sock_map.c-1767-\nnet/core/sock_map.c:1768:static int sock_map_link_detach(struct bpf_link *link)\nnet/core/sock_map.c-1769-{\nnet/core/sock_map.c:1770:\tsock_map_link_release(link);\nnet/core/sock_map.c-1771-\treturn 0;\n--\nnet/core/sock_map.c-1773-\nnet/core/sock_map.c:1774:static void sock_map_link_dealloc(struct bpf_link *link)\nnet/core/sock_map.c-1775-{\n--\nnet/core/sock_map.c-1782- */\nnet/core/sock_map.c:1783:static int sock_map_link_update_prog(struct bpf_link *link,\nnet/core/sock_map.c-1784-\t\t\t\t struct bpf_prog *prog,\n--\nnet/core/sock_map.c-1842-\nnet/core/sock_map.c:1843:static u32 sock_map_link_get_map_id(const struct sockmap_link *sockmap_link)\nnet/core/sock_map.c-1844-{\n--\nnet/core/sock_map.c-1853-\nnet/core/sock_map.c:1854:static int sock_map_link_fill_info(const struct bpf_link *link,\nnet/core/sock_map.c-1855-\t\t\t\t struct bpf_link_info *info)\n--\nnet/core/sock_map.c-1857-\tconst struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link);\nnet/core/sock_map.c:1858:\tu32 map_id = sock_map_link_get_map_id(sockmap_link);\nnet/core/sock_map.c-1859-\n--\nnet/core/sock_map.c-1864-\nnet/core/sock_map.c:1865:static void sock_map_link_show_fdinfo(const struct bpf_link *link,\nnet/core/sock_map.c-1866-\t\t\t\t struct seq_file *seq)\n--\nnet/core/sock_map.c-1868-\tconst struct sockmap_link *sockmap_link = container_of(link, struct sockmap_link, link);\nnet/core/sock_map.c:1869:\tu32 map_id = sock_map_link_get_map_id(sockmap_link);\nnet/core/sock_map.c-1870-\n--\nnet/core/sock_map.c-1874-\nnet/core/sock_map.c:1875:static const struct bpf_link_ops sock_map_link_ops = {\nnet/core/sock_map.c:1876:\t.release = sock_map_link_release,\nnet/core/sock_map.c:1877:\t.dealloc = sock_map_link_dealloc,\nnet/core/sock_map.c:1878:\t.detach = sock_map_link_detach,\nnet/core/sock_map.c:1879:\t.update_prog = sock_map_link_update_prog,\nnet/core/sock_map.c:1880:\t.fill_link_info = sock_map_link_fill_info,\nnet/core/sock_map.c:1881:\t.show_fdinfo = sock_map_link_show_fdinfo,\nnet/core/sock_map.c-1882-};\nnet/core/sock_map.c-1883-\nnet/core/sock_map.c:1884:int sock_map_link_create(const union bpf_attr *attr, struct bpf_prog *prog)\nnet/core/sock_map.c-1885-{\n--\nnet/core/sock_map.c-1909-\tattach_type = attr-\u003elink_create.attach_type;\nnet/core/sock_map.c:1910:\tbpf_link_init(\u0026sockmap_link-\u003elink, BPF_LINK_TYPE_SOCKMAP, \u0026sock_map_link_ops, prog,\nnet/core/sock_map.c-1911-\t\t attach_type);\n"
} |
| 21/2 | 2026/10/22 16:59 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15729 output: 41 thoughts: 155 Thoughts: **Analyzing `sock_map.c` for Key Functions** Okay, let's dive into `sock_map.c` and pinpoint the critical functions. I need to identify the entry points, exported symbols, or any non-static functions that should be the focus of my analysis. It looks like `sock_map_link` is a good starting point, as it's called by both `sock_map_update_common` and `sock_hash_update_common`. That connection provides a clear path of investigation. Now, the more important function is `sock_map_update_elem_sys`, which has the signature `int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags)`. This looks like the core map update operation (map_update_elem) for both `sock_map` and `sock_hash` maps. Given that, I should now thoroughly examine `sock_map_ops` and `sock_hash_ops` definitions. These are the operations structures that define the behavior of the respective map types, so understanding their implementations will illuminate the overall workings of the code. |
| 22/2 | 2026/10/22 16:59 | tool | grepper |
0mArgs:{
"Expression": "sock_map_ops|sock_hash_ops",
"PathPrefixes": [
"net/core/sock_map.c"
]
}Results: {
"Output": "net/core/sock_map.c=839=BTF_ID_LIST_SINGLE(sock_map_btf_ids, struct, bpf_stab)\nnet/core/sock_map.c:840:const struct bpf_map_ops sock_map_ops = {\nnet/core/sock_map.c-841-\t.map_meta_equal\t\t= bpf_map_meta_equal,\n--\nnet/core/sock_map.c=1455=BTF_ID_LIST_SINGLE(sock_hash_map_btf_ids, struct, bpf_shtab)\nnet/core/sock_map.c:1456:const struct bpf_map_ops sock_hash_ops = {\nnet/core/sock_map.c-1457-\t.map_meta_equal\t\t= bpf_map_meta_equal,\n"
} |
| 23/2 | 2026/10/22 17:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16404 output: 37 thoughts: 16 Thoughts: Here's a summary of my current thought process, tailored for an expert audience: **Analyzing `sock_map_ops`** Okay, let's dive into this. My initial focus is on the `sock_map_ops` structure. I'm immediately trying to understand its defined operations. I need to quickly identify the methods that it implements. Given my background, I understand that this struct is crucial for manipulating socket data structures within the kernel, likely tied to eBPF or some other networking subsystem. I need to quickly identify its methods. What capabilities does it provide? I need to grasp how these operations interact. Understanding this is essential to figuring out how to work with this map properly. I need to understand its design choices and potential vulnerabilities. I need to see how these operations fit into the overall architecture. |
| 24/2 | 2026/10/22 17:00 | tool | read-file |
0mArgs:{
"File": "net/core/sock_map.c",
"FirstLine": 840,
"LineCount": 30
}Results: {
"Contents": " 840:\tconst struct bpf_map_ops sock_map_ops = {\n 841:\t\t.map_meta_equal\t\t= bpf_map_meta_equal,\n 842:\t\t.map_alloc\t\t= sock_map_alloc,\n 843:\t\t.map_free\t\t= sock_map_free,\n 844:\t\t.map_get_next_key\t= sock_map_get_next_key,\n 845:\t\t.map_lookup_elem_sys_only = sock_map_lookup_sys,\n 846:\t\t.map_update_elem\t= sock_map_update_elem,\n 847:\t\t.map_delete_elem\t= sock_map_delete_elem,\n 848:\t\t.map_lookup_elem\t= sock_map_lookup,\n 849:\t\t.map_release_uref\t= sock_map_release_progs,\n 850:\t\t.map_check_btf\t\t= map_check_no_btf,\n 851:\t\t.map_mem_usage\t\t= sock_map_mem_usage,\n 852:\t\t.map_btf_id\t\t= \u0026sock_map_btf_ids[0],\n 853:\t\t.iter_seq_info\t\t= \u0026sock_map_iter_seq_info,\n 854:\t};\n 855:\t\n 856:\tstruct bpf_shtab_elem {\n 857:\t\tstruct rcu_head rcu;\n 858:\t\tu32 hash;\n 859:\t\tstruct sock *sk;\n 860:\t\tstruct hlist_node node;\n 861:\t\tu8 key[];\n 862:\t};\n 863:\t\n 864:\tstruct bpf_shtab_bucket {\n 865:\t\tstruct hlist_head head;\n 866:\t\tspinlock_t lock;\n 867:\t};\n 868:\t\n 869:\tstruct bpf_shtab {\n"
} |
| 25/2 | 2026/10/22 17:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17152 output: 37 thoughts: 30 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing `sock_map_update_elem_sys` in `sock_map.c`** Alright, let's take a quick look at `sock_map.c`. I need to figure out the context surrounding the use of `sock_map_update_elem_sys`. Specifically, where *exactly* is this function being invoked within the module? My initial thought is to trace its calls to understand the interaction with other elements and the overall data flow. I want to see how this system call interacts with the sock map. I'm especially interested in whether it's called in interrupt context and how that affects any locking considerations, especially if we are dealing with concurrent access. This calls for a quick code dive. Let's start the search. |
| 26/2 | 2026/10/22 17:00 | tool | grepper |
0mArgs:{
"Expression": "sock_map_update_elem_sys",
"PathPrefixes": [
"net/",
"kernel/"
]
}Results: {
"Output": "kernel/bpf/syscall.c=250=static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,\n--\nkernel/bpf/syscall.c-263-\t\t map-\u003emap_type == BPF_MAP_TYPE_SOCKMAP) {\nkernel/bpf/syscall.c:264:\t\treturn sock_map_update_elem_sys(map, key, value, flags);\nkernel/bpf/syscall.c-265-\t} else if (IS_FD_PROG_ARRAY(map)) {\n--\nnet/core/sock_map.c=564=static int sock_hash_update_common(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-566-\nnet/core/sock_map.c:567:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\nnet/core/sock_map.c-568-\t\t\t u64 flags)\n"
} |
| 27/2 | 2026/10/22 17:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17668 output: 36 thoughts: 89 Thoughts: Here's my thought process, as if I were analyzing this code: **Analyzing the Sockmap Update Flow** Okay, so I see that `sock_map_update_elem_sys` is the system call handler triggered when userspace updates a sockmap using `bpf(BPF_MAP_UPDATE_ELEM, ...)`. That's the entry point for modifications, good to know. Now, I need to understand the deletion side of things. I'm wondering what function handles deleting links in the sockmap. Right, I'm recalling now that `sock_map_del_link` is responsible for deleting the links. Now, the next question is where is `sock_map_del_link` getting called from? Aha, `sock_map_unref` calls `sock_map_del_link`. That makes sense; when a sockmap is unreferenced, its associated links need to be cleaned up. This feels like the critical unlinking point. To be completely sure, I'll need to figure out everywhere that this `sock_map_unref` function is called. |
| 28/2 | 2026/10/22 17:00 | tool | grepper |
0mArgs:{
"Expression": "sock_map_unref",
"PathPrefixes": [
"net/core/sock_map.c"
]
}Results: {
"Output": "net/core/sock_map.c=143=static void sock_map_del_link(struct sock *sk,\n--\nnet/core/sock_map.c-181-\nnet/core/sock_map.c:182:static void sock_map_unref(struct sock *sk, void *link_raw)\nnet/core/sock_map.c-183-{\n--\nnet/core/sock_map.c=348=static void sock_map_free(struct bpf_map *map)\n--\nnet/core/sock_map.c-366-\t\t\trcu_read_lock();\nnet/core/sock_map.c:367:\t\t\tsock_map_unref(sk, psk);\nnet/core/sock_map.c-368-\t\t\trcu_read_unlock();\n--\nnet/core/sock_map.c=424=static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,\n--\nnet/core/sock_map.c-434-\tif (likely(sk))\nnet/core/sock_map.c:435:\t\tsock_map_unref(sk, psk);\nnet/core/sock_map.c-436-\telse\n--\nnet/core/sock_map.c=479=static int sock_map_update_common(struct bpf_map *map, u32 idx,\n--\nnet/core/sock_map.c-517-\tif (osk)\nnet/core/sock_map.c:518:\t\tsock_map_unref(osk, \u0026stab-\u003esks[idx]);\nnet/core/sock_map.c-519-\tspin_unlock_bh(\u0026stab-\u003elock);\n--\nnet/core/sock_map.c=927=static void sock_hash_delete_from_link(struct bpf_map *map, struct sock *sk,\n--\nnet/core/sock_map.c-945-\t\thlist_del_rcu(\u0026elem-\u003enode);\nnet/core/sock_map.c:946:\t\tsock_map_unref(elem-\u003esk, elem);\nnet/core/sock_map.c-947-\t\tsock_hash_free_elem(htab, elem);\n--\nnet/core/sock_map.c=952=static long sock_hash_delete_elem(struct bpf_map *map, void *key)\n--\nnet/core/sock_map.c-966-\t\thlist_del_rcu(\u0026elem-\u003enode);\nnet/core/sock_map.c:967:\t\tsock_map_unref(elem-\u003esk, elem);\nnet/core/sock_map.c-968-\t\tsock_hash_free_elem(htab, elem);\n--\nnet/core/sock_map.c=1002=static int sock_hash_update_common(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-1053-\t\thlist_del_rcu(\u0026elem-\u003enode);\nnet/core/sock_map.c:1054:\t\tsock_map_unref(elem-\u003esk, elem);\nnet/core/sock_map.c-1055-\t\tsock_hash_free_elem(htab, elem);\n--\nnet/core/sock_map.c=1155=static void sock_hash_free(struct bpf_map *map)\n--\nnet/core/sock_map.c-1191-\t\t\trcu_read_lock();\nnet/core/sock_map.c:1192:\t\t\tsock_map_unref(elem-\u003esk, elem);\nnet/core/sock_map.c-1193-\t\t\trcu_read_unlock();\n"
} |
| 29/2 | 2026/10/22 17:00 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18981 output: 20 thoughts: 57 Thoughts: Okay, here's my assessment of the situation, tailored as requested: **Deconstructing Socket Cleanup and References** Alright, so `sock_map_unref` is the critical function we're dealing with for decrementing reference counts. I see its use cases: element deletion, updates that overwrite existing sockets – basically, any scenario where a socket descriptor is being released from the map. It's a key part of the memory management within the BPF infrastructure. My immediate question then is: what's the relationship with `sk_psock_drop`? Where does that fit into the lifecycle of these mapped sockets? Let's dive deeper and track down all the calls to `sk_psock_drop`. That will give me a better understanding of how the program and program socket mappings are handled when a program is detached from a socket. This will clarify how the socket is handled throughout its lifetime. That's where the next level of understanding will be: mapping and unmapping program sockets in BPF. |
| 30/2 | 2026/10/22 17:00 | tool | grepper |
0mArgs:{
"Expression": "sk_psock_drop"
}Results: {
"Output": "include/linux/skmsg.h=498=static inline struct sk_psock *sk_psock_get(struct sock *sk)\n--\ninclude/linux/skmsg.h-509-\ninclude/linux/skmsg.h:510:void sk_psock_drop(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h-511-\ninclude/linux/skmsg.h=512=static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock)\n--\ninclude/linux/skmsg.h-514-\tif (refcount_dec_and_test(\u0026psock-\u003erefcnt))\ninclude/linux/skmsg.h:515:\t\tsk_psock_drop(sk, psock);\ninclude/linux/skmsg.h-516-}\n--\nnet/core/skmsg.c=864=static void sk_psock_destroy(struct work_struct *work)\n--\nnet/core/skmsg.c-888-\nnet/core/skmsg.c:889:void sk_psock_drop(struct sock *sk, struct sk_psock *psock)\nnet/core/skmsg.c-890-{\n--\nnet/core/skmsg.c-904-}\nnet/core/skmsg.c:905:EXPORT_SYMBOL_GPL(sk_psock_drop);\nnet/core/skmsg.c-906-\n"
} |
| 31/2 | 2026/10/22 17:00 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19651 output: 25 thoughts: 139 Thoughts: **My Analysis of Recent `sk_psock` Changes** Okay, so I'm seeing that `sk_psock_drop` is now exported. A quick look tells me it calls `sk_psock_restore_proto(sk, psock)`, and that function has indeed been touched within `include/linux/skmsg.h`. Fine, that's expected. But I need to understand the *full* impact of these modifications. Let me think… what else in `net/core/skmsg.c` got a facelift along with that? Ah, yes. I see: `sk_psock_start_strp`, `sk_psock_stop_strp`, `sk_psock_start_verdict`, and `sk_psock_stop_verdict`. Right, a set of related functions, all dealing with these psock changes. Now, the important next step: Where are these new `strp` and `verdict` functions being called? That's where the real impact of these changes will become apparent. I need to trace them through the code to understand the functional implications and the new workflows these functions are part of. That's the key to understanding how these changes affect the overall system. Time to delve deeper! |
| 32/2 | 2026/10/22 17:01 | tool | grepper |
0mArgs:{
"Expression": "sk_psock_(start|stop)_strp"
}Results: {
"Output": "include/linux/skmsg.h=440=int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h:441:void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h:442:void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h-443-#else\ninclude/linux/skmsg.h=444=static inline int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock)\n--\ninclude/linux/skmsg.h-448-\ninclude/linux/skmsg.h:449:static inline void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)\ninclude/linux/skmsg.h-450-{\n--\ninclude/linux/skmsg.h-452-\ninclude/linux/skmsg.h:453:static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)\ninclude/linux/skmsg.h-454-{\n--\nnet/core/skmsg.c=889=void sk_psock_drop(struct sock *sk, struct sk_psock *psock)\n--\nnet/core/skmsg.c-894-\tif (psock-\u003eprogs.stream_parser)\nnet/core/skmsg.c:895:\t\tsk_psock_stop_strp(sk, psock);\nnet/core/skmsg.c-896-\telse if (psock-\u003eprogs.stream_verdict || psock-\u003eprogs.skb_verdict)\n--\nnet/core/skmsg.c=1147=int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock)\n--\nnet/core/skmsg.c-1167-\nnet/core/skmsg.c:1168:void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)\nnet/core/skmsg.c-1169-{\n--\nnet/core/skmsg.c-1177-\nnet/core/skmsg.c:1178:void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)\nnet/core/skmsg.c-1179-{\n--\nnet/core/sock_map.c=143=static void sock_map_del_link(struct sock *sk,\n--\nnet/core/sock_map.c-170-\t\tif (strp_stop)\nnet/core/sock_map.c:171:\t\t\tsk_psock_stop_strp(sk, psock);\nnet/core/sock_map.c-172-\t\tif (verdict_stop)\n--\nnet/core/sock_map.c=223=static int sock_map_link(struct bpf_map *map, struct sock *sk)\n--\nnet/core/sock_map.c-321-\t\t}\nnet/core/sock_map.c:322:\t\tsk_psock_start_strp(sk, psock);\nnet/core/sock_map.c-323-\t} else if (!stream_parser \u0026\u0026 stream_verdict \u0026\u0026\n"
} |
| 33/2 | 2026/10/22 17:01 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20965 output: 25 thoughts: 24 Thoughts: Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person: **Kernel Socket Verdicts: A Streamlined View** Alright, so I'm looking at these socket verdict functions, `sk_psock_start_verdict` and `sk_psock_stop_verdict`. Immediately, my mind jumps to the core of their purpose: managing the decisions related to packet sockets, the kernel side of things, specifically the start and stop of those verdict actions. I'm thinking about the implications for security and the flow control here. The start and stop aspects suggest lifecycle management of a particular verdict decision. What's the triggering mechanism? What sort of data is being passed, the context of the packets? Are we talking about a simple allow/deny model, or something more nuanced? What conditions must be met to issue the verdict? From a performance standpoint, the efficiency of these calls would be crucial. I'm already mentally benchmarking their impact, suspecting that they are crucial parts of the packet inspection. |
| 34/2 | 2026/10/22 17:01 | tool | grepper |
0mArgs:{
"Expression": "sk_psock_(start|stop)_verdict"
}Results: {
"Output": "include/linux/skmsg.h=453=static inline void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)\n--\ninclude/linux/skmsg.h-457-\ninclude/linux/skmsg.h:458:void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h:459:void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock);\ninclude/linux/skmsg.h-460-\n--\nnet/core/skmsg.c=889=void sk_psock_drop(struct sock *sk, struct sk_psock *psock)\n--\nnet/core/skmsg.c-896-\telse if (psock-\u003eprogs.stream_verdict || psock-\u003eprogs.skb_verdict)\nnet/core/skmsg.c:897:\t\tsk_psock_stop_verdict(sk, psock);\nnet/core/skmsg.c-898-\twrite_unlock_bh(\u0026sk-\u003esk_callback_lock);\n--\nnet/core/skmsg.c=1237=static void sk_psock_verdict_data_ready(struct sock *sk)\n--\nnet/core/skmsg.c-1263-\nnet/core/skmsg.c:1264:void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock)\nnet/core/skmsg.c-1265-{\n--\nnet/core/skmsg.c-1273-\nnet/core/skmsg.c:1274:void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)\nnet/core/skmsg.c-1275-{\n--\nnet/core/sock_map.c=143=static void sock_map_del_link(struct sock *sk,\n--\nnet/core/sock_map.c-172-\t\tif (verdict_stop)\nnet/core/sock_map.c:173:\t\t\tsk_psock_stop_verdict(sk, psock);\nnet/core/sock_map.c-174-\n--\nnet/core/sock_map.c=223=static int sock_map_link(struct bpf_map *map, struct sock *sk)\n--\nnet/core/sock_map.c-324-\t\t !READ_ONCE(psock-\u003esaved_data_ready)) {\nnet/core/sock_map.c:325:\t\tsk_psock_start_verdict(sk,psock);\nnet/core/sock_map.c-326-\t} else if (!stream_verdict \u0026\u0026 skb_verdict \u0026\u0026\nnet/core/sock_map.c-327-\t\t !READ_ONCE(psock-\u003esaved_data_ready)) {\nnet/core/sock_map.c:328:\t\tsk_psock_start_verdict(sk, psock);\nnet/core/sock_map.c-329-\t}\n"
} |
| 35/2 | 2026/10/22 17:01 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22034 output: 42 thoughts: 745 Thoughts: **Analyzing Socket Map and eBPF Program Interactions**
Okay, so I'm looking closely at how sockets and eBPF programs are interacting, specifically during teardown and psock drops. My initial observation is that `sk_psock_drop` is the central point where the cleanup routines are called – `sk_psock_restore_proto`, `sk_psock_stop_strp`, and `sk_psock_stop_verdict`. I see that `sk_psock_start_strp`, `sk_psock_start_verdict`, `sk_psock_stop_strp`, and `sk_psock_stop_verdict` are non-static functions within `net/core/skmsg.c` – they are directly modified by this patch, which is good to know.
Now I'm digging into `net/core/sock_map.c`. I noticed `sock_map_del_link`, `sock_map_link`, `sock_map_init_proto`, and `sock_map_sk_is_suitable`. The question is whether these are static or not? Okay, so they're all defined as static. In the context of GCC/Clang, that implies they *might* be inlined. But that also means they may not have explicit symbols in the final vmlinux image.
The core of my interest lies in how these static functions are *used*. Which non-static symbols are either calling them or being directly modified themselves? Let's break this down:
**Modified Non-Static Symbols (that I'm interested in):**
* `net/core/skmsg.c`:
* `sk_psock_start_strp` (non-static)
* `sk_psock_stop_strp` (non-static)
* `sk_psock_start_verdict` (non-static)
* `sk_psock_stop_verdict` (non-static)
* `sk_psock_drop` (non-static, a critical one as it calls `sk_psock_restore_proto`)
* `net/core/sock_map.c`:
* `sock_map_update_elem_sys` (non-static)
* `net/core/sock_map.c`:
* `sock_map_link` (static)
* `sock_map_del_link` (static)
* `sock_map_init_proto` (static)
* `sock_map_psock_get_checked` (static)
* `sock_map_sk_is_suitable` (static)
Given that these static functions *could* be inlined, I need to check whether the symbols remain in the vmlinux image. Even with static functions, Syzkaller's kcov will track function entry if the compiler emits a function symbol. However, non-static or exported symbols are *guaranteed* to be in the vmlinux.
I'll use `nm` or `git grep` to identify the symbols. This is critical. Remember the guideline: "Compiler-inlined static functions lack distinct symbol addresses and cannot be targeted directly by symbol coverage filters." The goal is to identify non-static callers that exercise these static inline helpers.
So, let's confirm the static nature of `sock_map_link`. Yes, confirmed: `static int sock_map_link(...)`. And also to note, `sock_map_update_elem_sys` is indeed *non-static* `int sock_map_update_elem_sys(...)`. I need to ensure that the code coverage filters target the right functions.
|
| 36/2 | 2026/10/22 17:01 | tool | grepper |
0mArgs:{
"Expression": "^[a-z_0-9]+ .*\\(.*",
"PathPrefixes": [
"net/core/sock_map.c"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 345 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (1 files in total):\nnet/core/sock_map.c:82\n\nnet/core/sock_map.c=17=struct bpf_stab {\n--\nnet/core/sock_map.c-31- */\nnet/core/sock_map.c:32:static DEFINE_MUTEX(sockmap_mutex);\nnet/core/sock_map.c-33-\nnet/core/sock_map.c:34:static int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog,\nnet/core/sock_map.c-35-\t\t\t\tstruct bpf_prog *old, struct bpf_link *link,\nnet/core/sock_map.c-36-\t\t\t\tu32 which);\nnet/core/sock_map.c:37:static struct sk_psock_progs *sock_map_progs(struct bpf_map *map);\nnet/core/sock_map.c-38-\nnet/core/sock_map.c:39:static struct bpf_map *sock_map_alloc(union bpf_attr *attr)\nnet/core/sock_map.c-40-{\n--\nnet/core/sock_map.c-68-\nnet/core/sock_map.c:69:int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog)\nnet/core/sock_map.c-70-{\n--\nnet/core/sock_map.c-86-\nnet/core/sock_map.c:87:int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype)\nnet/core/sock_map.c-88-{\n--\nnet/core/sock_map.c-117-\nnet/core/sock_map.c:118:static void sock_map_sk_acquire(struct sock *sk)\nnet/core/sock_map.c-119-\t__acquires(\u0026sk-\u003esk_lock.slock)\n--\nnet/core/sock_map.c-124-\nnet/core/sock_map.c:125:static void sock_map_sk_release(struct sock *sk)\nnet/core/sock_map.c-126-\t__releases(\u0026sk-\u003esk_lock.slock)\n--\nnet/core/sock_map.c-131-\nnet/core/sock_map.c:132:static void sock_map_add_link(struct sk_psock *psock,\nnet/core/sock_map.c-133-\t\t\t struct sk_psock_link *link,\n--\nnet/core/sock_map.c-142-\nnet/core/sock_map.c:143:static void sock_map_del_link(struct sock *sk,\nnet/core/sock_map.c-144-\t\t\t struct sk_psock *psock, void *link_raw)\n--\nnet/core/sock_map.c-181-\nnet/core/sock_map.c:182:static void sock_map_unref(struct sock *sk, void *link_raw)\nnet/core/sock_map.c-183-{\n--\nnet/core/sock_map.c-191-\nnet/core/sock_map.c:192:static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)\nnet/core/sock_map.c-193-{\n--\nnet/core/sock_map.c-202-\nnet/core/sock_map.c:203:static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)\nnet/core/sock_map.c-204-{\n--\nnet/core/sock_map.c-222-\nnet/core/sock_map.c:223:static int sock_map_link(struct bpf_map *map, struct sock *sk)\nnet/core/sock_map.c-224-{\n--\nnet/core/sock_map.c-347-\nnet/core/sock_map.c:348:static void sock_map_free(struct bpf_map *map)\nnet/core/sock_map.c-349-{\n--\nnet/core/sock_map.c-380-\nnet/core/sock_map.c:381:static void sock_map_release_progs(struct bpf_map *map)\nnet/core/sock_map.c-382-{\n--\nnet/core/sock_map.c-385-\nnet/core/sock_map.c:386:static struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key)\nnet/core/sock_map.c-387-{\n--\nnet/core/sock_map.c-396-\nnet/core/sock_map.c:397:static void *sock_map_lookup(struct bpf_map *map, void *key)\nnet/core/sock_map.c-398-{\n--\nnet/core/sock_map.c-408-\nnet/core/sock_map.c:409:static void *sock_map_lookup_sys(struct bpf_map *map, void *key)\nnet/core/sock_map.c-410-{\n--\nnet/core/sock_map.c-423-\nnet/core/sock_map.c:424:static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,\nnet/core/sock_map.c-425-\t\t\t struct sock **psk)\n--\nnet/core/sock_map.c-442-\nnet/core/sock_map.c:443:static void sock_map_delete_from_link(struct bpf_map *map, struct sock *sk,\nnet/core/sock_map.c-444-\t\t\t\t void *link_raw)\n--\nnet/core/sock_map.c-450-\nnet/core/sock_map.c:451:static long sock_map_delete_elem(struct bpf_map *map, void *key)\nnet/core/sock_map.c-452-{\n--\nnet/core/sock_map.c-463-\nnet/core/sock_map.c:464:static int sock_map_get_next_key(struct bpf_map *map, void *key, void *next)\nnet/core/sock_map.c-465-{\n--\nnet/core/sock_map.c-478-\nnet/core/sock_map.c:479:static int sock_map_update_common(struct bpf_map *map, u32 idx,\nnet/core/sock_map.c-480-\t\t\t\t struct sock *sk, u64 flags)\n--\nnet/core/sock_map.c-529-\nnet/core/sock_map.c:530:static bool sock_map_op_okay(const struct bpf_sock_ops_kern *ops)\nnet/core/sock_map.c-531-{\n--\nnet/core/sock_map.c-536-\nnet/core/sock_map.c:537:static bool sock_map_redirect_allowed(const struct sock *sk)\nnet/core/sock_map.c-538-{\n--\nnet/core/sock_map.c-544-\nnet/core/sock_map.c:545:static bool sock_map_sk_is_suitable(const struct sock *sk)\nnet/core/sock_map.c-546-{\n--\nnet/core/sock_map.c-549-\nnet/core/sock_map.c:550:static bool sock_map_sk_state_allowed(const struct sock *sk)\nnet/core/sock_map.c-551-{\n--\nnet/core/sock_map.c-563-\nnet/core/sock_map.c:564:static int sock_hash_update_common(struct bpf_map *map, void *key,\nnet/core/sock_map.c-565-\t\t\t\t struct sock *sk, u64 flags);\nnet/core/sock_map.c-566-\nnet/core/sock_map.c:567:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\nnet/core/sock_map.c-568-\t\t\t u64 flags)\n--\nnet/core/sock_map.c-607-\nnet/core/sock_map.c:608:static long sock_map_update_elem(struct bpf_map *map, void *key,\nnet/core/sock_map.c-609-\t\t\t\t void *value, u64 flags)\n--\nnet/core/sock_map.c=728=DEFINE_BPF_ITER_FUNC(sockmap, struct bpf_iter_meta *meta,\n--\nnet/core/sock_map.c-731-\nnet/core/sock_map.c:732:static void *sock_map_seq_lookup_elem(struct sock_map_seq_info *info)\nnet/core/sock_map.c-733-{\n--\nnet/core/sock_map.c-742-\nnet/core/sock_map.c:743:static void *sock_map_seq_start(struct seq_file *seq, loff_t *pos)\nnet/core/sock_map.c-744-\t__acquires(rcu)\n--\nnet/core/sock_map.c-755-\nnet/core/sock_map.c:756:static void *sock_map_seq_next(struct seq_file *seq, void *v, loff_t *pos)\nnet/core/sock_map.c-757-\t__must_hold(rcu)\n--\nnet/core/sock_map.c-766-\nnet/core/sock_map.c:767:static int sock_map_seq_show(struct seq_file *seq, void *v)\nnet/core/sock_map.c-768-\t__must_hold(rcu)\n--\nnet/core/sock_map.c-789-\nnet/core/sock_map.c:790:static void sock_map_seq_stop(struct seq_file *seq, void *v)\nnet/core/sock_map.c-791-\t__releases(rcu)\n--\nnet/core/sock_map.c=800=static const struct seq_operations sock_map_seq_ops = {\n--\nnet/core/sock_map.c-806-\nnet/core/sock_map.c:807:static int sock_map_init_seq_private(void *priv_data,\nnet/core/sock_map.c-808-\t\t\t\t struct bpf_iter_aux_info *aux)\n--\nnet/core/sock_map.c-816-\nnet/core/sock_map.c:817:static void sock_map_fini_seq_private(void *priv_data)\nnet/core/sock_map.c-818-{\n--\nnet/core/sock_map.c-823-\nnet/core/sock_map.c:824:static u64 sock_map_mem_usage(const struct bpf_map *map)\nnet/core/sock_map.c-825-{\n--\nnet/core/sock_map.c=869=struct bpf_shtab {\n--\nnet/core/sock_map.c-877-\nnet/core/sock_map.c:878:static inline u32 sock_hash_bucket_hash(const void *key, u32 len)\nnet/core/sock_map.c-879-{\n--\nnet/core/sock_map.c-882-\nnet/core/sock_map.c:883:static struct bpf_shtab_bucket *sock_hash_select_bucket(struct bpf_shtab *htab,\nnet/core/sock_map.c-884-\t\t\t\t\t\t\tu32 hash)\n--\nnet/core/sock_map.c=890=sock_hash_lookup_elem_raw(struct hlist_head *head, u32 hash, void *key,\n--\nnet/core/sock_map.c-903-\nnet/core/sock_map.c:904:static struct sock *__sock_hash_lookup_elem(struct bpf_map *map, void *key)\nnet/core/sock_map.c-905-{\n--\nnet/core/sock_map.c-919-\nnet/core/sock_map.c:920:static void sock_hash_free_elem(struct bpf_shtab *htab,\nnet/core/sock_map.c-921-\t\t\t\tstruct bpf_shtab_elem *elem)\n--\nnet/core/sock_map.c-926-\nnet/core/sock_map.c:927:static void sock_hash_delete_from_link(struct bpf_map *map, struct sock *sk,\nnet/core/sock_map.c-928-\t\t\t\t void *link_raw)\n--\nnet/core/sock_map.c-951-\nnet/core/sock_map.c:952:static long sock_hash_delete_elem(struct bpf_map *map, void *key)\nnet/core/sock_map.c-953-{\n--\nnet/core/sock_map.c-974-\nnet/core/sock_map.c:975:static struct bpf_shtab_elem *sock_hash_alloc_elem(struct bpf_shtab *htab,\nnet/core/sock_map.c-976-\t\t\t\t\t\t void *key, u32 key_size,\n--\nnet/core/sock_map.c-1001-\nnet/core/sock_map.c:1002:static int sock_hash_update_common(struct bpf_map *map, void *key,\nnet/core/sock_map.c-1003-\t\t\t\t struct sock *sk, u64 flags)\n--\nnet/core/sock_map.c-1066-\nnet/core/sock_map.c:1067:static int sock_hash_get_next_key(struct bpf_map *map, void *key,\nnet/core/sock_map.c-1068-\t\t\t\t void *key_next)\n--\nnet/core/sock_map.c-1106-\nnet/core/sock_map.c:1107:static struct bpf_map *sock_hash_alloc(union bpf_attr *attr)\nnet/core/sock_map.c-1108-{\n--\n\n"
} |
| 37/2 | 2026/10/22 17:01 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 27458 output: 280 thoughts: 1588 Thoughts: **Analysis of Potential Fuzzing Targets in the Sockmap/skmsg Subsystem** Alright, let's break this down. I'm looking at these patch changes and immediately my attention is drawn to the functions involved in the sockmap and skmsg interaction. Specifically, I've identified several key entry points: `sk_psock_start_strp`, `sk_psock_stop_strp`, `sk_psock_start_verdict`, `sk_psock_stop_verdict`, and `sk_psock_drop` in `skmsg.c`. I'm also considering `sock_map_link`, `sock_map_del_link`, `sock_map_init_proto`, and `sock_map_update_elem_sys` from `sock_map.c` because of their role in linking, unlinking, and initializing these structures. I'm focusing on these because they represent potential boundary conditions or points of synchronization that could expose concurrency bugs. The fact that `sock_map_link` and `sock_map_del_link` are called by `sock_map_update_elem_sys` are important. The call graph is simple enough for my analysis. The potential fuzzing entry points that I have identified are: - `sk_psock_start_strp` - `sk_psock_stop_strp` - `sk_psock_start_verdict` - `sk_psock_stop_verdict` - `sk_psock_drop` - `sock_map_link` - `sock_map_del_link` - `sock_map_init_proto` - `sock_map_update_elem_sys` Next, I need to confirm the required Kconfig settings. It looks like this functionality depends on `BPF_SYSCALL`, `BPF_STREAM_PARSER`, `NET`, `INET`, and `CGROUP_BPF`. `NET_SOCK_MSG` is also involved, and will be selected by the other options. Okay, let's see... none of these functions are generic, common code. They are highly specific to the sockmap and psock infrastructure, which is exactly what I'm looking for. This makes them good candidates. Finally, I'm reviewing the context. The patch adds concurrency protection to the `psock->saved_data_ready`, `psock->psock_update_sk_prot`, and `sk->sk_prot` fields. This immediately screams potential race conditions. Given the nature of sockmap – socket attachment, stream parsing, verdict callbacks, and protocol updates all happening within a BPF context – these functions are likely to be accessed concurrently. Concurrency and teardown races, especially within a BPF context, are often a recipe for use-after-free, null pointer dereferences, and all kinds of nasty state inconsistencies. This is a very strong signal that this patch is worth a thorough fuzzing campaign. The confluence of specific, non-general purpose, functionality with added concurrency protections makes the target very promising for identifying memory safety violations and logic flaws. I'm confident in the analysis. Time to set results. |
| 38/2 | 2026/10/22 17:02 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_STREAM_PARSER",
"NET",
"INET",
"CGROUP_BPF"
],
"FocusSymbols": [
"sk_psock_start_strp",
"sk_psock_stop_strp",
"sk_psock_start_verdict",
"sk_psock_stop_verdict",
"sk_psock_drop",
"sock_map_del_link",
"sock_map_init_proto",
"sock_map_link",
"sock_map_update_elem_sys"
],
"Reasoning": "The patch modifies BPF sockmap and skmsg handling by introducing READ_ONCE/WRITE_ONCE memory ordering primitives around psock proto update callbacks (psock_update_sk_prot), data_ready callbacks (saved_data_ready), and protocol structure references (sk-\u003esk_prot) across skmsg and sockmap setup/teardown paths. These paths are reachable from userspace via BPF sockmap syscall operations and socket events, where concurrent socket updates and closures have historically been prone to race conditions and lifetime issues. Therefore, this warrants fuzzing.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_STREAM_PARSER",
"NET",
"INET",
"CGROUP_BPF"
],
"FocusSymbols": [
"sk_psock_start_strp",
"sk_psock_stop_strp",
"sk_psock_start_verdict",
"sk_psock_stop_verdict",
"sk_psock_drop",
"sock_map_del_link",
"sock_map_init_proto",
"sock_map_link",
"sock_map_update_elem_sys"
],
"Reasoning": "The patch modifies BPF sockmap and skmsg handling by introducing READ_ONCE/WRITE_ONCE memory ordering primitives around psock proto update callbacks (psock_update_sk_prot), data_ready callbacks (saved_data_ready), and protocol structure references (sk-\u003esk_prot) across skmsg and sockmap setup/teardown paths. These paths are reachable from userspace via BPF sockmap syscall operations and socket events, where concurrent socket updates and closures have historically been prone to race conditions and lifetime issues. Therefore, this warrants fuzzing.",
"WorthFuzzing": true
} |
| 39/1 | 2026/10/22 17:02 | action | If |
0mArgs:{
"WorthFuzzing": true
}Results: null |
| 40/2 | 2026/10/22 17:02 | agent | kmsan-evaluator |
0mModel:core Args: null Results: {
"KMSANReasoning": "The patch introduces READ_ONCE and WRITE_ONCE annotations to prevent compiler reordering and data races when accessing function pointers (such as `sk-\u003esk_prot`, `psock-\u003esaved_data_ready`, and `psock-\u003epsock_update_sk_prot`) in skmsg and sock_map. All newly introduced local variables are immediately initialized via READ_ONCE before being checked or invoked. The patch does not touch any data copying to userspace (no info-leaks), does not alter buffer allocations, sizes, or bounds, and introduces no risk of accessing uninitialized memory. Any concurrency issues, races, or invalid pointer dereferences are under the scope of KCSAN/KASAN, making a dedicated KMSAN fuzzing session unnecessary.",
"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 2f5a3ff7ad7529fe5574fc99ced96d2895c5e087
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 22 16:57:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index d5e35f24738d5..cb17426f63beb 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -488,8 +488,11 @@ static inline void sk_psock_cork_free(struct sk_psock *psock)
static inline void sk_psock_restore_proto(struct sock *sk,
struct sk_psock *psock)
{
- if (psock->psock_update_sk_prot)
- psock->psock_update_sk_prot(sk, psock, true);
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
+
+ update_proto = READ_ONCE(psock->psock_update_sk_prot);
+ if (update_proto)
+ update_proto(sk, psock, true);
}
static inline struct sk_psock *sk_psock_get(struct sock *sk)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index df385a5a961e8..54d832039f094 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1167,22 +1167,25 @@ int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock)
void sk_psock_start_strp(struct sock *sk, struct sk_psock *psock)
{
- if (psock->saved_data_ready)
+ if (READ_ONCE(psock->saved_data_ready))
return;
- psock->saved_data_ready = sk->sk_data_ready;
+ WRITE_ONCE(psock->saved_data_ready, READ_ONCE(sk->sk_data_ready));
WRITE_ONCE(sk->sk_data_ready, sk_psock_strp_data_ready);
WRITE_ONCE(sk->sk_write_space, sk_psock_write_space);
}
void sk_psock_stop_strp(struct sock *sk, struct sk_psock *psock)
{
+ void (*saved_data_ready)(struct sock *sk);
+
psock_set_prog(&psock->progs.stream_parser, NULL);
- if (!psock->saved_data_ready)
+ saved_data_ready = READ_ONCE(psock->saved_data_ready);
+ if (!saved_data_ready)
return;
- WRITE_ONCE(sk->sk_data_ready, psock->saved_data_ready);
+ WRITE_ONCE(sk->sk_data_ready, saved_data_ready);
WRITE_ONCE(psock->saved_data_ready, NULL);
strp_stop(&psock->strp);
}
@@ -1260,22 +1263,25 @@ static void sk_psock_verdict_data_ready(struct sock *sk)
void sk_psock_start_verdict(struct sock *sk, struct sk_psock *psock)
{
- if (psock->saved_data_ready)
+ if (READ_ONCE(psock->saved_data_ready))
return;
- psock->saved_data_ready = sk->sk_data_ready;
+ WRITE_ONCE(psock->saved_data_ready, READ_ONCE(sk->sk_data_ready));
WRITE_ONCE(sk->sk_data_ready, sk_psock_verdict_data_ready);
WRITE_ONCE(sk->sk_write_space, sk_psock_write_space);
}
void sk_psock_stop_verdict(struct sock *sk, struct sk_psock *psock)
{
+ void (*saved_data_ready)(struct sock *sk);
+
psock_set_prog(&psock->progs.stream_verdict, NULL);
psock_set_prog(&psock->progs.skb_verdict, NULL);
- if (!psock->saved_data_ready)
+ saved_data_ready = READ_ONCE(psock->saved_data_ready);
+ if (!saved_data_ready)
return;
- WRITE_ONCE(sk->sk_data_ready, psock->saved_data_ready);
- psock->saved_data_ready = NULL;
+ WRITE_ONCE(sk->sk_data_ready, saved_data_ready);
+ WRITE_ONCE(psock->saved_data_ready, NULL);
}
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 38df842843289..4dc69316ac170 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -145,6 +145,7 @@ static void sock_map_del_link(struct sock *sk,
{
bool strp_stop = false, verdict_stop = false;
struct sk_psock_link *link, *tmp;
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
spin_lock_bh(&psock->link_lock);
list_for_each_entry_safe(link, tmp, &psock->link, list) {
@@ -152,11 +153,11 @@ static void sock_map_del_link(struct sock *sk,
struct bpf_map *map = link->map;
struct sk_psock_progs *progs = sock_map_progs(map);
- if (psock->saved_data_ready && progs->stream_parser)
+ if (READ_ONCE(psock->saved_data_ready) && progs->stream_parser)
strp_stop = true;
- if (psock->saved_data_ready && progs->stream_verdict)
+ if (READ_ONCE(psock->saved_data_ready) && progs->stream_verdict)
verdict_stop = true;
- if (psock->saved_data_ready && progs->skb_verdict)
+ if (READ_ONCE(psock->saved_data_ready) && progs->skb_verdict)
verdict_stop = true;
list_del(&link->list);
sk_psock_free_link(link);
@@ -171,8 +172,9 @@ static void sock_map_del_link(struct sock *sk,
if (verdict_stop)
sk_psock_stop_verdict(sk, psock);
- if (psock->psock_update_sk_prot)
- psock->psock_update_sk_prot(sk, psock, false);
+ update_proto = READ_ONCE(psock->psock_update_sk_prot);
+ if (update_proto)
+ update_proto(sk, psock, false);
write_unlock_bh(&sk->sk_callback_lock);
}
}
@@ -189,10 +191,13 @@ static void sock_map_unref(struct sock *sk, void *link_raw)
static int sock_map_init_proto(struct sock *sk, struct sk_psock *psock)
{
- if (!sk->sk_prot->psock_update_sk_prot)
+ int (*update_proto)(struct sock *sk, struct sk_psock *psock, bool restore);
+
+ update_proto = READ_ONCE(sk->sk_prot)->psock_update_sk_prot;
+ if (!update_proto)
return -EINVAL;
- psock->psock_update_sk_prot = sk->sk_prot->psock_update_sk_prot;
- return sk->sk_prot->psock_update_sk_prot(sk, psock, false);
+ WRITE_ONCE(psock->psock_update_sk_prot, update_proto);
+ return update_proto(sk, psock, false);
}
static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)
@@ -202,7 +207,7 @@ static struct sk_psock *sock_map_psock_get_checked(struct sock *sk)
rcu_read_lock();
psock = sk_psock(sk);
if (psock) {
- if (sk->sk_prot->close != sock_map_close) {
+ if (READ_ONCE(sk->sk_prot)->close != sock_map_close) {
psock = ERR_PTR(-EBUSY);
goto out;
}
@@ -303,7 +308,8 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
}
write_lock_bh(&sk->sk_callback_lock);
- if (stream_parser && stream_verdict && !psock->saved_data_ready) {
+ if (stream_parser && stream_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
if (sk_is_tcp(sk))
ret = sk_psock_init_strp(sk, psock);
else
@@ -314,9 +320,11 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
goto out;
}
sk_psock_start_strp(sk, psock);
- } else if (!stream_parser && stream_verdict && !psock->saved_data_ready) {
+ } else if (!stream_parser && stream_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
sk_psock_start_verdict(sk,psock);
- } else if (!stream_verdict && skb_verdict && !psock->saved_data_ready) {
+ } else if (!stream_verdict && skb_verdict &&
+ !READ_ONCE(psock->saved_data_ready)) {
sk_psock_start_verdict(sk, psock);
}
write_unlock_bh(&sk->sk_callback_lock);
@@ -536,7 +544,7 @@ static bool sock_map_redirect_allowed(const struct sock *sk)
static bool sock_map_sk_is_suitable(const struct sock *sk)
{
- return !!sk->sk_prot->psock_update_sk_prot;
+ return !!READ_ONCE(sk->sk_prot)->psock_update_sk_prot;
}
static bool sock_map_sk_state_allowed(const struct sock *sk)
|
| 41/3 | 2026/10/22 17:02 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 4877 output: 185 thoughts: 1374 Thoughts: **KMSAN Fuzzing Evaluation** Alright, let's break this down. The question is, does this patch warrant a KMSAN fuzzing session? Time to analyze. The patch itself is straightforward. It's adding `READ_ONCE` and `WRITE_ONCE` annotations across a few files to protect against potential data races. Specifically, it's touching `skmsg.h`, `skmsg.c`, and `sock_map.c`. From a quick glance, it looks like these annotations are being applied around accesses to function pointers within the `sk` and `psock` structures: `psock_update_sk_prot` and `saved_data_ready`, and `sk->sk_prot`. These are likely related to race conditions or compiler optimizations that could lead to unexpected behavior during concurrent access. Now, does this patch introduce any KMSAN-relevant issues? Let's go through the checklist. 1. **Kernel Structures to Userspace?** Nope. No new structures are being sent to userspace, and there's no indication of modified fields or padding that could lead to uninitialized data exposure. 2. **Conditional Logic with Uninitialized Data?** Let's delve into the function-local variables. We've got variables like `update_proto` and `saved_data_ready`, all function pointers, but they're *always* initialized immediately with `READ_ONCE` before use. The code then checks and calls them. No chance of conditional logic depending on an uninitialized variable. 3. **Complex Data Structure Initialization?** Nope. No new data structures are being allocated or initialized here. 4. **Bounds Checks/Length Calculations?** Nope. Nothing like that is happening. The core of the patch is simply about adding `READ_ONCE/WRITE_ONCE` primitives to ensure atomic access and prevent races on these existing function pointers. No data is being copied to userspace, no new buffers are allocated or manipulated, and we're not dealing with uninitialized memory reads or exposure. Therefore, my initial instinct is that this patch *doesn't* warrant a dedicated KMSAN fuzzing session. This is more of a concurrency correctness issue. Bugs related to race conditions or dangling pointers would be likely caught by KASAN/KCSAN or standard kernel detectors, not KMSAN. The focus here is on ensuring that these function pointers are accessed safely in a concurrent environment, which is what `READ_ONCE` and `WRITE_ONCE` are designed for. Time to call the `set-results` tool. |
| 42/3 | 2026/10/22 17:02 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch introduces READ_ONCE and WRITE_ONCE annotations to prevent compiler reordering and data races when accessing function pointers (such as `sk-\u003esk_prot`, `psock-\u003esaved_data_ready`, and `psock-\u003epsock_update_sk_prot`) in skmsg and sock_map. All newly introduced local variables are immediately initialized via READ_ONCE before being checked or invoked. The patch does not touch any data copying to userspace (no info-leaks), does not alter buffer allocations, sizes, or bounds, and introduces no risk of accessing uninitialized memory. Any concurrency issues, races, or invalid pointer dereferences are under the scope of KCSAN/KASAN, making a dedicated KMSAN fuzzing session unnecessary.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch introduces READ_ONCE and WRITE_ONCE annotations to prevent compiler reordering and data races when accessing function pointers (such as `sk-\u003esk_prot`, `psock-\u003esaved_data_ready`, and `psock-\u003epsock_update_sk_prot`) in skmsg and sock_map. All newly introduced local variables are immediately initialized via READ_ONCE before being checked or invoked. The patch does not touch any data copying to userspace (no info-leaks), does not alter buffer allocations, sizes, or bounds, and introduces no risk of accessing uninitialized memory. Any concurrency issues, races, or invalid pointer dereferences are under the scope of KCSAN/KASAN, making a dedicated KMSAN fuzzing session unnecessary.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|