| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/06/26 18:29 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"VSOCKETS",
"VIRTIO_VSOCKETS",
"VHOST_VSOCK",
"VSOCKETS_LOOPBACK"
],
"FocusSymbols": [
"virtio_transport_collapse_rx_queue",
"virtio_transport_collapse_size",
"virtio_transport_can_collapse"
],
"Reasoning": "This patch introduces a mechanism to collapse small packets in the virtio vsock receive queue to prevent connection resets under memory pressure. It modifies core vsock virtio transport logic which is reachable and functional. Fuzzing should focus on the newly added collapse functions.",
"WorthFuzzing": true
} |
| 1/1 | 2026/06/26 18:29 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit fa5899fedafdc7bea8b023a1ae63404b43028888\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Jun 26 18:29:34 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c\nindex 09475007165b36..304ea424995d4d 100644\n--- a/net/vmw_vsock/virtio_transport_common.c\n+++ b/net/vmw_vsock/virtio_transport_common.c\n@@ -420,6 +420,137 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,\n \treturn ret;\n }\n \n+static bool virtio_transport_can_collapse(struct sk_buff *skb,\n+\t\t\t\t\t unsigned int size)\n+{\n+\t/* skbs that are partially consumed, mark a SEQPACKET message boundary,\n+\t * or are already large enough should not be collapsed: they either\n+\t * need special accounting, carry protocol state, or already have a\n+\t * good data-to-overhead ratio.\n+\t */\n+\tif (VIRTIO_VSOCK_SKB_CB(skb)-\u003eoffset)\n+\t\treturn false;\n+\tif (le32_to_cpu(virtio_vsock_hdr(skb)-\u003eflags) \u0026 VIRTIO_VSOCK_SEQ_EOM)\n+\t\treturn false;\n+\tif (skb-\u003elen \u003e= size)\n+\t\treturn false;\n+\treturn true;\n+}\n+\n+/* Iterate through the packets in the queue starting from the current skb to\n+ * count the number of bytes we can collapse.\n+ */\n+static unsigned int\n+virtio_transport_collapse_size(struct sk_buff *skb,\n+\t\t\t struct sk_buff_head *queue,\n+\t\t\t unsigned int max_size)\n+{\n+\tunsigned int target = skb-\u003elen - VIRTIO_VSOCK_SKB_CB(skb)-\u003eoffset;\n+\n+\twhile ((skb = skb_peek_next(skb, queue)) \u0026\u0026\n+\t virtio_transport_can_collapse(skb, max_size)) {\n+\t\tunsigned int len = skb-\u003elen - VIRTIO_VSOCK_SKB_CB(skb)-\u003eoffset;\n+\n+\t\tif (len \u003e max_size - target)\n+\t\t\treturn target;\n+\n+\t\ttarget += len;\n+\t}\n+\n+\treturn target;\n+}\n+\n+/* Called under lock_sock when skb overhead exceeds the budget. */\n+static void virtio_transport_collapse_rx_queue(struct virtio_vsock_sock *vvs)\n+{\n+\t/* Use the same linear allocation threshold as virtio_vsock_alloc_skb()\n+\t * to avoid adding pressure on the page allocator.\n+\t */\n+\tunsigned int collapse_max = SKB_MAX_ORDER(VIRTIO_VSOCK_SKB_HEADROOM,\n+\t\t\t\t\t\t PAGE_ALLOC_COSTLY_ORDER);\n+\tstruct sk_buff *skb, *next_skb, *new_skb = NULL;\n+\tstruct sk_buff_head new_queue;\n+\n+\t__skb_queue_head_init(\u0026new_queue);\n+\n+\tskb_queue_walk_safe(\u0026vvs-\u003erx_queue, skb, next_skb) {\n+\t\tstruct virtio_vsock_hdr *hdr = virtio_vsock_hdr(skb);\n+\t\tu32 src_off = VIRTIO_VSOCK_SKB_CB(skb)-\u003eoffset;\n+\t\tu32 src_len = skb-\u003elen - src_off;\n+\t\tbool keep = false;\n+\n+\t\tif (!virtio_transport_can_collapse(skb, collapse_max)) {\n+\t\t\t/* Finalize pending collapsed skb to preserve packet\n+\t\t\t * ordering.\n+\t\t\t */\n+\t\t\tif (new_skb) {\n+\t\t\t\t__skb_queue_tail(\u0026new_queue, new_skb);\n+\t\t\t\tnew_skb = NULL;\n+\t\t\t}\n+\t\t\tkeep = true;\n+\t\t\tgoto next;\n+\t\t}\n+\n+\t\t/* Finalize if this packet won't fit in the remaining tailroom,\n+\t\t * so we can allocate a right-sized new_skb.\n+\t\t */\n+\t\tif (new_skb \u0026\u0026 src_len \u003e skb_tailroom(new_skb)) {\n+\t\t\t__skb_queue_tail(\u0026new_queue, new_skb);\n+\t\t\tnew_skb = NULL;\n+\t\t}\n+\n+\t\tif (!new_skb) {\n+\t\t\tunsigned int alloc_size;\n+\n+\t\t\talloc_size = virtio_transport_collapse_size(skb, \u0026vvs-\u003erx_queue,\n+\t\t\t\t\t\t\t\t collapse_max);\n+\n+\t\t\t/* Only this skb's data is eligible, nothing to merge\n+\t\t\t * with. Keep as-is.\n+\t\t\t */\n+\t\t\tif (alloc_size \u003c= src_len) {\n+\t\t\t\tkeep = true;\n+\t\t\t\tgoto next;\n+\t\t\t}\n+\n+\t\t\tnew_skb = virtio_vsock_alloc_linear_skb(alloc_size +\n+\t\t\t\t\tVIRTIO_VSOCK_SKB_HEADROOM, GFP_KERNEL);\n+\t\t\tif (!new_skb)\n+\t\t\t\tgoto out;\n+\n+\t\t\tmemcpy(virtio_vsock_hdr(new_skb), hdr,\n+\t\t\t sizeof(struct virtio_vsock_hdr));\n+\t\t\tvirtio_vsock_hdr(new_skb)-\u003elen = 0;\n+\t\t}\n+\n+\t\t/* Cannot fail since src_off/src_len are within bounds, but if\n+\t\t * it does, discard new_skb to avoid queuing corrupted data.\n+\t\t */\n+\t\tif (WARN_ON_ONCE(skb_copy_bits(skb, src_off,\n+\t\t\t\t\t skb_put(new_skb, src_len),\n+\t\t\t\t\t src_len))) {\n+\t\t\tkfree_skb(new_skb);\n+\t\t\tnew_skb = NULL;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tle32_add_cpu(\u0026virtio_vsock_hdr(new_skb)-\u003elen, src_len);\n+\t\tvirtio_vsock_hdr(new_skb)-\u003eflags |= hdr-\u003eflags;\n+\n+next:\n+\t\t__skb_unlink(skb, \u0026vvs-\u003erx_queue);\n+\t\tif (keep)\n+\t\t\t__skb_queue_tail(\u0026new_queue, skb);\n+\t\telse\n+\t\t\tconsume_skb(skb);\n+\t}\n+out:\n+\tif (new_skb)\n+\t\t__skb_queue_tail(\u0026new_queue, new_skb);\n+\n+\tskb_queue_splice(\u0026new_queue, \u0026vvs-\u003erx_queue);\n+}\n+\n static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,\n \t\t\t\t\tu32 len)\n {\n@@ -1363,8 +1494,21 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,\n \tspin_lock_bh(\u0026vvs-\u003erx_lock);\n \n \tcan_enqueue = virtio_transport_inc_rx_pkt(vvs, len);\n-\tif (!can_enqueue)\n-\t\tgoto out;\n+\tif (!can_enqueue) {\n+\t\t/* Try to collapse the receive queue to reduce skb overhead and\n+\t\t * make room for this packet.\n+\t\t * Unlock rx_lock since the collapse may sleep or, in any case,\n+\t\t * take some time to collapse the skbs, but this is safe, since\n+\t\t * sk_lock is held by caller so no one else can enqueue or\n+\t\t * dequeue.\n+\t\t */\n+\t\tspin_unlock_bh(\u0026vvs-\u003erx_lock);\n+\t\tvirtio_transport_collapse_rx_queue(vvs);\n+\t\tspin_lock_bh(\u0026vvs-\u003erx_lock);\n+\t\tcan_enqueue = virtio_transport_inc_rx_pkt(vvs, len);\n+\t\tif (!can_enqueue)\n+\t\t\tgoto out;\n+\t}\n \n \tif (le32_to_cpu(hdr-\u003eflags) \u0026 VIRTIO_VSOCK_SEQ_EOM)\n \t\tvvs-\u003emsg_count++;\ndiff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c\nindex 76be0e4a7f0ee6..b4ff9f946565b8 100644\n--- a/tools/testing/vsock/vsock_test.c\n+++ b/tools/testing/vsock/vsock_test.c\n@@ -2347,6 +2347,88 @@ static void test_stream_tx_credit_bounds_server(const struct test_opts *opts)\n \tclose(fd);\n }\n \n+/* Test that many small packets don't cause a connection reset under pressure\n+ * and that data integrity is preserved. Packet sizes vary randomly between\n+ * 129 and 512 bytes, above GOOD_COPY_LEN (128) to bypass in-place coalescing\n+ * in recv_enqueue, forcing each one into its own skb. Without receive queue\n+ * collapsing, the per-skb overhead eventually exceeds buf_alloc and the\n+ * connection is reset.\n+ */\n+#define COLLAPSE_PKT_MIN 129\n+#define COLLAPSE_PKT_MAX 512\n+#define COLLAPSE_TOTAL (2 * 1024 * 1024)\n+\n+static void test_stream_collapse_client(const struct test_opts *opts)\n+{\n+\tunsigned char *data;\n+\tunsigned long hash;\n+\tsize_t offset = 0;\n+\tint i, fd;\n+\n+\tdata = malloc(COLLAPSE_TOTAL);\n+\tif (!data) {\n+\t\tperror(\"malloc\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tfor (i = 0; i \u003c COLLAPSE_TOTAL; i++)\n+\t\tdata[i] = rand() \u0026 0xff;\n+\n+\tfd = vsock_stream_connect(opts-\u003epeer_cid, opts-\u003epeer_port);\n+\tif (fd \u003c 0) {\n+\t\tperror(\"connect\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\twhile (offset \u003c COLLAPSE_TOTAL) {\n+\t\tsize_t pkt_size = COLLAPSE_PKT_MIN +\n+\t\t\trand() % (COLLAPSE_PKT_MAX - COLLAPSE_PKT_MIN + 1);\n+\n+\t\tpkt_size = min(pkt_size, COLLAPSE_TOTAL - offset);\n+\n+\t\tsend_buf(fd, data + offset, pkt_size, 0, pkt_size);\n+\t\toffset += pkt_size;\n+\t}\n+\n+\thash = hash_djb2(data, COLLAPSE_TOTAL);\n+\tcontrol_writeulong(hash);\n+\n+\tfree(data);\n+\tclose(fd);\n+}\n+\n+static void test_stream_collapse_server(const struct test_opts *opts)\n+{\n+\tunsigned long hash, remote_hash;\n+\tunsigned char *data;\n+\tint fd;\n+\n+\tdata = malloc(COLLAPSE_TOTAL);\n+\tif (!data) {\n+\t\tperror(\"malloc\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tfd = vsock_stream_accept(VMADDR_CID_ANY, opts-\u003epeer_port, NULL);\n+\tif (fd \u003c 0) {\n+\t\tperror(\"accept\");\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\trecv_buf(fd, data, COLLAPSE_TOTAL, 0, COLLAPSE_TOTAL);\n+\n+\thash = hash_djb2(data, COLLAPSE_TOTAL);\n+\tremote_hash = control_readulong();\n+\tif (hash != remote_hash) {\n+\t\tfprintf(stderr, \"hash mismatch: local %lu remote %lu\\n\",\n+\t\t\thash, remote_hash);\n+\t\texit(EXIT_FAILURE);\n+\t}\n+\n+\tfree(data);\n+\tclose(fd);\n+}\n+\n static struct test_case test_cases[] = {\n \t{\n \t\t.name = \"SOCK_STREAM connection reset\",\n@@ -2546,6 +2628,11 @@ static struct test_case test_cases[] = {\n \t\t.run_client = test_stream_msg_peek_client,\n \t\t.run_server = test_stream_peek_after_recv_server,\n \t},\n+\t{\n+\t\t.name = \"SOCK_STREAM small packets backpressure\",\n+\t\t.run_client = test_stream_collapse_client,\n+\t\t.run_server = test_stream_collapse_server,\n+\t},\n \t{},\n };\n \n"
} |
| 2/1 | 2026/06/26 18:29 | agent | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": [
"VSOCKETS",
"VIRTIO_VSOCKETS",
"VHOST_VSOCK",
"VSOCKETS_LOOPBACK"
],
"FocusSymbols": [
"virtio_transport_collapse_rx_queue",
"virtio_transport_collapse_size",
"virtio_transport_can_collapse"
],
"Reasoning": "This patch introduces a mechanism to collapse small packets in the virtio vsock receive queue to prevent connection resets under memory pressure. It modifies core vsock virtio transport logic which is reachable and functional. Fuzzing should focus on the newly added collapse functions.",
"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 fa5899fedafdc7bea8b023a1ae63404b43028888
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Jun 26 18:29:34 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 09475007165b36..304ea424995d4d 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -420,6 +420,137 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
return ret;
}
+static bool virtio_transport_can_collapse(struct sk_buff *skb,
+ unsigned int size)
+{
+ /* skbs that are partially consumed, mark a SEQPACKET message boundary,
+ * or are already large enough should not be collapsed: they either
+ * need special accounting, carry protocol state, or already have a
+ * good data-to-overhead ratio.
+ */
+ if (VIRTIO_VSOCK_SKB_CB(skb)->offset)
+ return false;
+ if (le32_to_cpu(virtio_vsock_hdr(skb)->flags) & VIRTIO_VSOCK_SEQ_EOM)
+ return false;
+ if (skb->len >= size)
+ return false;
+ return true;
+}
+
+/* Iterate through the packets in the queue starting from the current skb to
+ * count the number of bytes we can collapse.
+ */
+static unsigned int
+virtio_transport_collapse_size(struct sk_buff *skb,
+ struct sk_buff_head *queue,
+ unsigned int max_size)
+{
+ unsigned int target = skb->len - VIRTIO_VSOCK_SKB_CB(skb)->offset;
+
+ while ((skb = skb_peek_next(skb, queue)) &&
+ virtio_transport_can_collapse(skb, max_size)) {
+ unsigned int len = skb->len - VIRTIO_VSOCK_SKB_CB(skb)->offset;
+
+ if (len > max_size - target)
+ return target;
+
+ target += len;
+ }
+
+ return target;
+}
+
+/* Called under lock_sock when skb overhead exceeds the budget. */
+static void virtio_transport_collapse_rx_queue(struct virtio_vsock_sock *vvs)
+{
+ /* Use the same linear allocation threshold as virtio_vsock_alloc_skb()
+ * to avoid adding pressure on the page allocator.
+ */
+ unsigned int collapse_max = SKB_MAX_ORDER(VIRTIO_VSOCK_SKB_HEADROOM,
+ PAGE_ALLOC_COSTLY_ORDER);
+ struct sk_buff *skb, *next_skb, *new_skb = NULL;
+ struct sk_buff_head new_queue;
+
+ __skb_queue_head_init(&new_queue);
+
+ skb_queue_walk_safe(&vvs->rx_queue, skb, next_skb) {
+ struct virtio_vsock_hdr *hdr = virtio_vsock_hdr(skb);
+ u32 src_off = VIRTIO_VSOCK_SKB_CB(skb)->offset;
+ u32 src_len = skb->len - src_off;
+ bool keep = false;
+
+ if (!virtio_transport_can_collapse(skb, collapse_max)) {
+ /* Finalize pending collapsed skb to preserve packet
+ * ordering.
+ */
+ if (new_skb) {
+ __skb_queue_tail(&new_queue, new_skb);
+ new_skb = NULL;
+ }
+ keep = true;
+ goto next;
+ }
+
+ /* Finalize if this packet won't fit in the remaining tailroom,
+ * so we can allocate a right-sized new_skb.
+ */
+ if (new_skb && src_len > skb_tailroom(new_skb)) {
+ __skb_queue_tail(&new_queue, new_skb);
+ new_skb = NULL;
+ }
+
+ if (!new_skb) {
+ unsigned int alloc_size;
+
+ alloc_size = virtio_transport_collapse_size(skb, &vvs->rx_queue,
+ collapse_max);
+
+ /* Only this skb's data is eligible, nothing to merge
+ * with. Keep as-is.
+ */
+ if (alloc_size <= src_len) {
+ keep = true;
+ goto next;
+ }
+
+ new_skb = virtio_vsock_alloc_linear_skb(alloc_size +
+ VIRTIO_VSOCK_SKB_HEADROOM, GFP_KERNEL);
+ if (!new_skb)
+ goto out;
+
+ memcpy(virtio_vsock_hdr(new_skb), hdr,
+ sizeof(struct virtio_vsock_hdr));
+ virtio_vsock_hdr(new_skb)->len = 0;
+ }
+
+ /* Cannot fail since src_off/src_len are within bounds, but if
+ * it does, discard new_skb to avoid queuing corrupted data.
+ */
+ if (WARN_ON_ONCE(skb_copy_bits(skb, src_off,
+ skb_put(new_skb, src_len),
+ src_len))) {
+ kfree_skb(new_skb);
+ new_skb = NULL;
+ goto out;
+ }
+
+ le32_add_cpu(&virtio_vsock_hdr(new_skb)->len, src_len);
+ virtio_vsock_hdr(new_skb)->flags |= hdr->flags;
+
+next:
+ __skb_unlink(skb, &vvs->rx_queue);
+ if (keep)
+ __skb_queue_tail(&new_queue, skb);
+ else
+ consume_skb(skb);
+ }
+out:
+ if (new_skb)
+ __skb_queue_tail(&new_queue, new_skb);
+
+ skb_queue_splice(&new_queue, &vvs->rx_queue);
+}
+
static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
u32 len)
{
@@ -1363,8 +1494,21 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
spin_lock_bh(&vvs->rx_lock);
can_enqueue = virtio_transport_inc_rx_pkt(vvs, len);
- if (!can_enqueue)
- goto out;
+ if (!can_enqueue) {
+ /* Try to collapse the receive queue to reduce skb overhead and
+ * make room for this packet.
+ * Unlock rx_lock since the collapse may sleep or, in any case,
+ * take some time to collapse the skbs, but this is safe, since
+ * sk_lock is held by caller so no one else can enqueue or
+ * dequeue.
+ */
+ spin_unlock_bh(&vvs->rx_lock);
+ virtio_transport_collapse_rx_queue(vvs);
+ spin_lock_bh(&vvs->rx_lock);
+ can_enqueue = virtio_transport_inc_rx_pkt(vvs, len);
+ if (!can_enqueue)
+ goto out;
+ }
if (le32_to_cpu(hdr->flags) & VIRTIO_VSOCK_SEQ_EOM)
vvs->msg_count++;
diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
index 76be0e4a7f0ee6..b4ff9f946565b8 100644
--- a/tools/testing/vsock/vsock_test.c
+++ b/tools/testing/vsock/vsock_test.c
@@ -2347,6 +2347,88 @@ static void test_stream_tx_credit_bounds_server(const struct test_opts *opts)
close(fd);
}
+/* Test that many small packets don't cause a connection reset under pressure
+ * and that data integrity is preserved. Packet sizes vary randomly between
+ * 129 and 512 bytes, above GOOD_COPY_LEN (128) to bypass in-place coalescing
+ * in recv_enqueue, forcing each one into its own skb. Without receive queue
+ * collapsing, the per-skb overhead eventually exceeds buf_alloc and the
+ * connection is reset.
+ */
+#define COLLAPSE_PKT_MIN 129
+#define COLLAPSE_PKT_MAX 512
+#define COLLAPSE_TOTAL (2 * 1024 * 1024)
+
+static void test_stream_collapse_client(const struct test_opts *opts)
+{
+ unsigned char *data;
+ unsigned long hash;
+ size_t offset = 0;
+ int i, fd;
+
+ data = malloc(COLLAPSE_TOTAL);
+ if (!data) {
+ perror("malloc");
+ exit(EXIT_FAILURE);
+ }
+
+ for (i = 0; i < COLLAPSE_TOTAL; i++)
+ data[i] = rand() & 0xff;
+
+ fd = vsock_stream_connect(opts->peer_cid, opts->peer_port);
+ if (fd < 0) {
+ perror("connect");
+ exit(EXIT_FAILURE);
+ }
+
+ while (offset < COLLAPSE_TOTAL) {
+ size_t pkt_size = COLLAPSE_PKT_MIN +
+ rand() % (COLLAPSE_PKT_MAX - COLLAPSE_PKT_MIN + 1);
+
+ pkt_size = min(pkt_size, COLLAPSE_TOTAL - offset);
+
+ send_buf(fd, data + offset, pkt_size, 0, pkt_size);
+ offset += pkt_size;
+ }
+
+ hash = hash_djb2(data, COLLAPSE_TOTAL);
+ control_writeulong(hash);
+
+ free(data);
+ close(fd);
+}
+
+static void test_stream_collapse_server(const struct test_opts *opts)
+{
+ unsigned long hash, remote_hash;
+ unsigned char *data;
+ int fd;
+
+ data = malloc(COLLAPSE_TOTAL);
+ if (!data) {
+ perror("malloc");
+ exit(EXIT_FAILURE);
+ }
+
+ fd = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL);
+ if (fd < 0) {
+ perror("accept");
+ exit(EXIT_FAILURE);
+ }
+
+ recv_buf(fd, data, COLLAPSE_TOTAL, 0, COLLAPSE_TOTAL);
+
+ hash = hash_djb2(data, COLLAPSE_TOTAL);
+ remote_hash = control_readulong();
+ if (hash != remote_hash) {
+ fprintf(stderr, "hash mismatch: local %lu remote %lu\n",
+ hash, remote_hash);
+ exit(EXIT_FAILURE);
+ }
+
+ free(data);
+ close(fd);
+}
+
static struct test_case test_cases[] = {
{
.name = "SOCK_STREAM connection reset",
@@ -2546,6 +2628,11 @@ static struct test_case test_cases[] = {
.run_client = test_stream_msg_peek_client,
.run_server = test_stream_peek_after_recv_server,
},
+ {
+ .name = "SOCK_STREAM small packets backpressure",
+ .run_client = test_stream_collapse_client,
+ .run_server = test_stream_collapse_server,
+ },
{},
};
|
| 3/2 | 2026/06/26 18:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 4789 output: 36 thoughts: 207 Thoughts: **Analyzing the Vsock Virtio Transport Collapse Patch** Okay, so I've got this patch here that's making changes to `net/vmw_vsock/virtio_transport_common.c`. It's introducing a few new functions: `virtio_transport_collapse_rx_queue`, `virtio_transport_collapse_size`, and `virtio_transport_can_collapse`. From what I can tell, it looks like `virtio_transport_collapse_rx_queue` is being called within `virtio_transport_recv_enqueue`, specifically when `virtio_transport_inc_rx_pkt` returns false. This is pretty significant; it's right in the heart of the vsock virtio transport logic, managing the receive queue and optimizing it by collapsing SKBs to reduce overhead. Functionally, this looks like a good change. My spidey-sense is telling me this is definitely a good candidate for fuzzing. We're directly manipulating the receive path in a critical area. Now, let's figure out what CONFIG options enable this functionality. The code itself is in `net/vmw_vsock/virtio_transport_common.c`, so I'll check either `net/vmw_vsock/Makefile` or `net/vmw_vsock/Kconfig` to see which configuration knobs control it. Finding the relevant config options will be key to creating a reproducible test environment. |
| 4/2 | 2026/06/26 18:29 | tool | grepper |
0mArgs:{
"Expression": "virtio_transport_common.o",
"PathPrefix": "net/vmw_vsock/"
}Results: {
"Output": "net/vmw_vsock/Makefile=5=obj-$(CONFIG_VIRTIO_VSOCKETS) += vmw_vsock_virtio_transport.o\nnet/vmw_vsock/Makefile:6:obj-$(CONFIG_VIRTIO_VSOCKETS_COMMON) += vmw_vsock_virtio_transport_common.o\nnet/vmw_vsock/Makefile-7-obj-$(CONFIG_HYPERV_VSOCKETS) += hv_sock.o\n--\nnet/vmw_vsock/Makefile=18=vmw_vsock_virtio_transport-y += virtio_transport.o\nnet/vmw_vsock/Makefile-19-\nnet/vmw_vsock/Makefile:20:vmw_vsock_virtio_transport_common-y += virtio_transport_common.o\nnet/vmw_vsock/Makefile-21-\n"
} |
| 5/2 | 2026/06/26 18:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 5567 output: 37 thoughts: 63 Thoughts: Okay, let's break this down. **Understanding the Virtio vsock Configuration** Right, so `CONFIG_VIRTIO_VSOCKETS_COMMON` is the core piece here, the foundation. But it's not usually directly selected, it's typically brought in transitively through either `CONFIG_VIRTIO_VSOCKETS` or `CONFIG_VHOST_VSOCK`. Makes sense, the common stuff is a dependency. Now, to get a clearer picture of how these dependencies are defined and what the options are, I need to investigate the `net/vmw_vsock/Kconfig` file. That's where the configuration logic lives. Let's see what's in there. |
| 6/2 | 2026/06/26 18:29 | tool | grepper |
0mArgs:{
"Expression": "VIRTIO_VSOCKETS",
"PathPrefix": "net/vmw_vsock/Kconfig"
}Results: {
"Output": "net/vmw_vsock/Kconfig=29=config VSOCKETS_LOOPBACK\n--\nnet/vmw_vsock/Kconfig-32-\tdefault y\nnet/vmw_vsock/Kconfig:33:\tselect VIRTIO_VSOCKETS_COMMON\nnet/vmw_vsock/Kconfig-34-\thelp\n--\nnet/vmw_vsock/Kconfig=41=config VMWARE_VMCI_VSOCKETS\n--\nnet/vmw_vsock/Kconfig-52-\nnet/vmw_vsock/Kconfig:53:config VIRTIO_VSOCKETS\nnet/vmw_vsock/Kconfig-54-\ttristate \"virtio transport for Virtual Sockets\"\nnet/vmw_vsock/Kconfig-55-\tdepends on VSOCKETS \u0026\u0026 VIRTIO\nnet/vmw_vsock/Kconfig:56:\tselect VIRTIO_VSOCKETS_COMMON\nnet/vmw_vsock/Kconfig-57-\thelp\n--\nnet/vmw_vsock/Kconfig-65-\nnet/vmw_vsock/Kconfig:66:config VIRTIO_VSOCKETS_COMMON\nnet/vmw_vsock/Kconfig-67-\ttristate\n"
} |
| 7/2 | 2026/06/26 18:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6141 output: 36 thoughts: 60 Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective: **Kernel Configuration Dependencies: Virtio vs. vhost_vsock** Right, so I'm looking at how these kernel configurations interrelate. I see that enabling `CONFIG_VIRTIO_VSOCKETS` and `CONFIG_VSOCKETS_LOOPBACK` *both* pull in `CONFIG_VIRTIO_VSOCKETS_COMMON`. That makes perfect sense; it suggests there's some core, shared infrastructure they both rely on for VirtIO-based vsock functionality. I need to keep that dependency in mind when debugging or configuring vsock. It's good to see that kind of factored approach; minimizes code duplication and improves maintainability. Now, I also want to make sure I understand the full scope of how vsock is used, so let's cross-reference the `drivers/vhost/Kconfig` file. I'll need to check the `VHOST_VSOCK` option. I'm assuming that might cover the vhost-based virtual sockets, potentially for paravirtualized guests. Understanding that connection is key to understanding the different options. I need to make sure I understand the difference between the virtio-based vsock implementation and the vhost-based implementation. It helps to have a handle on *all* the vsock options. It's about putting together all the puzzle pieces to see how this all connects. |
| 8/2 | 2026/06/26 18:29 | tool | grepper |
0mArgs:{
"Expression": "VIRTIO_VSOCKETS_COMMON",
"PathPrefix": "drivers/vhost/Kconfig"
}Results: {
"Output": "drivers/vhost/Kconfig=56=config VHOST_VSOCK\n--\ndrivers/vhost/Kconfig-59-\tselect VHOST\ndrivers/vhost/Kconfig:60:\tselect VIRTIO_VSOCKETS_COMMON\ndrivers/vhost/Kconfig-61-\tdefault n\n"
} |
| 9/2 | 2026/06/26 18:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6631 output: 42 thoughts: 431 Thoughts: **My Analysis of VSock RX Queue Collapse** Okay, so I'm looking at these VSock configurations: `CONFIG_VIRTIO_VSOCKETS`, `CONFIG_VHOST_VSOCK`, and `CONFIG_VSOCKETS_LOOPBACK`. I'll make sure those are enabled, along with `VIRTIO_VSOCKETS`, `VHOST_VSOCK`, and `VSOCKETS_LOOPBACK` themselves, as they're clearly important. Now, let's get down to brass tacks: finding the crucial symbols to understand. The new functions are `virtio_transport_can_collapse`, `virtio_transport_collapse_size`, and `virtio_transport_collapse_rx_queue`. The existing function modified is `virtio_transport_recv_enqueue`. Since `virtio_transport_recv_enqueue` is a hot-path function, called on *every* packet enqueued, that tells me the collapse functions are invoked when a threshold is met. Specifically, when `virtio_transport_inc_rx_pkt` returns false, which suggests the RX queue overhead has exceeded its allowed budget. That means `virtio_transport_collapse_rx_queue` is a prime candidate for focused analysis. While `virtio_transport_can_collapse` and `virtio_transport_collapse_size` are static and potentially inlined, they are still important and are worth noting too. Let me confirm if my hunch is correct about those first two being static. *Checks Code...* Yep, they are. ```c static bool virtio_transport_can_collapse(struct sk_buff *skb, unsigned int size) static unsigned int virtio_transport_collapse_size(struct sk_buff *skb, struct sk_buff_head *queue, unsigned int max_size) static void virtio_transport_collapse_rx_queue(struct virtio_vsock_sock *vvs) ``` So, the focus symbols are definitely: `virtio_transport_collapse_rx_queue`, `virtio_transport_collapse_size`, and `virtio_transport_can_collapse`. Let's quickly verify that these functions are all defined within `net/vmw_vsock/virtio_transport_common.c`. |
| 10/2 | 2026/06/26 18:29 | tool | grepper |
0mArgs:{
"Expression": "virtio_transport_collapse",
"PathPrefix": "net/vmw_vsock/virtio_transport_common.c"
}Results: {
"Output": "net/vmw_vsock/virtio_transport_common.c=443=static unsigned int\nnet/vmw_vsock/virtio_transport_common.c:444:virtio_transport_collapse_size(struct sk_buff *skb,\nnet/vmw_vsock/virtio_transport_common.c-445-\t\t\t struct sk_buff_head *queue,\n--\nnet/vmw_vsock/virtio_transport_common.c-463-/* Called under lock_sock when skb overhead exceeds the budget. */\nnet/vmw_vsock/virtio_transport_common.c:464:static void virtio_transport_collapse_rx_queue(struct virtio_vsock_sock *vvs)\nnet/vmw_vsock/virtio_transport_common.c-465-{\n--\nnet/vmw_vsock/virtio_transport_common.c-504-\nnet/vmw_vsock/virtio_transport_common.c:505:\t\t\talloc_size = virtio_transport_collapse_size(skb, \u0026vvs-\u003erx_queue,\nnet/vmw_vsock/virtio_transport_common.c-506-\t\t\t\t\t\t\t\t collapse_max);\n--\nnet/vmw_vsock/virtio_transport_common.c=1483=virtio_transport_recv_enqueue(struct vsock_sock *vsk,\n--\nnet/vmw_vsock/virtio_transport_common.c-1505-\t\tspin_unlock_bh(\u0026vvs-\u003erx_lock);\nnet/vmw_vsock/virtio_transport_common.c:1506:\t\tvirtio_transport_collapse_rx_queue(vvs);\nnet/vmw_vsock/virtio_transport_common.c-1507-\t\tspin_lock_bh(\u0026vvs-\u003erx_lock);\n"
} |
| 11/2 | 2026/06/26 18:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8083 output: 149 thoughts: 218 Thoughts: **My Assessment of the Virtio VSock Collapse Patch** Okay, the new collapse functions are definitely present. I'll make sure to include `virtio_transport_collapse_rx_queue`, `virtio_transport_collapse_size`, and `virtio_transport_can_collapse` in my analysis. This seems like the key area to target. Looking at the configs, I see that this patch is touching the core vsock virtio transport logic, which is good – it's reachable and functional, as stated. Let me double-check the configs. I know I need `VIRTIO_VSOCKETS`, `VHOST_VSOCK`, and `VSOCKETS_LOOPBACK`. And, checking, yes, `VSOCKETS` is the base config, `VIRTIO_VSOCKETS_COMMON` is the module, so all those flags are appropriate and the correct base. Good. The description is clear: the intention is to address connection resets under memory pressure by collapsing small packets in the receive queue. This makes sense; it's a good optimization strategy. The newly added functions are where I'll concentrate my fuzzing efforts. Alright, I'm ready to call set-results. |
| 12/2 | 2026/06/26 18:30 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"VSOCKETS",
"VIRTIO_VSOCKETS",
"VHOST_VSOCK",
"VSOCKETS_LOOPBACK"
],
"FocusSymbols": [
"virtio_transport_collapse_rx_queue",
"virtio_transport_collapse_size",
"virtio_transport_can_collapse"
],
"Reasoning": "This patch introduces a mechanism to collapse small packets in the virtio vsock receive queue to prevent connection resets under memory pressure. It modifies core vsock virtio transport logic which is reachable and functional. Fuzzing should focus on the newly added collapse functions.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"VSOCKETS",
"VIRTIO_VSOCKETS",
"VHOST_VSOCK",
"VSOCKETS_LOOPBACK"
],
"FocusSymbols": [
"virtio_transport_collapse_rx_queue",
"virtio_transport_collapse_size",
"virtio_transport_can_collapse"
],
"Reasoning": "This patch introduces a mechanism to collapse small packets in the virtio vsock receive queue to prevent connection resets under memory pressure. It modifies core vsock virtio transport logic which is reachable and functional. Fuzzing should focus on the newly added collapse functions.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|