AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/07/02 06:29 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "sock_map_update_elem_sys",
    "sock_map_update_elem",
    "sock_map_sk_state_allowed"
  ],
  "Reasoning": "The patch modifies core BPF sockmap logic to reject unbound UDP sockets from being added to a sockmap. This prevents potential bugs or crashes caused by uninitialized or unhashed sockets interacting with BPF programs. This is a functional change in reachable kernel code that alters execution flow. Fuzzing the map update functions with various socket states is necessary to ensure the fix is robust and doesn't introduce regressions.",
  "WorthFuzzing": true
}

1/1 2026/07/02 06:29 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 35b12b214cf76aa9d8cf8e62ea6208d1c067edc8\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Thu Jul 2 06:29:21 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/net/core/sock_map.c b/net/core/sock_map.c\nindex c60ba6d292f9ae..9efbd8ca7db832 100644\n--- a/net/core/sock_map.c\n+++ b/net/core/sock_map.c\n@@ -542,6 +542,8 @@ static bool sock_map_sk_state_allowed(const struct sock *sk)\n {\n \tif (sk_is_tcp(sk))\n \t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 (TCPF_ESTABLISHED | TCPF_LISTEN);\n+\tif (sk_is_udp(sk))\n+\t\treturn sk_hashed(sk);\n \tif (sk_is_stream_unix(sk))\n \t\treturn (1 \u003c\u003c READ_ONCE(sk-\u003esk_state)) \u0026 TCPF_ESTABLISHED;\n \tif (sk_is_vsock(sk) \u0026\u0026\ndiff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c\nindex cb3229711f93a3..2d22a9058a8e92 100644\n--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c\n+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c\n@@ -853,7 +853,7 @@ static void test_sockmap_many_socket(void)\n \t\treturn;\n \t}\n \n-\tudp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);\n+\tudp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);\n \tif (udp \u003c 0) {\n \t\tclose(dgram);\n \t\tclose(tcp);\n@@ -922,7 +922,7 @@ static void test_sockmap_many_maps(void)\n \t\treturn;\n \t}\n \n-\tudp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);\n+\tudp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);\n \tif (udp \u003c 0) {\n \t\tclose(dgram);\n \t\tclose(tcp);\n@@ -993,7 +993,7 @@ static void test_sockmap_same_sock(void)\n \t\treturn;\n \t}\n \n-\tudp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);\n+\tudp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);\n \tif (udp \u003c 0) {\n \t\tclose(dgram);\n \t\tclose(tcp);\ndiff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c\nindex cc0c68bab90796..b87118aab7c4a3 100644\n--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c\n+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c\n@@ -53,8 +53,8 @@ static void test_insert_opened(struct test_sockmap_listen *skel __always_unused,\n \t\t\t       int family, int sotype, int mapfd)\n {\n \tu32 key = 0;\n-\tu64 value;\n \tint err, s;\n+\tu64 value;\n \n \ts = xsocket(family, sotype, 0);\n \tif (s == -1)\n@@ -63,11 +63,8 @@ static void test_insert_opened(struct test_sockmap_listen *skel __always_unused,\n \terrno = 0;\n \tvalue = s;\n \terr = bpf_map_update_elem(mapfd, \u0026key, \u0026value, BPF_NOEXIST);\n-\tif (sotype == SOCK_STREAM) {\n-\t\tif (!err || errno != EOPNOTSUPP)\n-\t\t\tFAIL_ERRNO(\"map_update: expected EOPNOTSUPP\");\n-\t} else if (err)\n-\t\tFAIL_ERRNO(\"map_update: expected success\");\n+\tASSERT_ERR(err, \"map_update\");\n+\tASSERT_EQ(errno, EOPNOTSUPP, \"errno\");\n \txclose(s);\n }\n \n@@ -77,8 +74,8 @@ static void test_insert_bound(struct test_sockmap_listen *skel __always_unused,\n \tstruct sockaddr_storage addr;\n \tsocklen_t len = 0;\n \tu32 key = 0;\n-\tu64 value;\n \tint err, s;\n+\tu64 value;\n \n \tinit_addr_loopback(family, \u0026addr, \u0026len);\n \n@@ -93,8 +90,12 @@ static void test_insert_bound(struct test_sockmap_listen *skel __always_unused,\n \terrno = 0;\n \tvalue = s;\n \terr = bpf_map_update_elem(mapfd, \u0026key, \u0026value, BPF_NOEXIST);\n-\tif (!err || errno != EOPNOTSUPP)\n-\t\tFAIL_ERRNO(\"map_update: expected EOPNOTSUPP\");\n+\tif (sotype == SOCK_STREAM) {\n+\t\tASSERT_ERR(err, \"map_update\");\n+\t\tASSERT_EQ(errno, EOPNOTSUPP, \"errno\");\n+\t} else if (err) {\n+\t\tASSERT_OK(err, \"map_update\");\n+\t}\n close:\n \txclose(s);\n }\n@@ -1289,7 +1290,7 @@ static void test_ops(struct test_sockmap_listen *skel, struct bpf_map *map,\n \t\t/* insert */\n \t\tTEST(test_insert_invalid),\n \t\tTEST(test_insert_opened),\n-\t\tTEST(test_insert_bound, SOCK_STREAM),\n+\t\tTEST(test_insert_bound),\n \t\tTEST(test_insert),\n \t\t/* delete */\n \t\tTEST(test_delete_after_insert),\ndiff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c\nindex c32da7bd8be276..6a2641ee789754 100644\n--- a/tools/testing/selftests/bpf/test_maps.c\n+++ b/tools/testing/selftests/bpf/test_maps.c\n@@ -759,16 +759,15 @@ static void test_sockmap(unsigned int tasks, void *data)\n \t\tgoto out_sockmap;\n \t}\n \n-\t/* Test update with unsupported UDP socket */\n+\t/* Test update with unsupported unbound UDP socket */\n \tudp = socket(AF_INET, SOCK_DGRAM, 0);\n-\ti = 0;\n-\terr = bpf_map_update_elem(fd, \u0026i, \u0026udp, BPF_ANY);\n-\tif (err) {\n-\t\tprintf(\"Failed socket update SOCK_DGRAM '%i:%i'\\n\",\n-\t\t       i, udp);\n+\tCHECK(udp \u003c 0, \"socket(AF_INET, SOCK_DGRAM)\", \"errno:%d\\n\", errno);\n+\terr = bpf_map_update_elem(fd, \u0026(int){0}, \u0026udp, BPF_ANY);\n+\tclose(udp);\n+\tif (!err) {\n+\t\tprintf(\"Unexpectedly succeeded unbound UDP update '0:%i'\\n\", udp);\n \t\tgoto out_sockmap;\n \t}\n-\tclose(udp);\n \n \t/* Test update without programs */\n \tfor (i = 0; i \u003c 6; i++) {\n"
}

2/1 2026/07/02 06:29 agent patch-evaluator
1m Model:
gemini-3.1-pro-preview

Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "sock_map_update_elem_sys",
    "sock_map_update_elem",
    "sock_map_sk_state_allowed"
  ],
  "Reasoning": "The patch modifies core BPF sockmap logic to reject unbound UDP sockets from being added to a sockmap. This prevents potential bugs or crashes caused by uninitialized or unhashed sockets interacting with BPF programs. This is a functional change in reachable kernel code that alters execution flow. Fuzzing the map update functions with various socket states is necessary to ensure the fix is robust and doesn't introduce regressions.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Do not list too generic configs (we already have them enabled). Only list those that
   specifically cover the modified code. List them in the EnableConfigs output array,
   and DO NOT add a '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:
For your convenience, here is the diff of the changes:
commit 35b12b214cf76aa9d8cf8e62ea6208d1c067edc8
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Jul 2 06:29:21 2026 +0000

    syz-cluster: applied patch under review

diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index c60ba6d292f9ae..9efbd8ca7db832 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -542,6 +542,8 @@ static bool sock_map_sk_state_allowed(const struct sock *sk)
 {
 	if (sk_is_tcp(sk))
 		return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_LISTEN);
+	if (sk_is_udp(sk))
+		return sk_hashed(sk);
 	if (sk_is_stream_unix(sk))
 		return (1 << READ_ONCE(sk->sk_state)) & TCPF_ESTABLISHED;
 	if (sk_is_vsock(sk) &&
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
index cb3229711f93a3..2d22a9058a8e92 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
@@ -853,7 +853,7 @@ static void test_sockmap_many_socket(void)
 		return;
 	}
 
-	udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+	udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
 	if (udp < 0) {
 		close(dgram);
 		close(tcp);
@@ -922,7 +922,7 @@ static void test_sockmap_many_maps(void)
 		return;
 	}
 
-	udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+	udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
 	if (udp < 0) {
 		close(dgram);
 		close(tcp);
@@ -993,7 +993,7 @@ static void test_sockmap_same_sock(void)
 		return;
 	}
 
-	udp = xsocket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
+	udp = socket_loopback(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK);
 	if (udp < 0) {
 		close(dgram);
 		close(tcp);
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
index cc0c68bab90796..b87118aab7c4a3 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -53,8 +53,8 @@ static void test_insert_opened(struct test_sockmap_listen *skel __always_unused,
 			       int family, int sotype, int mapfd)
 {
 	u32 key = 0;
-	u64 value;
 	int err, s;
+	u64 value;
 
 	s = xsocket(family, sotype, 0);
 	if (s == -1)
@@ -63,11 +63,8 @@ static void test_insert_opened(struct test_sockmap_listen *skel __always_unused,
 	errno = 0;
 	value = s;
 	err = bpf_map_update_elem(mapfd, &key, &value, BPF_NOEXIST);
-	if (sotype == SOCK_STREAM) {
-		if (!err || errno != EOPNOTSUPP)
-			FAIL_ERRNO("map_update: expected EOPNOTSUPP");
-	} else if (err)
-		FAIL_ERRNO("map_update: expected success");
+	ASSERT_ERR(err, "map_update");
+	ASSERT_EQ(errno, EOPNOTSUPP, "errno");
 	xclose(s);
 }
 
@@ -77,8 +74,8 @@ static void test_insert_bound(struct test_sockmap_listen *skel __always_unused,
 	struct sockaddr_storage addr;
 	socklen_t len = 0;
 	u32 key = 0;
-	u64 value;
 	int err, s;
+	u64 value;
 
 	init_addr_loopback(family, &addr, &len);
 
@@ -93,8 +90,12 @@ static void test_insert_bound(struct test_sockmap_listen *skel __always_unused,
 	errno = 0;
 	value = s;
 	err = bpf_map_update_elem(mapfd, &key, &value, BPF_NOEXIST);
-	if (!err || errno != EOPNOTSUPP)
-		FAIL_ERRNO("map_update: expected EOPNOTSUPP");
+	if (sotype == SOCK_STREAM) {
+		ASSERT_ERR(err, "map_update");
+		ASSERT_EQ(errno, EOPNOTSUPP, "errno");
+	} else if (err) {
+		ASSERT_OK(err, "map_update");
+	}
 close:
 	xclose(s);
 }
@@ -1289,7 +1290,7 @@ static void test_ops(struct test_sockmap_listen *skel, struct bpf_map *map,
 		/* insert */
 		TEST(test_insert_invalid),
 		TEST(test_insert_opened),
-		TEST(test_insert_bound, SOCK_STREAM),
+		TEST(test_insert_bound),
 		TEST(test_insert),
 		/* delete */
 		TEST(test_delete_after_insert),
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index c32da7bd8be276..6a2641ee789754 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -759,16 +759,15 @@ static void test_sockmap(unsigned int tasks, void *data)
 		goto out_sockmap;
 	}
 
-	/* Test update with unsupported UDP socket */
+	/* Test update with unsupported unbound UDP socket */
 	udp = socket(AF_INET, SOCK_DGRAM, 0);
-	i = 0;
-	err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY);
-	if (err) {
-		printf("Failed socket update SOCK_DGRAM '%i:%i'\n",
-		       i, udp);
+	CHECK(udp < 0, "socket(AF_INET, SOCK_DGRAM)", "errno:%d\n", errno);
+	err = bpf_map_update_elem(fd, &(int){0}, &udp, BPF_ANY);
+	close(udp);
+	if (!err) {
+		printf("Unexpectedly succeeded unbound UDP update '0:%i'\n", udp);
 		goto out_sockmap;
 	}
-	close(udp);
 
 	/* Test update without programs */
 	for (i = 0; i < 6; i++) {

3/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 3639
							output: 23
							thoughts: 280
						

Thoughts:
**Analyzing the Sockmap Patch**

Okay, so I'm looking at this patch for `net/core/sock_map.c` and some associated selftests. The core of the change seems to be within the `sock_map_sk_state_allowed` function. My initial impression is that they've added explicit handling for UDP sockets. Before, it looks like UDP sockets were implicitly *disallowed* because they weren't explicitly handled in this function. If it wasn't TCP, stream Unix sockets or vsock it would fall through to the default of returning false.

Now, with this new code, a UDP socket is allowed in the sockmap if it's hashed, indicated by `sk_hashed(sk)`. This makes sense in the context of wanting to add a UDP socket to a sockmap; typically, you'd only want to track sockets that are actively participating in communication. Hashing implies that the socket is bound and likely receiving traffic. I should confirm that `sk_hashed` means what I think it means here. I'll need to check the exact definition in the kernel code. Let me double-check that. This approach seems reasonable. Let me pull up the relevant code and confirm the default return value if this wasn't called.



4/2 2026/07/02 06:29 tool grepper
0m Args:
{
  "Expression": "sock_map_sk_state_allowed"
}

Results:
{
  "Output": "net/core/sock_map.c=536=static bool sock_map_sk_is_suitable(const struct sock *sk)\n--\nnet/core/sock_map.c-540-\nnet/core/sock_map.c:541:static bool sock_map_sk_state_allowed(const struct sock *sk)\nnet/core/sock_map.c-542-{\n--\nnet/core/sock_map.c=558=int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\n--\nnet/core/sock_map.c-586-\tsock_map_sk_acquire(sk);\nnet/core/sock_map.c:587:\tif (!sock_map_sk_state_allowed(sk))\nnet/core/sock_map.c-588-\t\tret = -EOPNOTSUPP;\n--\nnet/core/sock_map.c=599=static long sock_map_update_elem(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-612-\tbh_lock_sock(sk);\nnet/core/sock_map.c:613:\tif (!sock_map_sk_state_allowed(sk))\nnet/core/sock_map.c-614-\t\tret = -EOPNOTSUPP;\n"
}

5/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 4567
							output: 37
							thoughts: 19
						

Thoughts:
Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:

**Analyzing the `sock_map_sk_state_allowed` Function**

Alright, before I make any judgements or draw any conclusions, I need to get the full picture. My first instinct is to understand the context and the implementation details of this function, `sock_map_sk_state_allowed`. I need to see *everything*. What are the inputs? What's the core logic? What are the potential exit paths and error conditions? Without that holistic view, I'm just shooting in the dark. So, let's get the whole definition, and then we'll start picking it apart piece by piece.



6/2 2026/07/02 06:29 tool read-file
0m Args:
{
  "File": "net/core/sock_map.c",
  "FirstLine": 540,
  "LineCount": 20
}

Results:
{
  "Contents": " 540:\t\n 541:\tstatic bool sock_map_sk_state_allowed(const struct sock *sk)\n 542:\t{\n 543:\t\tif (sk_is_tcp(sk))\n 544:\t\t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 (TCPF_ESTABLISHED | TCPF_LISTEN);\n 545:\t\tif (sk_is_udp(sk))\n 546:\t\t\treturn sk_hashed(sk);\n 547:\t\tif (sk_is_stream_unix(sk))\n 548:\t\t\treturn (1 \u003c\u003c READ_ONCE(sk-\u003esk_state)) \u0026 TCPF_ESTABLISHED;\n 549:\t\tif (sk_is_vsock(sk) \u0026\u0026\n 550:\t\t    (sk-\u003esk_type == SOCK_STREAM || sk-\u003esk_type == SOCK_SEQPACKET))\n 551:\t\t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 TCPF_ESTABLISHED;\n 552:\t\treturn true;\n 553:\t}\n 554:\t\n 555:\tstatic int sock_hash_update_common(struct bpf_map *map, void *key,\n 556:\t\t\t\t\t   struct sock *sk, u64 flags);\n 557:\t\n 558:\tint sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\n 559:\t\t\t\t     u64 flags)\n"
}

7/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 5161
							output: 19
							thoughts: 52
						

Thoughts:
Okay, here's my interpretation of those thoughts, presented as my own mental process:

**Diving into the Socket Logic**

Right, so the code's default behavior is to simply `return true;`. That immediately makes me wonder... if that's the base case, what was happening with UDP sockets before? A simple "true" return would have permitted UDP sockets regardless of their state or any other specific criteria. That seems like a pretty broad allowance. I need to figure out what was specifically allowing or disallowing sockets.

I need to dive into the checks. I'll start with `sock_map_sk_is_suitable`, but I should broaden the search to other functions and checks nearby. It could be that something else in the logic was silently overruling that default, or providing context to the `return true;`. Let's dig in and see.



8/2 2026/07/02 06:29 tool grepper
0m Args:
{
  "Expression": "sk_is_udp"
}

Results:
{
  "Output": "include/net/sock.h=2965=static inline bool sk_is_tcp(const struct sock *sk)\n--\ninclude/net/sock.h-2971-\ninclude/net/sock.h:2972:static inline bool sk_is_udp(const struct sock *sk)\ninclude/net/sock.h-2973-{\n--\nnet/core/filter.c=11814=BPF_CALL_3(bpf_sk_lookup_assign, struct bpf_sk_lookup_kern *, ctx,\n--\nnet/core/filter.c-11823-\t\treturn -ESOCKTNOSUPPORT; /* only accept TCP socket in LISTEN */\nnet/core/filter.c:11824:\tif (unlikely(sk \u0026\u0026 sk_is_udp(sk) \u0026\u0026 sk-\u003esk_state != TCP_CLOSE))\nnet/core/filter.c-11825-\t\treturn -ESOCKTNOSUPPORT; /* only accept UDP socket in CLOSE */\n--\nnet/core/sock.c=4463=bool sk_busy_loop_end(void *p, unsigned long start_time)\n--\nnet/core/sock.c-4469-\nnet/core/sock.c:4470:\tif (sk_is_udp(sk) \u0026\u0026\nnet/core/sock.c-4471-\t    !skb_queue_empty_lockless(\u0026udp_sk(sk)-\u003ereader_queue))\n--\nnet/core/sock_map.c=541=static bool sock_map_sk_state_allowed(const struct sock *sk)\n--\nnet/core/sock_map.c-544-\t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 (TCPF_ESTABLISHED | TCPF_LISTEN);\nnet/core/sock_map.c:545:\tif (sk_is_udp(sk))\nnet/core/sock_map.c-546-\t\treturn sk_hashed(sk);\n--\nsecurity/landlock/net.c=301=static int hook_socket_bind(struct socket *const sock,\n--\nsecurity/landlock/net.c-307-\t\taccess_request = LANDLOCK_ACCESS_NET_BIND_TCP;\nsecurity/landlock/net.c:308:\telse if (sk_is_udp(sock-\u003esk))\nsecurity/landlock/net.c-309-\t\taccess_request = LANDLOCK_ACCESS_NET_BIND_UDP;\n--\nsecurity/landlock/net.c=317=static int hook_socket_connect(struct socket *const sock,\n--\nsecurity/landlock/net.c-325-\t\taccess_request = LANDLOCK_ACCESS_NET_CONNECT_TCP;\nsecurity/landlock/net.c:326:\telse if (sk_is_udp(sock-\u003esk))\nsecurity/landlock/net.c-327-\t\taccess_request = LANDLOCK_ACCESS_NET_CONNECT_SEND_UDP;\n--\nsecurity/landlock/net.c-337-\t */\nsecurity/landlock/net.c:338:\tif (ret == 0 \u0026\u0026 sk_is_udp(sock-\u003esk) \u0026\u0026\nsecurity/landlock/net.c-339-\t    addrlen \u003e= offsetofend(typeof(*address), sa_family) \u0026\u0026\n--\nsecurity/landlock/net.c=346=static int hook_socket_sendmsg(struct socket *const sock,\n--\nsecurity/landlock/net.c-353-\nsecurity/landlock/net.c:354:\tif (sk_is_udp(sock-\u003esk))\nsecurity/landlock/net.c-355-\t\taccess_request = LANDLOCK_ACCESS_NET_CONNECT_SEND_UDP;\n"
}

9/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 6339
							output: 37
							thoughts: 385
						

Thoughts:
**Analyzing the UDP Socket Restriction in the Patch**

Okay, so I'm looking at this patch and my initial thought is, "Wait, if the original behavior defaulted to `return true;`, that meant *unbound* UDP sockets were previously allowed in this scenario?" Interesting...

Now the patch introduces this specific check:

```c
	if (sk_is_udp(sk))
		return sk_hashed(sk);
```

This *explicitly* restricts UDP sockets to only those that are hashed – meaning, bound to an address and port, correct? This seems pretty straightforward, limiting the flexibility in how UDP sockets are handled.

The selftest changes are where it becomes clearer. They are designed to confirm this behavior change. Before it looks like the test expected that updating with an unsupported UDP socket would fail. Now, the comment specifically says it's testing with an "unbound UDP socket". The test now creates a UDP socket, attempts the map update, closes the socket and checks for an error. The crucial part is the `CHECK(udp < 0, "socket(AF_INET, SOCK_DGRAM)", "errno:%d\n", errno);` line, and the subsequent error checking in the `if (!err)` statement. It *expects* an error, but if the update unexpectedly succeeds, it throws an error.

But here's where it gets fuzzy. If the *old* test already expected failure (as indicated by the "unsupported UDP socket" comment), then *why* did it fail *before* the patch? That's the key question. Did the older implementation have some unintended behavior?

I need to dig into `sock_map_update_elem_sys` or maybe `sock_map_sk_is_suitable` to see what exactly was going on *before* this restriction was introduced. I need to understand what was preventing an unbound UDP socket from being "suitable" in the first place, or if something else entirely was the issue.



10/2 2026/07/02 06:29 tool read-file
0m Args:
{
  "File": "net/core/sock_map.c",
  "FirstLine": 520,
  "LineCount": 20
}

Results:
{
  "Contents": " 520:\t\n 521:\tstatic bool sock_map_op_okay(const struct bpf_sock_ops_kern *ops)\n 522:\t{\n 523:\t\treturn ops-\u003eop == BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB ||\n 524:\t\t       ops-\u003eop == BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB ||\n 525:\t\t       ops-\u003eop == BPF_SOCK_OPS_TCP_LISTEN_CB;\n 526:\t}\n 527:\t\n 528:\tstatic bool sock_map_redirect_allowed(const struct sock *sk)\n 529:\t{\n 530:\t\tif (sk_is_tcp(sk))\n 531:\t\t\treturn sk-\u003esk_state != TCP_LISTEN;\n 532:\t\telse\n 533:\t\t\treturn READ_ONCE(sk-\u003esk_state) == TCP_ESTABLISHED;\n 534:\t}\n 535:\t\n 536:\tstatic bool sock_map_sk_is_suitable(const struct sock *sk)\n 537:\t{\n 538:\t\treturn !!sk-\u003esk_prot-\u003epsock_update_sk_prot;\n 539:\t}\n"
}

11/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 7510
							output: 23
							thoughts: 530
						

Thoughts:
**Unraveling the UDP Sockmap Mystery**

Okay, so I'm diving into this `sock_map_sk_is_suitable` function and how it interacts with UDP sockets. I see that it checks `sk->sk_prot->psock_update_sk_prot`, and for UDP, that function is indeed set. That's good, seems like the pieces are in place. But wait, something's not adding up. I remember seeing a comment in an old selftest about "unsupported UDP socket" and that's throwing me off. If `psock_update_sk_prot` is present, why was UDP considered unsupported at some point?

Let me double-check that old selftest code... Aha! It used to try adding a UDP socket like this: `err = bpf_map_update_elem(fd, &i, &udp, BPF_ANY);` and *expected* it to succeed! The code explicitly checked `if (err) { printf("Failed socket update..."); goto out_sockmap; }`, indicating a successful update was the expectation. The comment said "unsupported", but the test was expecting success? This is confusing.

No, wait, I'm misreading the logic. A non-zero `err` meant it *failed*. So it *did* expect success originally, which contradicts the "unsupported" comment. Okay, I think I'm following now. Looking at the patch, the test has changed. Now, it explicitly *expects* failure: `if (!err) { printf("Unexpectedly succeeded unbound UDP update '0:%i'\n", udp); goto out_sockmap; }`. So, unbound UDP sockets *used* to be added successfully.

So, previously, unbound UDP sockets *could* be added? But why was this considered a problem? I'm guessing that unbound UDP sockets, being in an incomplete state before they're fully initialized or hashed, might cause issues when BPF programs try to interact with them through the sockmap. It's a race condition or a potential for undefined behavior.

I'm pretty sure I need to dig into the commit message or the associated issue tracker to get the full context on *why* this change was made.



12/2 2026/07/02 06:29 tool grepper
0m Args:
{
  "Expression": "sock_map_sk_state_allowed"
}

Results:
{
  "Output": "net/core/sock_map.c=536=static bool sock_map_sk_is_suitable(const struct sock *sk)\n--\nnet/core/sock_map.c-540-\nnet/core/sock_map.c:541:static bool sock_map_sk_state_allowed(const struct sock *sk)\nnet/core/sock_map.c-542-{\n--\nnet/core/sock_map.c=558=int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\n--\nnet/core/sock_map.c-586-\tsock_map_sk_acquire(sk);\nnet/core/sock_map.c:587:\tif (!sock_map_sk_state_allowed(sk))\nnet/core/sock_map.c-588-\t\tret = -EOPNOTSUPP;\n--\nnet/core/sock_map.c=599=static long sock_map_update_elem(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-612-\tbh_lock_sock(sk);\nnet/core/sock_map.c:613:\tif (!sock_map_sk_state_allowed(sk))\nnet/core/sock_map.c-614-\t\tret = -EOPNOTSUPP;\n"
}

13/2 2026/07/02 06:29 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 8896
							output: 23
							thoughts: 660
						

Thoughts:
**Worth Fuzzing This Patch? Yes.**

Okay, let's break this down. This patch introduces a check within `sock_map_sk_state_allowed`, specifically `if (sk_is_udp(sk)) return sk_hashed(sk);`. My initial thought was, is this even worth fuzzing? It seems like a minor restriction on the types of UDP sockets that can be added to a sockmap. I'd be looking at fuzzing `bpf_map_update_elem` on a sockmap, targeting a UDP socket. But, as a bug fix that restricts behavior, the primary goal *isn't* to uncover brand new code paths, and may *prevent* some undefined behavior.

The patch's goal appears to prevent a bug related to using unbound UDP sockets in a sockmap, perhaps a null pointer dereference or similar. The patch is *already* applied, so any immediate bug won't be exposed during fuzzing. But the key is whether it introduces *new* functional logic worth testing.

The addition of `sk_hashed(sk)` for UDP sockets seemed simple on the surface:

```c
static inline int sk_hashed(const struct sock *sk)
{
	return !sk_unhashed(sk);
}
```

It is a basic state check. Typically, these simple checks—`if (!foo) return -EINVAL;`—don't necessarily introduce complex fuzzing targets.

However, the bigger picture is that this code modifies `sock_map_sk_state_allowed`, which is *core* BPF sockmap logic. That's a key part of the execution flow in the kernel and something that *is* reachable.

Then the prompt's criteria really clarifies it:

*   Not just documentation, logging, or constants.
*   It alters execution flow by rejecting unbound UDP sockets (which can alter *behaviour*), *and* modifies core kernel logic (`net/core/sock_map.c`).

Therefore, even though it's a bug fix, and doesn't inherently uncover new code paths, it *does* change reachable core kernel logic. It looks like the patch does warrant fuzzing.

My next step is to nail down the function calls. The patch targets a static function `sock_map_sk_state_allowed`, and it looks like that is called by `sock_map_update_elem_sys` and `sock_map_update_elem`. So now I would be looking for where *those* functions are called.



14/2 2026/07/02 06:30 tool grepper
0m Args:
{
  "Expression": "sock_map_update_elem_sys"
}

Results:
{
  "Output": "include/linux/bpf.h=3659=int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);\ninclude/linux/bpf.h:3660:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);\ninclude/linux/bpf.h-3661-int sock_map_bpf_prog_query(const union bpf_attr *attr,\n--\ninclude/linux/bpf.h=3745=static inline int sock_map_prog_detach(const union bpf_attr *attr,\n--\ninclude/linux/bpf.h-3750-\ninclude/linux/bpf.h:3751:static inline int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\ninclude/linux/bpf.h-3752-\t\t\t\t\t   u64 flags)\n--\nkernel/bpf/syscall.c=251=static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,\n--\nkernel/bpf/syscall.c-264-\t\t   map-\u003emap_type == BPF_MAP_TYPE_SOCKMAP) {\nkernel/bpf/syscall.c:265:\t\treturn sock_map_update_elem_sys(map, key, value, flags);\nkernel/bpf/syscall.c-266-\t} else if (IS_FD_PROG_ARRAY(map)) {\n--\nnet/core/sock_map.c=555=static int sock_hash_update_common(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-557-\nnet/core/sock_map.c:558:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\nnet/core/sock_map.c-559-\t\t\t     u64 flags)\n"
}

15/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 10639
							output: 21
							thoughts: 73
						

Thoughts:
Here's my understanding of the situation, given my expertise:

**My Perspective on the SOCKMAP/SOCKHASH Update Process**

Okay, so I'm tracking the flow of data updating in the BPF world, specifically around SOCKMAP and SOCKHASH, and I see a clear distinction in how this happens from userspace versus within BPF programs themselves. `sock_map_update_elem_sys` is the kernel function that gets called when a user-space application wants to update a SOCKMAP or SOCKHASH. It seems it is hooked to `bpf_map_update_value` within the `kernel/bpf/syscall.c` file, which makes sense because syscalls are the gateway for userspace interactions with the kernel. I understand that.

On the other hand, the `sock_map_update_elem` function is a BPF helper that BPF programs themselves use to update these maps. This distinction is crucial because it highlights the separation of concerns. User-space has a controlled interface through syscalls, while BPF programs, running within the BPF VM, have their own optimized helpers for map manipulation. This setup suggests careful consideration of security, performance, and the integrity of the BPF environment. I'm noting this is a standard pattern, and the code looks as it should for this scenario.



16/2 2026/07/02 06:30 tool grepper
0m Args:
{
  "Expression": "sock_map_update_elem"
}

Results:
{
  "Output": "include/linux/bpf.h=3659=int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);\ninclude/linux/bpf.h:3660:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);\ninclude/linux/bpf.h-3661-int sock_map_bpf_prog_query(const union bpf_attr *attr,\n--\ninclude/linux/bpf.h=3745=static inline int sock_map_prog_detach(const union bpf_attr *attr,\n--\ninclude/linux/bpf.h-3750-\ninclude/linux/bpf.h:3751:static inline int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\ninclude/linux/bpf.h-3752-\t\t\t\t\t   u64 flags)\n--\nkernel/bpf/syscall.c=251=static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,\n--\nkernel/bpf/syscall.c-264-\t\t   map-\u003emap_type == BPF_MAP_TYPE_SOCKMAP) {\nkernel/bpf/syscall.c:265:\t\treturn sock_map_update_elem_sys(map, key, value, flags);\nkernel/bpf/syscall.c-266-\t} else if (IS_FD_PROG_ARRAY(map)) {\n--\nnet/core/sock_map.c=555=static int sock_hash_update_common(struct bpf_map *map, void *key,\n--\nnet/core/sock_map.c-557-\nnet/core/sock_map.c:558:int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\nnet/core/sock_map.c-559-\t\t\t     u64 flags)\n--\nnet/core/sock_map.c-598-\nnet/core/sock_map.c:599:static long sock_map_update_elem(struct bpf_map *map, void *key,\nnet/core/sock_map.c-600-\t\t\t\t void *value, u64 flags)\n--\nnet/core/sock_map.c=831=const struct bpf_map_ops sock_map_ops = {\n--\nnet/core/sock_map.c-836-\t.map_lookup_elem_sys_only = sock_map_lookup_sys,\nnet/core/sock_map.c:837:\t.map_update_elem\t= sock_map_update_elem,\nnet/core/sock_map.c-838-\t.map_delete_elem\t= sock_map_delete_elem,\n--\nnet/core/sock_map.c=1447=const struct bpf_map_ops sock_hash_ops = {\n--\nnet/core/sock_map.c-1451-\t.map_get_next_key\t= sock_hash_get_next_key,\nnet/core/sock_map.c:1452:\t.map_update_elem\t= sock_map_update_elem,\nnet/core/sock_map.c-1453-\t.map_delete_elem\t= sock_hash_delete_elem,\n"
}

17/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11880
							output: 28
							thoughts: 185
						

Thoughts:
**Focusing on BPF Sockmap Update Functions**

Okay, so I'm thinking we need to zero in on a few key symbols here. Definitely, `sock_map_update_elem_sys` and `sock_map_update_elem` are primary targets. But, hold on a second... `sock_map_update_elem` is a *static* function, which is interesting. It's actually assigned to `map_update_elem` within both `sock_map_ops` and `sock_hash_ops`, which is something to keep in mind for tracing the call flow.

Hmm, and what about `sock_map_sk_state_allowed`? That's also a static function, but it's the one that's actually *modified* at runtime, making it crucial to understand how state changes are managed within this context. I think we need to include that in our scope as well.

So, to be clear, the primary symbols of interest are: `sock_map_update_elem_sys`, `sock_map_update_elem`, and `sock_map_sk_state_allowed`.

Now, regarding the overall configuration of this feature. This is BPF sockmap, right? Let's check `net/core/Makefile` or `net/core/Kconfig` to see if there are any specific configurations relating to `sock_map.c`. That should give us a clearer picture of how it's enabled and configured at compile time.



18/2 2026/07/02 06:30 tool grepper
0m Args:
{
  "Expression": "sock_map",
  "PathPrefix": "net/core/Makefile"
}

Results:
{
  "Output": "net/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"
}

19/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 12510
							output: 37
							thoughts: 47
						

Thoughts:
Okay, let's see, my initial assessment here hinges entirely on the `CONFIG_BPF_SYSCALL` configuration option. Is that the *only* configuration variable impacting this section of code? I need to be sure. I'm going to quickly check for others.

Alright, now that I have a handle on that, I'll need to confirm what the actual impacted code is. To do that, I'll need to go to `net/core/sock_map.c` and comb through it. I'll be looking specifically for any `#ifdef` preprocessor directives surrounding the code that has been modified. This will reveal the conditions under which this code is compiled and, therefore, the broader implications of this modification.



20/2 2026/07/02 06:30 tool read-file
0m Args:
{
  "File": "net/core/sock_map.c",
  "FirstLine": 530,
  "LineCount": 30
}

Results:
{
  "Contents": " 530:\t\tif (sk_is_tcp(sk))\n 531:\t\t\treturn sk-\u003esk_state != TCP_LISTEN;\n 532:\t\telse\n 533:\t\t\treturn READ_ONCE(sk-\u003esk_state) == TCP_ESTABLISHED;\n 534:\t}\n 535:\t\n 536:\tstatic bool sock_map_sk_is_suitable(const struct sock *sk)\n 537:\t{\n 538:\t\treturn !!sk-\u003esk_prot-\u003epsock_update_sk_prot;\n 539:\t}\n 540:\t\n 541:\tstatic bool sock_map_sk_state_allowed(const struct sock *sk)\n 542:\t{\n 543:\t\tif (sk_is_tcp(sk))\n 544:\t\t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 (TCPF_ESTABLISHED | TCPF_LISTEN);\n 545:\t\tif (sk_is_udp(sk))\n 546:\t\t\treturn sk_hashed(sk);\n 547:\t\tif (sk_is_stream_unix(sk))\n 548:\t\t\treturn (1 \u003c\u003c READ_ONCE(sk-\u003esk_state)) \u0026 TCPF_ESTABLISHED;\n 549:\t\tif (sk_is_vsock(sk) \u0026\u0026\n 550:\t\t    (sk-\u003esk_type == SOCK_STREAM || sk-\u003esk_type == SOCK_SEQPACKET))\n 551:\t\t\treturn (1 \u003c\u003c sk-\u003esk_state) \u0026 TCPF_ESTABLISHED;\n 552:\t\treturn true;\n 553:\t}\n 554:\t\n 555:\tstatic int sock_hash_update_common(struct bpf_map *map, void *key,\n 556:\t\t\t\t\t   struct sock *sk, u64 flags);\n 557:\t\n 558:\tint sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value,\n 559:\t\t\t\t     u64 flags)\n"
}

21/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13277
							output: 18
							thoughts: 126
						

Thoughts:
**Investigating UDP Sockmap Configuration Requirements**

Okay, so I'm looking at this code and I'm not seeing any preprocessor directives around `sock_map_sk_state_allowed`. That means `CONFIG_BPF_SYSCALL` is the primary, if not only, enabler here. But, I need to be sure about UDP. Is there a more specific config for UDP beyond something like `CONFIG_INET` which is just too broad?

Hang on a second… the object file, `sock_map.o`, gets built when `CONFIG_BPF_SYSCALL` is active. Hmm, that's promising. But does that mean it's all I need? To be absolutely certain about UDP sockmap support, I should check the implementation files in the kernel. Let me look at `net/ipv4/udp_bpf.c` or something similar for any potential configuration dependencies related to UDP specifically. That should confirm if there are any other specific config options to test UDP sockmap.



22/2 2026/07/02 06:30 tool grepper
0m Args:
{
  "Expression": "udp_bpf"
}

Results:
{
  "Output": "MAINTAINERS=4972=F:\tnet/ipv4/tcp_bpf.c\nMAINTAINERS:4973:F:\tnet/ipv4/udp_bpf.c\nMAINTAINERS-4974-F:\tnet/unix/unix_bpf.c\n--\ninclude/net/udp.h=652=struct sk_psock;\ninclude/net/udp.h:653:int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);\ninclude/net/udp.h-654-#endif\n--\nnet/ipv4/Makefile=63=obj-$(CONFIG_NET_SOCK_MSG) += tcp_bpf.o\nnet/ipv4/Makefile:64:obj-$(CONFIG_BPF_SYSCALL) += udp_bpf.o\nnet/ipv4/Makefile-65-obj-$(CONFIG_NETLABEL) += cipso_ipv4.o\n--\nnet/ipv4/udp.c=3110=struct proto udp_prot = {\n--\nnet/ipv4/udp.c-3131-#ifdef CONFIG_BPF_SYSCALL\nnet/ipv4/udp.c:3132:\t.psock_update_sk_prot\t= udp_bpf_update_proto,\nnet/ipv4/udp.c-3133-#endif\n--\nnet/ipv4/udp_bpf.c=37=static int udp_msg_wait_data(struct sock *sk, struct sk_psock *psock,\n--\nnet/ipv4/udp_bpf.c-62-\nnet/ipv4/udp_bpf.c:63:static int udp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,\nnet/ipv4/udp_bpf.c-64-\t\t\t   int flags)\n--\nnet/ipv4/udp_bpf.c=119=static DEFINE_SPINLOCK(udpv6_prot_lock);\nnet/ipv4/udp_bpf.c:120:static struct proto udp_bpf_prots[UDP_BPF_NUM_PROTS];\nnet/ipv4/udp_bpf.c-121-\nnet/ipv4/udp_bpf.c:122:static int udp_bpf_ioctl(struct sock *sk, int cmd, int *karg)\nnet/ipv4/udp_bpf.c-123-{\n--\nnet/ipv4/udp_bpf.c-134-\nnet/ipv4/udp_bpf.c:135:static void udp_bpf_rebuild_protos(struct proto *prot, const struct proto *base)\nnet/ipv4/udp_bpf.c-136-{\n--\nnet/ipv4/udp_bpf.c-138-\tprot-\u003eclose\t\t= sock_map_close;\nnet/ipv4/udp_bpf.c:139:\tprot-\u003erecvmsg\t\t= udp_bpf_recvmsg;\nnet/ipv4/udp_bpf.c-140-\tprot-\u003esock_is_readable\t= sk_msg_is_readable;\nnet/ipv4/udp_bpf.c:141:\tprot-\u003eioctl\t\t= udp_bpf_ioctl;\nnet/ipv4/udp_bpf.c-142-}\nnet/ipv4/udp_bpf.c-143-\nnet/ipv4/udp_bpf.c:144:static void udp_bpf_check_v6_needs_rebuild(struct proto *ops)\nnet/ipv4/udp_bpf.c-145-{\n--\nnet/ipv4/udp_bpf.c-148-\t\tif (likely(ops != udpv6_prot_saved)) {\nnet/ipv4/udp_bpf.c:149:\t\t\tudp_bpf_rebuild_protos(\u0026udp_bpf_prots[UDP_BPF_IPV6], ops);\nnet/ipv4/udp_bpf.c-150-\t\t\tsmp_store_release(\u0026udpv6_prot_saved, ops);\n--\nnet/ipv4/udp_bpf.c-155-\nnet/ipv4/udp_bpf.c:156:static int __init udp_bpf_v4_build_proto(void)\nnet/ipv4/udp_bpf.c-157-{\nnet/ipv4/udp_bpf.c:158:\tudp_bpf_rebuild_protos(\u0026udp_bpf_prots[UDP_BPF_IPV4], \u0026udp_prot);\nnet/ipv4/udp_bpf.c-159-\treturn 0;\nnet/ipv4/udp_bpf.c-160-}\nnet/ipv4/udp_bpf.c:161:late_initcall(udp_bpf_v4_build_proto);\nnet/ipv4/udp_bpf.c-162-\nnet/ipv4/udp_bpf.c:163:int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)\nnet/ipv4/udp_bpf.c-164-{\n--\nnet/ipv4/udp_bpf.c-173-\tif (sk-\u003esk_family == AF_INET6)\nnet/ipv4/udp_bpf.c:174:\t\tudp_bpf_check_v6_needs_rebuild(psock-\u003esk_proto);\nnet/ipv4/udp_bpf.c-175-\nnet/ipv4/udp_bpf.c:176:\tsock_replace_proto(sk, \u0026udp_bpf_prots[family]);\nnet/ipv4/udp_bpf.c-177-\treturn 0;\nnet/ipv4/udp_bpf.c-178-}\nnet/ipv4/udp_bpf.c:179:EXPORT_SYMBOL_GPL(udp_bpf_update_proto);\n--\nnet/ipv6/udp.c=1879=struct proto udpv6_prot = {\n--\nnet/ipv6/udp.c-1900-#ifdef CONFIG_BPF_SYSCALL\nnet/ipv6/udp.c:1901:\t.psock_update_sk_prot\t= udp_bpf_update_proto,\nnet/ipv6/udp.c-1902-#endif\n"
}

23/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 15243
							output: 21
							thoughts: 157
						

Thoughts:
**Analyzing BPF Socket Map Updates**

Okay, so it looks like `CONFIG_BPF_SYSCALL` is the crucial configuration option, as expected. Now, let's take a quick look at the key symbols involved in this socket map update path. I need to understand what we're dealing with to consider vulnerabilities.

The primary functions to consider are:
*   `sock_map_update_elem_sys`
*   `sock_map_update_elem`
*   `sock_map_sk_state_allowed`

Hmm, `sock_map_sk_state_allowed`... that's a static function, and it looks small. Direct fuzzing might be tricky if the compiler inlines it, but syzkaller should be able to handle that. I'm pretty sure syzkaller can figure that stuff out.

Is there any other function? I should probably check `sock_hash_update_elem`. Let me double-check `net/core/sock_map.c` for that. I need to make sure I've identified all the relevant entry points.



24/2 2026/07/02 06:30 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "sock_hash_update_elem"
}

Results:
{
  "error": "no matches"
}

25/2 2026/07/02 06:30 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 15672
							output: 154
							thoughts: 389
						

Thoughts:
**Analyzing the Sockmap Update Logic**

Okay, so I'm diving into this `sock_hash_ops` structure and immediately spot that it leverages `sock_map_update_elem`, right? That's the key entry point. And then, from there, we have `sock_map_update_elem_sys` which is also relevant. Given my familiarity with BPF, it's pretty clear this is accessed through the BPF syscall, so it's a critical path. It looks like `sock_map_update_elem_sys` is actually invoked by `bpf_map_update_value`, so they are all connected.

Now, let's understand *why* this matters. The patch's reasoning is clear: it's about preventing unbound UDP sockets from being added to the sockmap, which could lead to instability. The core of this fix lies in the changes to `sock_map_sk_state_allowed`. This function now filters out unbound UDP sockets, ensuring that only valid states are processed by BPF programs. This seems to be a functional change that alters how things are handled. So fuzzing the map update functions with various socket states is essential for ensuring robustness.

I need to confirm the visibility of `sock_map_sk_state_allowed`, because it's marked `static`. Looking at the definition, it's static but not explicitly marked `inline`, so it's fine to list it and it should be visible to us.

The critical symbols here are: `sock_map_update_elem_sys`, `sock_map_update_elem`, and `sock_map_sk_state_allowed`.

Let's use the `set-results` tool and take it from there.



26/2 2026/07/02 06:30 tool set-results
0m Args:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "sock_map_update_elem_sys",
    "sock_map_update_elem",
    "sock_map_sk_state_allowed"
  ],
  "Reasoning": "The patch modifies core BPF sockmap logic to reject unbound UDP sockets from being added to a sockmap. This prevents potential bugs or crashes caused by uninitialized or unhashed sockets interacting with BPF programs. This is a functional change in reachable kernel code that alters execution flow. Fuzzing the map update functions with various socket states is necessary to ensure the fix is robust and doesn't introduce regressions.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "sock_map_update_elem_sys",
    "sock_map_update_elem",
    "sock_map_sk_state_allowed"
  ],
  "Reasoning": "The patch modifies core BPF sockmap logic to reject unbound UDP sockets from being added to a sockmap. This prevents potential bugs or crashes caused by uninitialized or unhashed sockets interacting with BPF programs. This is a functional change in reachable kernel code that alters execution flow. Fuzzing the map update functions with various socket states is necessary to ensure the fix is robust and doesn't introduce regressions.",
  "WorthFuzzing": true
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)