| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/01 10:04 | flow | patch-triage |
6mArgs:null Results: {
"EnableConfigs": [
"NET",
"INET",
"IPV6"
],
"FocusSymbols": [
"skb_gso_output_max_segs",
"gso_within_dev_limits",
"__skb_gso_segment",
"skb_segment"
],
"KMSANReasoning": "The patch modifies the GSO (Generic Segmentation Offload) engine and packet transmission path to allow re-segmenting TCP packets to match device limits without dropping down to individual MTU segments. Specifically:\n1. It adds a new field `max_segs` to `struct skb_gso_cb` (which resides inside `skb-\u003ecb`). This field is explicitly initialized in `__skb_gso_segment()` prior to dispatching to protocol-specific segmentation handlers and `skb_segment()`.\n2. Stack and local variables introduced by the patch (such as `_tcph` in `skb_gso_output_max_segs()`) are properly handled; `skb_header_pointer()` ensures data is copied into the buffer before `th` is accessed.\n3. No data structures or padding exposed to user space are added or modified (no copy_to_user, netlink skb attributes, ioctls, or socket options).\n4. Potential issues introduced by this patch relate to packet length calculations, header sizing, segmentation bounds, or out-of-bounds reads/writes on skb frags, all of which fall under KASAN's domain rather than KMSAN's.\n\nTherefore, the patch introduces no uninitialized memory usage or kernel-to-user info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
"NeedsKMSAN": false,
"Reasoning": "The patch adds TCP GSO re-segmentation when packets exceed device limits instead of breaking down to individual MSS segments. It adds skb_gso_output_max_segs() and gso_within_dev_limits(), passes max_segs through __skb_gso_segment(), and modifies skb_segment() to handle partial segmentation. These changes alter core network packet transmission logic reachable through virtual and physical network devices, warranting fuzzing for segmentation edge cases, off-by-one length calculations, and assertion failures.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/01 10:04 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 7232dc3b3d8cd97aa2a8aa76f3df6e8c13741361\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Oct 1 10:04:03 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/tap.c b/drivers/net/tap.c\nindex ff67d99deb39e..bc111495ebbce 100644\n--- a/drivers/net/tap.c\n+++ b/drivers/net/tap.c\n@@ -278,9 +278,10 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)\n \tif (q-\u003eflags \u0026 IFF_VNET_HDR)\n \t\tfeatures |= tap-\u003etap_features;\n \tif (netif_needs_gso(skb, features)) {\n-\t\tstruct sk_buff *segs = __skb_gso_segment(skb, features, false);\n+\t\tstruct sk_buff *segs;\n \t\tstruct sk_buff *next;\n \n+\t\tsegs = __skb_gso_segment(skb, features, false, 0);\n \t\tif (IS_ERR(segs)) {\n \t\t\tdrop_reason = SKB_DROP_REASON_SKB_GSO_SEG;\n \t\t\tgoto drop;\ndiff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex d037faff7c44b..5b7b0c87e4f63 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -5495,7 +5495,14 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,\n netdev_features_t passthru_features_check(struct sk_buff *skb,\n \t\t\t\t\t struct net_device *dev,\n \t\t\t\t\t netdev_features_t features);\n-netdev_features_t netif_skb_features(struct sk_buff *skb);\n+netdev_features_t __netif_skb_features(struct sk_buff *skb,\n+\t\t\t\t bool check_gso_limits);\n+\n+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)\n+{\n+\treturn __netif_skb_features(skb, true);\n+}\n+\n void skb_warn_bad_offload(const struct sk_buff *skb);\n \n static inline bool net_gso_ok(netdev_features_t features, int gso_type)\n@@ -5561,15 +5568,6 @@ netif_get_gro_max_size(const struct net_device *dev, const struct sk_buff *skb)\n \t READ_ONCE(dev-\u003egro_ipv4_max_size);\n }\n \n-static inline unsigned int\n-netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)\n-{\n-\t/* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */\n-\treturn skb-\u003eprotocol == htons(ETH_P_IPV6) ?\n-\t READ_ONCE(dev-\u003egso_max_size) :\n-\t READ_ONCE(dev-\u003egso_ipv4_max_size);\n-}\n-\n static inline bool netif_is_macsec(const struct net_device *dev)\n {\n \treturn dev-\u003epriv_flags \u0026 IFF_MACSEC;\ndiff --git a/include/net/gso.h b/include/net/gso.h\nindex 29975440cad51..fccb37889965f 100644\n--- a/include/net/gso.h\n+++ b/include/net/gso.h\n@@ -19,6 +19,7 @@ struct skb_gso_cb {\n \tint\tencap_level;\n \t__wsum\tcsum;\n \t__u16\tcsum_start;\n+\t__u16\tmax_segs;\t/* Max MSS segs per output skb, 0 = no limit */\n };\n #define SKB_GSO_CB_OFFSET\t32\n #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)-\u003ecb + SKB_GSO_CB_OFFSET))\n@@ -75,12 +76,13 @@ static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)\n }\n \n struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\n-\t\t\t\t netdev_features_t features, bool tx_path);\n+\t\t\t\t netdev_features_t features, bool tx_path,\n+\t\t\t\t unsigned int max_segs);\n \n static inline struct sk_buff *skb_gso_segment(struct sk_buff *skb,\n \t\t\t\t\t netdev_features_t features)\n {\n-\treturn __skb_gso_segment(skb, features, true);\n+\treturn __skb_gso_segment(skb, features, true, 0);\n }\n \n struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb,\ndiff --git a/include/net/udp.h b/include/net/udp.h\nindex 1fee17274745f..5bc25dcf25fba 100644\n--- a/include/net/udp.h\n+++ b/include/net/udp.h\n@@ -613,7 +613,7 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,\n \t/* the GSO CB lays after the UDP one, no need to save and restore any\n \t * CB fragment\n \t */\n-\tsegs = __skb_gso_segment(skb, features, false);\n+\tsegs = __skb_gso_segment(skb, features, false, 0);\n \tif (IS_ERR_OR_NULL(segs)) {\n \t\tdrop_count = skb_shinfo(skb)-\u003egso_segs;\n \t\tgoto drop;\ndiff --git a/net/core/dev.c b/net/core/dev.c\nindex a8eb382f40caf..ff9bce2506f67 100644\n--- a/net/core/dev.c\n+++ b/net/core/dev.c\n@@ -3869,16 +3869,33 @@ static bool skb_gso_has_extension_hdr(const struct sk_buff *skb)\n \t\t\t skb_inner_network_header_len(skb) != sizeof(struct ipv6hdr)));\n }\n \n-static netdev_features_t gso_features_check(const struct sk_buff *skb,\n-\t\t\t\t\t struct net_device *dev,\n-\t\t\t\t\t netdev_features_t features)\n+static unsigned int\n+netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)\n {\n-\tu16 gso_segs = skb_shinfo(skb)-\u003egso_segs;\n+\t/* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */\n+\treturn vlan_get_protocol(skb) == htons(ETH_P_IPV6) ?\n+\t READ_ONCE(dev-\u003egso_max_size) :\n+\t READ_ONCE(dev-\u003egso_ipv4_max_size);\n+}\n \n-\tif (gso_segs \u003e READ_ONCE(dev-\u003egso_max_segs))\n-\t\treturn features \u0026 ~NETIF_F_GSO_MASK;\n+static bool\n+gso_within_dev_limits(const struct sk_buff *skb, const struct net_device *dev)\n+{\n+\tif (skb_shinfo(skb)-\u003egso_segs \u003e READ_ONCE(dev-\u003egso_max_segs))\n+\t\treturn false;\n \n \tif (unlikely(skb-\u003elen \u003e= netif_get_gso_max_size(dev, skb)))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n+static netdev_features_t gso_features_check(const struct sk_buff *skb,\n+\t\t\t\t\t struct net_device *dev,\n+\t\t\t\t\t netdev_features_t features,\n+\t\t\t\t\t bool check_limits)\n+{\n+\tif (check_limits \u0026\u0026 !gso_within_dev_limits(skb, dev))\n \t\treturn features \u0026 ~NETIF_F_GSO_MASK;\n \n \tif (!skb_shinfo(skb)-\u003egso_type) {\n@@ -3927,13 +3944,15 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,\n \treturn features;\n }\n \n-netdev_features_t netif_skb_features(struct sk_buff *skb)\n+netdev_features_t\n+__netif_skb_features(struct sk_buff *skb, bool check_gso_limits)\n {\n \tstruct net_device *dev = skb-\u003edev;\n \tnetdev_features_t features = dev-\u003efeatures;\n \n \tif (skb_is_gso(skb))\n-\t\tfeatures = gso_features_check(skb, dev, features);\n+\t\tfeatures = gso_features_check(skb, dev, features,\n+\t\t\t\t\t check_gso_limits);\n \n \t/* If encapsulation offload request, verify we are testing\n \t * hardware encapsulation features instead of standard\n@@ -3956,7 +3975,54 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)\n \n \treturn harmonize_features(skb, features);\n }\n-EXPORT_SYMBOL(netif_skb_features);\n+EXPORT_SYMBOL(__netif_skb_features);\n+\n+static unsigned int\n+skb_gso_output_max_segs(struct sk_buff *skb, struct net_device *dev)\n+{\n+\tunsigned int mss = skb_shinfo(skb)-\u003egso_size;\n+\tunsigned int gso_max_size, hdr_len, max_segs;\n+\tnetdev_features_t features;\n+\tstruct tcphdr _tcph, *th;\n+\n+\tif (!skb_is_gso(skb) || !skb_is_gso_tcp(skb) ||\n+\t skb-\u003eencapsulation || skb_has_frag_list(skb))\n+\t\treturn 0;\n+\n+\t/*\n+\t * The transport offset can be unset or stale, so hdr_len is only taken\n+\t * from a header at the checksum start.\n+\t */\n+\tif (!skb_transport_header_was_set(skb) ||\n+\t skb_checksum_start(skb) != skb_transport_header(skb))\n+\t\treturn 0;\n+\n+\tth = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph),\n+\t\t\t\t\u0026_tcph);\n+\tif (!th || __tcp_hdrlen(th) \u003c sizeof(*th))\n+\t\treturn 0;\n+\n+\thdr_len = skb_transport_header(skb) - skb_mac_header(skb) +\n+\t\t __tcp_hdrlen(th);\n+\n+\t/* The output is still a GSO skb: recheck without the limit checks */\n+\tfeatures = __netif_skb_features(skb, false) | NETIF_F_GSO_ROBUST;\n+\tif (!net_gso_ok(features, skb_shinfo(skb)-\u003egso_type))\n+\t\treturn 0;\n+\n+\tgso_max_size = netif_get_gso_max_size(dev, skb);\n+\tgso_max_size = min(gso_max_size, GSO_LEGACY_MAX_SIZE);\n+\n+\t/*\n+\t * gso_within_dev_limits() accepts gso_segs == gso_max_segs but\n+\t * rejects skb-\u003elen \u003e= gso_max_size, so only the size limit needs the\n+\t * - 1; the inner min() keeps that subtraction from wrapping.\n+\t */\n+\tmax_segs = (gso_max_size - min(gso_max_size, hdr_len + 1)) / mss;\n+\tmax_segs = min(max_segs, READ_ONCE(dev-\u003egso_max_segs));\n+\n+\treturn max_segs;\n+}\n \n static int xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\t struct netdev_queue *txq, bool more)\n@@ -4122,9 +4188,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device\n \t\tgoto out_null;\n \n \tif (netif_needs_gso(skb, features)) {\n+\t\tunsigned int max_segs = 0;\n \t\tstruct sk_buff *segs;\n \n-\t\tsegs = skb_gso_segment(skb, features);\n+\t\tif (unlikely(!gso_within_dev_limits(skb, dev)))\n+\t\t\tmax_segs = skb_gso_output_max_segs(skb, dev);\n+\n+\t\tsegs = __skb_gso_segment(skb, features, true, max_segs);\n \t\tif (IS_ERR(segs)) {\n \t\t\tgoto out_kfree_skb;\n \t\t} else if (segs) {\ndiff --git a/net/core/gso.c b/net/core/gso.c\nindex bcd156372f4df..21a259ca392f4 100644\n--- a/net/core/gso.c\n+++ b/net/core/gso.c\n@@ -77,6 +77,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)\n *\t@skb: buffer to segment\n *\t@features: features for the output path (see dev-\u003efeatures)\n *\t@tx_path: whether it is called in TX path\n+ *\t@max_segs: maximum MSS segments per output GSO skb, 0 means no limit;\n+ *\t\t set only for an unencapsulated TCP skb without a frag_list\n *\n *\tThis function segments the given skb and returns a list of segments.\n *\n@@ -86,7 +88,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)\n *\tSegmentation preserves SKB_GSO_CB_OFFSET bytes of previous skb cb.\n */\n struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\n-\t\t\t\t netdev_features_t features, bool tx_path)\n+\t\t\t\t netdev_features_t features, bool tx_path,\n+\t\t\t\t unsigned int max_segs)\n {\n \tstruct sk_buff *segs;\n \n@@ -117,6 +120,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\n \n \tSKB_GSO_CB(skb)-\u003emac_offset = skb_headroom(skb);\n \tSKB_GSO_CB(skb)-\u003eencap_level = 0;\n+\tSKB_GSO_CB(skb)-\u003emax_segs = min(max_segs, GSO_MAX_SEGS);\n \n \tskb_reset_mac_header(skb);\n \tskb_reset_mac_len(skb);\ndiff --git a/net/core/net_test.c b/net/core/net_test.c\nindex 9c3a590865d26..6a91db83e5301 100644\n--- a/net/core/net_test.c\n+++ b/net/core/net_test.c\n@@ -4,7 +4,14 @@\n \n /* GSO */\n \n+#include \u003clinux/if_ether.h\u003e\n+#include \u003clinux/if_vlan.h\u003e\n+#include \u003clinux/ip.h\u003e\n+#include \u003clinux/ipv6.h\u003e\n+#include \u003clinux/netdevice.h\u003e\n #include \u003clinux/skbuff.h\u003e\n+#include \u003clinux/tcp.h\u003e\n+#include \u003cnet/gso.h\u003e\n \n static const char hdr[] = \"abcdefgh\";\n #define GSO_TEST_SIZE 1000\n@@ -34,6 +41,9 @@ enum gso_test_nr {\n \tGSO_TEST_FRAG_LIST_PURE,\n \tGSO_TEST_FRAG_LIST_NON_UNIFORM,\n \tGSO_TEST_GSO_BY_FRAGS,\n+\tGSO_TEST_RESEGMENT,\n+\tGSO_TEST_RESEGMENT_MULTI,\n+\tGSO_TEST_RESEGMENT_ONE_MSS,\n };\n \n struct gso_test_case {\n@@ -46,10 +56,12 @@ struct gso_test_case {\n \tconst unsigned int *frags;\n \tunsigned int nr_frag_skbs;\n \tconst unsigned int *frag_skbs;\n+\tunsigned int max_segs;\n \n \t/* output as expected */\n \tunsigned int nr_segs;\n \tconst unsigned int *segs;\n+\tbool segs_are_gso;\n };\n \n static struct gso_test_case cases[] = {\n@@ -135,6 +147,51 @@ static struct gso_test_case cases[] = {\n \t\t.nr_segs = 4,\n \t\t.segs = (const unsigned int[]) { 100, 200, 300, 400 },\n \t},\n+\t{\n+\t\t.id = GSO_TEST_RESEGMENT,\n+\t\t.name = \"resegment\",\n+\t\t.linear_len = GSO_TEST_SIZE,\n+\t\t.nr_frags = 3,\n+\t\t.frags = (const unsigned int[]) {\n+\t\t\tGSO_TEST_SIZE, GSO_TEST_SIZE, 3,\n+\t\t},\n+\t\t.max_segs = 2,\n+\t\t.nr_segs = 2,\n+\t\t.segs = (const unsigned int[]) {\n+\t\t\t2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,\n+\t\t},\n+\t\t.segs_are_gso = true,\n+\t},\n+\t{\n+\t\t.id = GSO_TEST_RESEGMENT_MULTI,\n+\t\t.name = \"resegment_multi\",\n+\t\t.linear_len = 2 * GSO_TEST_SIZE,\n+\t\t.nr_frags = 4,\n+\t\t.frags = (const unsigned int[]) {\n+\t\t\tGSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,\n+\t\t},\n+\t\t.max_segs = 2,\n+\t\t.nr_segs = 3,\n+\t\t.segs = (const unsigned int[]) {\n+\t\t\t2 * GSO_TEST_SIZE, 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,\n+\t\t},\n+\t\t.segs_are_gso = true,\n+\t},\n+\t{\n+\t\t/* A max_segs of one leaves one MSS per skb, like no limit. */\n+\t\t.id = GSO_TEST_RESEGMENT_ONE_MSS,\n+\t\t.name = \"resegment_one_mss\",\n+\t\t.linear_len = GSO_TEST_SIZE,\n+\t\t.nr_frags = 3,\n+\t\t.frags = (const unsigned int[]) {\n+\t\t\tGSO_TEST_SIZE, GSO_TEST_SIZE, 3,\n+\t\t},\n+\t\t.max_segs = 1,\n+\t\t.nr_segs = 4,\n+\t\t.segs = (const unsigned int[]) {\n+\t\t\tGSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,\n+\t\t},\n+\t},\n };\n \n static void gso_test_case_to_desc(struct gso_test_case *t, char *desc)\n@@ -226,6 +283,7 @@ static void gso_test_func(struct kunit *test)\n \tif (tcase-\u003eid == GSO_TEST_FRAG_LIST_NON_UNIFORM)\n \t\tfeatures \u0026= ~NETIF_F_SG;\n \n+\tSKB_GSO_CB(skb)-\u003emax_segs = tcase-\u003emax_segs;\n \tsegs = skb_segment(skb, features);\n \tif (IS_ERR(segs)) {\n \t\tKUNIT_FAIL(test, \"segs error %pe\", segs);\n@@ -239,6 +297,7 @@ static void gso_test_func(struct kunit *test)\n \tfor (cur = segs, i = 0; cur; cur = next, i++) {\n \t\tnext = cur-\u003enext;\n \n+\t\tKUNIT_ASSERT_LT(test, i, tcase-\u003enr_segs);\n \t\tKUNIT_ASSERT_EQ(test, cur-\u003elen, sizeof(hdr) + tcase-\u003esegs[i]);\n \n \t\t/* segs have skb-\u003edata pointing to the mac header */\n@@ -247,6 +306,18 @@ static void gso_test_func(struct kunit *test)\n \n \t\t/* header was copied to all segs */\n \t\tKUNIT_ASSERT_EQ(test, memcmp(skb_mac_header(cur), hdr, sizeof(hdr)), 0);\n+\t\tif (tcase-\u003esegs_are_gso) {\n+\t\t\tKUNIT_EXPECT_TRUE(test, skb_is_gso(cur));\n+\t\t\tKUNIT_EXPECT_EQ(test, skb_shinfo(cur)-\u003egso_size,\n+\t\t\t\t\tGSO_TEST_SIZE);\n+\t\t\tKUNIT_EXPECT_EQ(test, skb_shinfo(cur)-\u003egso_segs,\n+\t\t\t\t\tDIV_ROUND_UP(tcase-\u003esegs[i],\n+\t\t\t\t\t\t GSO_TEST_SIZE));\n+\t\t\tKUNIT_EXPECT_FALSE(test, skb_shinfo(cur)-\u003egso_type \u0026\n+\t\t\t\t\t SKB_GSO_PARTIAL);\n+\t\t} else if (tcase-\u003emax_segs) {\n+\t\t\tKUNIT_EXPECT_FALSE(test, skb_is_gso(cur));\n+\t\t}\n \n \t\t/* last seg can be found through segs-\u003eprev pointer */\n \t\tif (!next)\n@@ -261,6 +332,283 @@ static void gso_test_func(struct kunit *test)\n \tconsume_skb(skb);\n }\n \n+#define GSO_TCP_HDR_LEN \\\n+\t(ETH_HLEN + sizeof(struct iphdr) + sizeof(struct tcphdr))\n+\n+static struct sk_buff *gso_tcp_skb_new(unsigned int payload_len)\n+{\n+\tstruct sk_buff *skb;\n+\tstruct ethhdr *eth;\n+\tstruct tcphdr *th;\n+\tstruct iphdr *iph;\n+\n+\tskb = alloc_skb(NET_SKB_PAD + GSO_TCP_HDR_LEN + payload_len,\n+\t\t\tGFP_KERNEL);\n+\tif (!skb)\n+\t\treturn NULL;\n+\tskb_reserve(skb, NET_SKB_PAD);\n+\tskb_put_zero(skb, GSO_TCP_HDR_LEN + payload_len);\n+\n+\tskb_reset_mac_header(skb);\n+\teth = eth_hdr(skb);\n+\teth-\u003eh_proto = htons(ETH_P_IP);\n+\tskb-\u003eprotocol = eth-\u003eh_proto;\n+\n+\tskb_set_network_header(skb, ETH_HLEN);\n+\tiph = ip_hdr(skb);\n+\tiph-\u003eversion = 4;\n+\tiph-\u003eihl = sizeof(*iph) / 4;\n+\tiph-\u003eprotocol = IPPROTO_TCP;\n+\tiph-\u003etot_len = htons(sizeof(*iph) + sizeof(*th) + payload_len);\n+\n+\tskb_set_transport_header(skb, ETH_HLEN + sizeof(*iph));\n+\tth = tcp_hdr(skb);\n+\tth-\u003edoff = sizeof(*th) / 4;\n+\n+\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\n+\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\n+\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n+\tskb_shinfo(skb)-\u003egso_type = SKB_GSO_TCPV4;\n+\tskb_shinfo(skb)-\u003egso_size = GSO_TEST_SIZE;\n+\tskb_shinfo(skb)-\u003egso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);\n+\n+\treturn skb;\n+}\n+\n+/*\n+ * The transmit path passes the features of the device which rejects this\n+ * skb, with the GSO bits cleared, so the engine segments it.\n+ */\n+static void gso_test_tcp_resegment(struct kunit *test)\n+{\n+\tnetdev_features_t features = NETIF_F_SG | NETIF_F_HW_CSUM;\n+\tconst unsigned int payload_len = 3 * GSO_TEST_SIZE + 3;\n+\tstruct sk_buff *skb, *segs, *cur, *next;\n+\tconst unsigned int expected[] = {\n+\t\t2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,\n+\t};\n+\tconst unsigned int max_segs = 2;\n+\tint i = 0;\n+\n+\tif (!IS_ENABLED(CONFIG_INET))\n+\t\tkunit_skip(test, \"requires CONFIG_INET\");\n+\n+\tskb = gso_tcp_skb_new(payload_len);\n+\tif (!skb) {\n+\t\tKUNIT_FAIL(test, \"no skb\");\n+\t\treturn;\n+\t}\n+\n+\tsegs = __skb_gso_segment(skb, features, true, max_segs);\n+\tif (IS_ERR_OR_NULL(segs)) {\n+\t\tKUNIT_FAIL(test, \"segs error %pe\", segs);\n+\t\tconsume_skb(skb);\n+\t\treturn;\n+\t}\n+\n+\tfor (cur = segs; cur; cur = next, i++) {\n+\t\tnext = cur-\u003enext;\n+\n+\t\tif (i \u003c ARRAY_SIZE(expected)) {\n+\t\t\tKUNIT_EXPECT_EQ(test, cur-\u003elen,\n+\t\t\t\t\tGSO_TCP_HDR_LEN + expected[i]);\n+\t\t\tKUNIT_EXPECT_EQ(test, skb_shinfo(cur)-\u003egso_segs,\n+\t\t\t\t\tDIV_ROUND_UP(expected[i],\n+\t\t\t\t\t\t GSO_TEST_SIZE));\n+\t\t}\n+\t\tKUNIT_EXPECT_TRUE(test, skb_is_gso(cur));\n+\t\tKUNIT_EXPECT_EQ(test, skb_shinfo(cur)-\u003egso_size,\n+\t\t\t\tGSO_TEST_SIZE);\n+\n+\t\tconsume_skb(cur);\n+\t}\n+\n+\tKUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(expected));\n+\tconsume_skb(skb);\n+}\n+\n+#define GSO_TCP6_HDR_LEN \\\n+\t(ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct tcphdr))\n+\n+static struct sk_buff *gso_tcp6_skb_new(unsigned int payload_len)\n+{\n+\tstruct ipv6hdr *ip6h;\n+\tstruct sk_buff *skb;\n+\tstruct ethhdr *eth;\n+\tstruct tcphdr *th;\n+\n+\tskb = alloc_skb(NET_SKB_PAD + GSO_TCP6_HDR_LEN + payload_len,\n+\t\t\tGFP_KERNEL);\n+\tif (!skb)\n+\t\treturn NULL;\n+\tskb_reserve(skb, NET_SKB_PAD);\n+\tskb_put_zero(skb, GSO_TCP6_HDR_LEN + payload_len);\n+\n+\tskb_reset_mac_header(skb);\n+\teth = eth_hdr(skb);\n+\teth-\u003eh_proto = htons(ETH_P_IPV6);\n+\tskb-\u003eprotocol = eth-\u003eh_proto;\n+\n+\tskb_set_network_header(skb, ETH_HLEN);\n+\tip6h = ipv6_hdr(skb);\n+\tip6h-\u003eversion = 6;\n+\tip6h-\u003enexthdr = IPPROTO_TCP;\n+\tip6h-\u003epayload_len = htons(sizeof(*th) + payload_len);\n+\n+\tskb_set_transport_header(skb, ETH_HLEN + sizeof(*ip6h));\n+\tth = tcp_hdr(skb);\n+\tth-\u003edoff = sizeof(*th) / 4;\n+\n+\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\n+\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\n+\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n+\tskb_shinfo(skb)-\u003egso_type = SKB_GSO_TCPV6;\n+\tskb_shinfo(skb)-\u003egso_size = GSO_TEST_SIZE;\n+\tskb_shinfo(skb)-\u003egso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);\n+\n+\treturn skb;\n+}\n+\n+/*\n+ * The device GSO size limit is per L3 protocol, so only a lowered limit of\n+ * the packet's own protocol may cost it the TSO bit, and a tag inside the\n+ * frame, which replaces skb-\u003eprotocol with the ethertype, must not change\n+ * which limit applies. Takes ownership of @skb.\n+ */\n+static void gso_test_tcp_l3_limit(struct kunit *test, struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, netdev_features_t tso,\n+\t\t\t\t bool ipv6)\n+{\n+\tunsigned int other = GSO_LEGACY_MAX_SIZE;\n+\tunsigned int own = GSO_MAX_SIZE;\n+\n+\t/* The skb fits the limit of its own L3 protocol, not the other's. */\n+\tdev-\u003egso_max_size = ipv6 ? own : other;\n+\tdev-\u003egso_ipv4_max_size = ipv6 ? other : own;\n+\tKUNIT_EXPECT_TRUE(test, netif_skb_features(skb) \u0026 tso);\n+\n+\t/* ...and the other way around. */\n+\tswap(own, other);\n+\tdev-\u003egso_max_size = ipv6 ? own : other;\n+\tdev-\u003egso_ipv4_max_size = ipv6 ? other : own;\n+\tKUNIT_EXPECT_FALSE(test, netif_skb_features(skb) \u0026 tso);\n+\n+\tskb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), 0);\n+\tif (!skb) {\n+\t\tKUNIT_FAIL(test, \"no tagged skb\");\n+\t\treturn;\n+\t}\n+\tKUNIT_EXPECT_TRUE(test, skb-\u003eprotocol == htons(ETH_P_8021Q));\n+\n+\tswap(own, other);\n+\tdev-\u003egso_max_size = ipv6 ? own : other;\n+\tdev-\u003egso_ipv4_max_size = ipv6 ? other : own;\n+\tKUNIT_EXPECT_TRUE(test, netif_skb_features(skb) \u0026 tso);\n+\n+\tswap(own, other);\n+\tdev-\u003egso_max_size = ipv6 ? own : other;\n+\tdev-\u003egso_ipv4_max_size = ipv6 ? other : own;\n+\tKUNIT_EXPECT_FALSE(test, netif_skb_features(skb) \u0026 tso);\n+\n+\tconsume_skb(skb);\n+}\n+\n+static void gso_test_tcp_limit_l3_proto(struct kunit *test)\n+{\n+\tstatic const struct net_device_ops dummy_netdev_ops = { };\n+\tconst unsigned int payload_len = 100 * 1024;\n+\tstruct net_device *dev;\n+\tstruct sk_buff *skb;\n+\n+\tdev = alloc_etherdev(0);\n+\tif (!dev) {\n+\t\tKUNIT_FAIL(test, \"no net_device\");\n+\t\treturn;\n+\t}\n+\tdev-\u003enetdev_ops = \u0026dummy_netdev_ops;\n+\tdev-\u003ehw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |\n+\t\t\t NETIF_F_TSO6;\n+\tdev-\u003efeatures = dev-\u003ehw_features;\n+\tdev-\u003evlan_features = dev-\u003ehw_features;\n+\n+\tskb = gso_tcp6_skb_new(payload_len);\n+\tif (!skb) {\n+\t\tKUNIT_FAIL(test, \"no IPv6 skb\");\n+\t\tgoto free_dev;\n+\t}\n+\tskb-\u003edev = dev;\n+\tgso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO6, true);\n+\n+\tskb = gso_tcp_skb_new(payload_len);\n+\tif (!skb) {\n+\t\tKUNIT_FAIL(test, \"no IPv4 skb\");\n+\t\tgoto free_dev;\n+\t}\n+\tskb-\u003edev = dev;\n+\tgso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO, false);\n+\n+free_dev:\n+\tfree_netdev(dev);\n+}\n+\n+/*\n+ * A re-segmented output is a plain GSO skb, so the whole length lands in the\n+ * 16-bit L3 length field. A device which accepts GSO skbs above 64 KiB would\n+ * otherwise be handed outputs whose length field truncates.\n+ */\n+static void gso_test_tcp_resegment_l3_len(struct kunit *test)\n+{\n+\tstatic const struct net_device_ops dummy_netdev_ops = { };\n+\tconst unsigned int payload_len = 200 * 1024;\n+\tstruct sk_buff *skb, *segs, *cur, *next;\n+\tunsigned int nr_segs = 0;\n+\tstruct net_device *dev;\n+\tbool again = false;\n+\n+\tif (!IS_ENABLED(CONFIG_INET))\n+\t\tkunit_skip(test, \"requires CONFIG_INET\");\n+\n+\tdev = alloc_etherdev(0);\n+\tif (!dev) {\n+\t\tKUNIT_FAIL(test, \"no net_device\");\n+\t\treturn;\n+\t}\n+\tdev-\u003enetdev_ops = \u0026dummy_netdev_ops;\n+\tdev-\u003ehw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;\n+\tdev-\u003efeatures = dev-\u003ehw_features;\n+\tdev-\u003evlan_features = dev-\u003ehw_features;\n+\tdev-\u003egso_ipv4_max_size = 120 * 1024;\n+\n+\tskb = gso_tcp_skb_new(payload_len);\n+\tif (!skb) {\n+\t\tKUNIT_FAIL(test, \"no skb\");\n+\t\tgoto free_dev;\n+\t}\n+\tskb-\u003edev = dev;\n+\n+\tsegs = validate_xmit_skb_list(skb, dev, \u0026again);\n+\tif (IS_ERR_OR_NULL(segs)) {\n+\t\tKUNIT_FAIL(test, \"segs error %pe\", segs);\n+\t\tgoto free_dev;\n+\t}\n+\n+\tfor (cur = segs; cur; cur = next, nr_segs++) {\n+\t\tnext = cur-\u003enext;\n+\t\tcur-\u003enext = NULL;\n+\n+\t\tKUNIT_EXPECT_TRUE(test, skb_is_gso(cur));\n+\t\tKUNIT_EXPECT_EQ(test, ntohs(ip_hdr(cur)-\u003etot_len),\n+\t\t\t\tcur-\u003elen - (skb_network_header(cur) -\n+\t\t\t\t\t skb_mac_header(cur)));\n+\t\tconsume_skb(cur);\n+\t}\n+\n+\tKUNIT_EXPECT_EQ(test, nr_segs, 4);\n+\n+free_dev:\n+\tfree_netdev(dev);\n+}\n+\n /* IP tunnel flags */\n \n #include \u003cnet/ip_tunnels.h\u003e\n@@ -372,6 +720,9 @@ static void ip_tunnel_flags_test_run(struct kunit *test)\n \n static struct kunit_case net_test_cases[] = {\n \tKUNIT_CASE_PARAM(gso_test_func, gso_test_gen_params),\n+\tKUNIT_CASE(gso_test_tcp_resegment),\n+\tKUNIT_CASE(gso_test_tcp_limit_l3_proto),\n+\tKUNIT_CASE(gso_test_tcp_resegment_l3_len),\n \tKUNIT_CASE_PARAM(ip_tunnel_flags_test_run,\n \t\t\t ip_tunnel_flags_test_gen_params),\n \t{ },\ndiff --git a/net/core/skbuff.c b/net/core/skbuff.c\nindex 8912a66cd9097..fd10a7cdc1883 100644\n--- a/net/core/skbuff.c\n+++ b/net/core/skbuff.c\n@@ -4793,6 +4793,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,\n \tstruct sk_buff *segs = NULL;\n \tstruct sk_buff *tail = NULL;\n \tstruct sk_buff *list_skb = skb_shinfo(head_skb)-\u003efrag_list;\n+\tunsigned int max_segs = SKB_GSO_CB(head_skb)-\u003emax_segs;\n \tunsigned int mss = skb_shinfo(head_skb)-\u003egso_size;\n \tbool gso_by_frags = mss == GSO_BY_FRAGS;\n \tunsigned int doffset = head_skb-\u003edata - skb_mac_header(head_skb);\n@@ -4839,7 +4840,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,\n \tcsum = !!can_checksum_protocol(features, proto);\n \n \tif (sg \u0026\u0026 csum \u0026\u0026 !gso_by_frags) {\n-\t\tif (!(features \u0026 NETIF_F_GSO_PARTIAL)) {\n+\t\tif (!max_segs \u0026\u0026 !(features \u0026 NETIF_F_GSO_PARTIAL)) {\n \t\t\tstruct sk_buff *iter;\n \t\t\tunsigned int frag_len;\n \n@@ -4874,7 +4875,10 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,\n \t\t * now.\n \t\t */\n \t\tDEBUG_NET_WARN_ON_ONCE(len / mss \u003e GSO_MAX_SEGS);\n-\t\tpartial_segs = min(len / mss, GSO_MAX_SEGS);\n+\t\tif (max_segs)\n+\t\t\tpartial_segs = min(len / mss, max_segs);\n+\t\telse\n+\t\t\tpartial_segs = min(len / mss, GSO_MAX_SEGS);\n \t\tif (partial_segs \u003e 1)\n \t\t\tmss *= partial_segs;\n \t\telse\ndiff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c\nindex 2187034143255..e793aead68372 100644\n--- a/net/openvswitch/datapath.c\n+++ b/net/openvswitch/datapath.c\n@@ -375,7 +375,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,\n \tint err;\n \n \tBUILD_BUG_ON(sizeof(*OVS_CB(skb)) \u003e SKB_GSO_CB_OFFSET);\n-\tsegs = __skb_gso_segment(skb, NETIF_F_SG, false);\n+\tsegs = __skb_gso_segment(skb, NETIF_F_SG, false, 0);\n \tif (IS_ERR(segs))\n \t\treturn PTR_ERR(segs);\n \tif (segs == NULL)\n"
} |
| 2/1 | 2026/10/01 10:04 | agent | patch-evaluator |
2mModel:core Args: null Results: {
"EnableConfigs": [
"NET",
"INET",
"IPV6"
],
"FocusSymbols": [
"skb_gso_output_max_segs",
"gso_within_dev_limits",
"__skb_gso_segment",
"skb_segment"
],
"Reasoning": "The patch adds TCP GSO re-segmentation when packets exceed device limits instead of breaking down to individual MSS segments. It adds skb_gso_output_max_segs() and gso_within_dev_limits(), passes max_segs through __skb_gso_segment(), and modifies skb_segment() to handle partial segmentation. These changes alter core network packet transmission logic reachable through virtual and physical network devices, warranting fuzzing for segmentation edge cases, off-by-one length calculations, and assertion failures.",
"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 7232dc3b3d8cd97aa2a8aa76f3df6e8c13741361
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 1 10:04:03 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index ff67d99deb39e..bc111495ebbce 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -278,9 +278,10 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
if (q->flags & IFF_VNET_HDR)
features |= tap->tap_features;
if (netif_needs_gso(skb, features)) {
- struct sk_buff *segs = __skb_gso_segment(skb, features, false);
+ struct sk_buff *segs;
struct sk_buff *next;
+ segs = __skb_gso_segment(skb, features, false, 0);
if (IS_ERR(segs)) {
drop_reason = SKB_DROP_REASON_SKB_GSO_SEG;
goto drop;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d037faff7c44b..5b7b0c87e4f63 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -5495,7 +5495,14 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
netdev_features_t passthru_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features);
-netdev_features_t netif_skb_features(struct sk_buff *skb);
+netdev_features_t __netif_skb_features(struct sk_buff *skb,
+ bool check_gso_limits);
+
+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)
+{
+ return __netif_skb_features(skb, true);
+}
+
void skb_warn_bad_offload(const struct sk_buff *skb);
static inline bool net_gso_ok(netdev_features_t features, int gso_type)
@@ -5561,15 +5568,6 @@ netif_get_gro_max_size(const struct net_device *dev, const struct sk_buff *skb)
READ_ONCE(dev->gro_ipv4_max_size);
}
-static inline unsigned int
-netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
-{
- /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
- return skb->protocol == htons(ETH_P_IPV6) ?
- READ_ONCE(dev->gso_max_size) :
- READ_ONCE(dev->gso_ipv4_max_size);
-}
-
static inline bool netif_is_macsec(const struct net_device *dev)
{
return dev->priv_flags & IFF_MACSEC;
diff --git a/include/net/gso.h b/include/net/gso.h
index 29975440cad51..fccb37889965f 100644
--- a/include/net/gso.h
+++ b/include/net/gso.h
@@ -19,6 +19,7 @@ struct skb_gso_cb {
int encap_level;
__wsum csum;
__u16 csum_start;
+ __u16 max_segs; /* Max MSS segs per output skb, 0 = no limit */
};
#define SKB_GSO_CB_OFFSET 32
#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET))
@@ -75,12 +76,13 @@ static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
}
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
- netdev_features_t features, bool tx_path);
+ netdev_features_t features, bool tx_path,
+ unsigned int max_segs);
static inline struct sk_buff *skb_gso_segment(struct sk_buff *skb,
netdev_features_t features)
{
- return __skb_gso_segment(skb, features, true);
+ return __skb_gso_segment(skb, features, true, 0);
}
struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb,
diff --git a/include/net/udp.h b/include/net/udp.h
index 1fee17274745f..5bc25dcf25fba 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -613,7 +613,7 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
/* the GSO CB lays after the UDP one, no need to save and restore any
* CB fragment
*/
- segs = __skb_gso_segment(skb, features, false);
+ segs = __skb_gso_segment(skb, features, false, 0);
if (IS_ERR_OR_NULL(segs)) {
drop_count = skb_shinfo(skb)->gso_segs;
goto drop;
diff --git a/net/core/dev.c b/net/core/dev.c
index a8eb382f40caf..ff9bce2506f67 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3869,16 +3869,33 @@ static bool skb_gso_has_extension_hdr(const struct sk_buff *skb)
skb_inner_network_header_len(skb) != sizeof(struct ipv6hdr)));
}
-static netdev_features_t gso_features_check(const struct sk_buff *skb,
- struct net_device *dev,
- netdev_features_t features)
+static unsigned int
+netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
{
- u16 gso_segs = skb_shinfo(skb)->gso_segs;
+ /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
+ return vlan_get_protocol(skb) == htons(ETH_P_IPV6) ?
+ READ_ONCE(dev->gso_max_size) :
+ READ_ONCE(dev->gso_ipv4_max_size);
+}
- if (gso_segs > READ_ONCE(dev->gso_max_segs))
- return features & ~NETIF_F_GSO_MASK;
+static bool
+gso_within_dev_limits(const struct sk_buff *skb, const struct net_device *dev)
+{
+ if (skb_shinfo(skb)->gso_segs > READ_ONCE(dev->gso_max_segs))
+ return false;
if (unlikely(skb->len >= netif_get_gso_max_size(dev, skb)))
+ return false;
+
+ return true;
+}
+
+static netdev_features_t gso_features_check(const struct sk_buff *skb,
+ struct net_device *dev,
+ netdev_features_t features,
+ bool check_limits)
+{
+ if (check_limits && !gso_within_dev_limits(skb, dev))
return features & ~NETIF_F_GSO_MASK;
if (!skb_shinfo(skb)->gso_type) {
@@ -3927,13 +3944,15 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
return features;
}
-netdev_features_t netif_skb_features(struct sk_buff *skb)
+netdev_features_t
+__netif_skb_features(struct sk_buff *skb, bool check_gso_limits)
{
struct net_device *dev = skb->dev;
netdev_features_t features = dev->features;
if (skb_is_gso(skb))
- features = gso_features_check(skb, dev, features);
+ features = gso_features_check(skb, dev, features,
+ check_gso_limits);
/* If encapsulation offload request, verify we are testing
* hardware encapsulation features instead of standard
@@ -3956,7 +3975,54 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
return harmonize_features(skb, features);
}
-EXPORT_SYMBOL(netif_skb_features);
+EXPORT_SYMBOL(__netif_skb_features);
+
+static unsigned int
+skb_gso_output_max_segs(struct sk_buff *skb, struct net_device *dev)
+{
+ unsigned int mss = skb_shinfo(skb)->gso_size;
+ unsigned int gso_max_size, hdr_len, max_segs;
+ netdev_features_t features;
+ struct tcphdr _tcph, *th;
+
+ if (!skb_is_gso(skb) || !skb_is_gso_tcp(skb) ||
+ skb->encapsulation || skb_has_frag_list(skb))
+ return 0;
+
+ /*
+ * The transport offset can be unset or stale, so hdr_len is only taken
+ * from a header at the checksum start.
+ */
+ if (!skb_transport_header_was_set(skb) ||
+ skb_checksum_start(skb) != skb_transport_header(skb))
+ return 0;
+
+ th = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph),
+ &_tcph);
+ if (!th || __tcp_hdrlen(th) < sizeof(*th))
+ return 0;
+
+ hdr_len = skb_transport_header(skb) - skb_mac_header(skb) +
+ __tcp_hdrlen(th);
+
+ /* The output is still a GSO skb: recheck without the limit checks */
+ features = __netif_skb_features(skb, false) | NETIF_F_GSO_ROBUST;
+ if (!net_gso_ok(features, skb_shinfo(skb)->gso_type))
+ return 0;
+
+ gso_max_size = netif_get_gso_max_size(dev, skb);
+ gso_max_size = min(gso_max_size, GSO_LEGACY_MAX_SIZE);
+
+ /*
+ * gso_within_dev_limits() accepts gso_segs == gso_max_segs but
+ * rejects skb->len >= gso_max_size, so only the size limit needs the
+ * - 1; the inner min() keeps that subtraction from wrapping.
+ */
+ max_segs = (gso_max_size - min(gso_max_size, hdr_len + 1)) / mss;
+ max_segs = min(max_segs, READ_ONCE(dev->gso_max_segs));
+
+ return max_segs;
+}
static int xmit_one(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq, bool more)
@@ -4122,9 +4188,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
goto out_null;
if (netif_needs_gso(skb, features)) {
+ unsigned int max_segs = 0;
struct sk_buff *segs;
- segs = skb_gso_segment(skb, features);
+ if (unlikely(!gso_within_dev_limits(skb, dev)))
+ max_segs = skb_gso_output_max_segs(skb, dev);
+
+ segs = __skb_gso_segment(skb, features, true, max_segs);
if (IS_ERR(segs)) {
goto out_kfree_skb;
} else if (segs) {
diff --git a/net/core/gso.c b/net/core/gso.c
index bcd156372f4df..21a259ca392f4 100644
--- a/net/core/gso.c
+++ b/net/core/gso.c
@@ -77,6 +77,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)
* @skb: buffer to segment
* @features: features for the output path (see dev->features)
* @tx_path: whether it is called in TX path
+ * @max_segs: maximum MSS segments per output GSO skb, 0 means no limit;
+ * set only for an unencapsulated TCP skb without a frag_list
*
* This function segments the given skb and returns a list of segments.
*
@@ -86,7 +88,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)
* Segmentation preserves SKB_GSO_CB_OFFSET bytes of previous skb cb.
*/
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
- netdev_features_t features, bool tx_path)
+ netdev_features_t features, bool tx_path,
+ unsigned int max_segs)
{
struct sk_buff *segs;
@@ -117,6 +120,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);
SKB_GSO_CB(skb)->encap_level = 0;
+ SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);
skb_reset_mac_header(skb);
skb_reset_mac_len(skb);
diff --git a/net/core/net_test.c b/net/core/net_test.c
index 9c3a590865d26..6a91db83e5301 100644
--- a/net/core/net_test.c
+++ b/net/core/net_test.c
@@ -4,7 +4,14 @@
/* GSO */
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/netdevice.h>
#include <linux/skbuff.h>
+#include <linux/tcp.h>
+#include <net/gso.h>
static const char hdr[] = "abcdefgh";
#define GSO_TEST_SIZE 1000
@@ -34,6 +41,9 @@ enum gso_test_nr {
GSO_TEST_FRAG_LIST_PURE,
GSO_TEST_FRAG_LIST_NON_UNIFORM,
GSO_TEST_GSO_BY_FRAGS,
+ GSO_TEST_RESEGMENT,
+ GSO_TEST_RESEGMENT_MULTI,
+ GSO_TEST_RESEGMENT_ONE_MSS,
};
struct gso_test_case {
@@ -46,10 +56,12 @@ struct gso_test_case {
const unsigned int *frags;
unsigned int nr_frag_skbs;
const unsigned int *frag_skbs;
+ unsigned int max_segs;
/* output as expected */
unsigned int nr_segs;
const unsigned int *segs;
+ bool segs_are_gso;
};
static struct gso_test_case cases[] = {
@@ -135,6 +147,51 @@ static struct gso_test_case cases[] = {
.nr_segs = 4,
.segs = (const unsigned int[]) { 100, 200, 300, 400 },
},
+ {
+ .id = GSO_TEST_RESEGMENT,
+ .name = "resegment",
+ .linear_len = GSO_TEST_SIZE,
+ .nr_frags = 3,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 2,
+ .nr_segs = 2,
+ .segs = (const unsigned int[]) {
+ 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ },
+ .segs_are_gso = true,
+ },
+ {
+ .id = GSO_TEST_RESEGMENT_MULTI,
+ .name = "resegment_multi",
+ .linear_len = 2 * GSO_TEST_SIZE,
+ .nr_frags = 4,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 2,
+ .nr_segs = 3,
+ .segs = (const unsigned int[]) {
+ 2 * GSO_TEST_SIZE, 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ },
+ .segs_are_gso = true,
+ },
+ {
+ /* A max_segs of one leaves one MSS per skb, like no limit. */
+ .id = GSO_TEST_RESEGMENT_ONE_MSS,
+ .name = "resegment_one_mss",
+ .linear_len = GSO_TEST_SIZE,
+ .nr_frags = 3,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 1,
+ .nr_segs = 4,
+ .segs = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ },
};
static void gso_test_case_to_desc(struct gso_test_case *t, char *desc)
@@ -226,6 +283,7 @@ static void gso_test_func(struct kunit *test)
if (tcase->id == GSO_TEST_FRAG_LIST_NON_UNIFORM)
features &= ~NETIF_F_SG;
+ SKB_GSO_CB(skb)->max_segs = tcase->max_segs;
segs = skb_segment(skb, features);
if (IS_ERR(segs)) {
KUNIT_FAIL(test, "segs error %pe", segs);
@@ -239,6 +297,7 @@ static void gso_test_func(struct kunit *test)
for (cur = segs, i = 0; cur; cur = next, i++) {
next = cur->next;
+ KUNIT_ASSERT_LT(test, i, tcase->nr_segs);
KUNIT_ASSERT_EQ(test, cur->len, sizeof(hdr) + tcase->segs[i]);
/* segs have skb->data pointing to the mac header */
@@ -247,6 +306,18 @@ static void gso_test_func(struct kunit *test)
/* header was copied to all segs */
KUNIT_ASSERT_EQ(test, memcmp(skb_mac_header(cur), hdr, sizeof(hdr)), 0);
+ if (tcase->segs_are_gso) {
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_size,
+ GSO_TEST_SIZE);
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_segs,
+ DIV_ROUND_UP(tcase->segs[i],
+ GSO_TEST_SIZE));
+ KUNIT_EXPECT_FALSE(test, skb_shinfo(cur)->gso_type &
+ SKB_GSO_PARTIAL);
+ } else if (tcase->max_segs) {
+ KUNIT_EXPECT_FALSE(test, skb_is_gso(cur));
+ }
/* last seg can be found through segs->prev pointer */
if (!next)
@@ -261,6 +332,283 @@ static void gso_test_func(struct kunit *test)
consume_skb(skb);
}
+#define GSO_TCP_HDR_LEN \
+ (ETH_HLEN + sizeof(struct iphdr) + sizeof(struct tcphdr))
+
+static struct sk_buff *gso_tcp_skb_new(unsigned int payload_len)
+{
+ struct sk_buff *skb;
+ struct ethhdr *eth;
+ struct tcphdr *th;
+ struct iphdr *iph;
+
+ skb = alloc_skb(NET_SKB_PAD + GSO_TCP_HDR_LEN + payload_len,
+ GFP_KERNEL);
+ if (!skb)
+ return NULL;
+ skb_reserve(skb, NET_SKB_PAD);
+ skb_put_zero(skb, GSO_TCP_HDR_LEN + payload_len);
+
+ skb_reset_mac_header(skb);
+ eth = eth_hdr(skb);
+ eth->h_proto = htons(ETH_P_IP);
+ skb->protocol = eth->h_proto;
+
+ skb_set_network_header(skb, ETH_HLEN);
+ iph = ip_hdr(skb);
+ iph->version = 4;
+ iph->ihl = sizeof(*iph) / 4;
+ iph->protocol = IPPROTO_TCP;
+ iph->tot_len = htons(sizeof(*iph) + sizeof(*th) + payload_len);
+
+ skb_set_transport_header(skb, ETH_HLEN + sizeof(*iph));
+ th = tcp_hdr(skb);
+ th->doff = sizeof(*th) / 4;
+
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct tcphdr, check);
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+ skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);
+
+ return skb;
+}
+
+/*
+ * The transmit path passes the features of the device which rejects this
+ * skb, with the GSO bits cleared, so the engine segments it.
+ */
+static void gso_test_tcp_resegment(struct kunit *test)
+{
+ netdev_features_t features = NETIF_F_SG | NETIF_F_HW_CSUM;
+ const unsigned int payload_len = 3 * GSO_TEST_SIZE + 3;
+ struct sk_buff *skb, *segs, *cur, *next;
+ const unsigned int expected[] = {
+ 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ };
+ const unsigned int max_segs = 2;
+ int i = 0;
+
+ if (!IS_ENABLED(CONFIG_INET))
+ kunit_skip(test, "requires CONFIG_INET");
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no skb");
+ return;
+ }
+
+ segs = __skb_gso_segment(skb, features, true, max_segs);
+ if (IS_ERR_OR_NULL(segs)) {
+ KUNIT_FAIL(test, "segs error %pe", segs);
+ consume_skb(skb);
+ return;
+ }
+
+ for (cur = segs; cur; cur = next, i++) {
+ next = cur->next;
+
+ if (i < ARRAY_SIZE(expected)) {
+ KUNIT_EXPECT_EQ(test, cur->len,
+ GSO_TCP_HDR_LEN + expected[i]);
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_segs,
+ DIV_ROUND_UP(expected[i],
+ GSO_TEST_SIZE));
+ }
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_size,
+ GSO_TEST_SIZE);
+
+ consume_skb(cur);
+ }
+
+ KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(expected));
+ consume_skb(skb);
+}
+
+#define GSO_TCP6_HDR_LEN \
+ (ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct tcphdr))
+
+static struct sk_buff *gso_tcp6_skb_new(unsigned int payload_len)
+{
+ struct ipv6hdr *ip6h;
+ struct sk_buff *skb;
+ struct ethhdr *eth;
+ struct tcphdr *th;
+
+ skb = alloc_skb(NET_SKB_PAD + GSO_TCP6_HDR_LEN + payload_len,
+ GFP_KERNEL);
+ if (!skb)
+ return NULL;
+ skb_reserve(skb, NET_SKB_PAD);
+ skb_put_zero(skb, GSO_TCP6_HDR_LEN + payload_len);
+
+ skb_reset_mac_header(skb);
+ eth = eth_hdr(skb);
+ eth->h_proto = htons(ETH_P_IPV6);
+ skb->protocol = eth->h_proto;
+
+ skb_set_network_header(skb, ETH_HLEN);
+ ip6h = ipv6_hdr(skb);
+ ip6h->version = 6;
+ ip6h->nexthdr = IPPROTO_TCP;
+ ip6h->payload_len = htons(sizeof(*th) + payload_len);
+
+ skb_set_transport_header(skb, ETH_HLEN + sizeof(*ip6h));
+ th = tcp_hdr(skb);
+ th->doff = sizeof(*th) / 4;
+
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct tcphdr, check);
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+ skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);
+
+ return skb;
+}
+
+/*
+ * The device GSO size limit is per L3 protocol, so only a lowered limit of
+ * the packet's own protocol may cost it the TSO bit, and a tag inside the
+ * frame, which replaces skb->protocol with the ethertype, must not change
+ * which limit applies. Takes ownership of @skb.
+ */
+static void gso_test_tcp_l3_limit(struct kunit *test, struct net_device *dev,
+ struct sk_buff *skb, netdev_features_t tso,
+ bool ipv6)
+{
+ unsigned int other = GSO_LEGACY_MAX_SIZE;
+ unsigned int own = GSO_MAX_SIZE;
+
+ /* The skb fits the limit of its own L3 protocol, not the other's. */
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_TRUE(test, netif_skb_features(skb) & tso);
+
+ /* ...and the other way around. */
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_FALSE(test, netif_skb_features(skb) & tso);
+
+ skb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), 0);
+ if (!skb) {
+ KUNIT_FAIL(test, "no tagged skb");
+ return;
+ }
+ KUNIT_EXPECT_TRUE(test, skb->protocol == htons(ETH_P_8021Q));
+
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_TRUE(test, netif_skb_features(skb) & tso);
+
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_FALSE(test, netif_skb_features(skb) & tso);
+
+ consume_skb(skb);
+}
+
+static void gso_test_tcp_limit_l3_proto(struct kunit *test)
+{
+ static const struct net_device_ops dummy_netdev_ops = { };
+ const unsigned int payload_len = 100 * 1024;
+ struct net_device *dev;
+ struct sk_buff *skb;
+
+ dev = alloc_etherdev(0);
+ if (!dev) {
+ KUNIT_FAIL(test, "no net_device");
+ return;
+ }
+ dev->netdev_ops = &dummy_netdev_ops;
+ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
+ NETIF_F_TSO6;
+ dev->features = dev->hw_features;
+ dev->vlan_features = dev->hw_features;
+
+ skb = gso_tcp6_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no IPv6 skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+ gso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO6, true);
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no IPv4 skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+ gso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO, false);
+
+free_dev:
+ free_netdev(dev);
+}
+
+/*
+ * A re-segmented output is a plain GSO skb, so the whole length lands in the
+ * 16-bit L3 length field. A device which accepts GSO skbs above 64 KiB would
+ * otherwise be handed outputs whose length field truncates.
+ */
+static void gso_test_tcp_resegment_l3_len(struct kunit *test)
+{
+ static const struct net_device_ops dummy_netdev_ops = { };
+ const unsigned int payload_len = 200 * 1024;
+ struct sk_buff *skb, *segs, *cur, *next;
+ unsigned int nr_segs = 0;
+ struct net_device *dev;
+ bool again = false;
+
+ if (!IS_ENABLED(CONFIG_INET))
+ kunit_skip(test, "requires CONFIG_INET");
+
+ dev = alloc_etherdev(0);
+ if (!dev) {
+ KUNIT_FAIL(test, "no net_device");
+ return;
+ }
+ dev->netdev_ops = &dummy_netdev_ops;
+ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
+ dev->features = dev->hw_features;
+ dev->vlan_features = dev->hw_features;
+ dev->gso_ipv4_max_size = 120 * 1024;
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+
+ segs = validate_xmit_skb_list(skb, dev, &again);
+ if (IS_ERR_OR_NULL(segs)) {
+ KUNIT_FAIL(test, "segs error %pe", segs);
+ goto free_dev;
+ }
+
+ for (cur = segs; cur; cur = next, nr_segs++) {
+ next = cur->next;
+ cur->next = NULL;
+
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, ntohs(ip_hdr(cur)->tot_len),
+ cur->len - (skb_network_header(cur) -
+ skb_mac_header(cur)));
+ consume_skb(cur);
+ }
+
+ KUNIT_EXPECT_EQ(test, nr_segs, 4);
+
+free_dev:
+ free_netdev(dev);
+}
+
/* IP tunnel flags */
#include <net/ip_tunnels.h>
@@ -372,6 +720,9 @@ static void ip_tunnel_flags_test_run(struct kunit *test)
static struct kunit_case net_test_cases[] = {
KUNIT_CASE_PARAM(gso_test_func, gso_test_gen_params),
+ KUNIT_CASE(gso_test_tcp_resegment),
+ KUNIT_CASE(gso_test_tcp_limit_l3_proto),
+ KUNIT_CASE(gso_test_tcp_resegment_l3_len),
KUNIT_CASE_PARAM(ip_tunnel_flags_test_run,
ip_tunnel_flags_test_gen_params),
{ },
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8912a66cd9097..fd10a7cdc1883 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4793,6 +4793,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
struct sk_buff *segs = NULL;
struct sk_buff *tail = NULL;
struct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;
+ unsigned int max_segs = SKB_GSO_CB(head_skb)->max_segs;
unsigned int mss = skb_shinfo(head_skb)->gso_size;
bool gso_by_frags = mss == GSO_BY_FRAGS;
unsigned int doffset = head_skb->data - skb_mac_header(head_skb);
@@ -4839,7 +4840,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
csum = !!can_checksum_protocol(features, proto);
if (sg && csum && !gso_by_frags) {
- if (!(features & NETIF_F_GSO_PARTIAL)) {
+ if (!max_segs && !(features & NETIF_F_GSO_PARTIAL)) {
struct sk_buff *iter;
unsigned int frag_len;
@@ -4874,7 +4875,10 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
* now.
*/
DEBUG_NET_WARN_ON_ONCE(len / mss > GSO_MAX_SEGS);
- partial_segs = min(len / mss, GSO_MAX_SEGS);
+ if (max_segs)
+ partial_segs = min(len / mss, max_segs);
+ else
+ partial_segs = min(len / mss, GSO_MAX_SEGS);
if (partial_segs > 1)
mss *= partial_segs;
else
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 2187034143255..e793aead68372 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -375,7 +375,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
int err;
BUILD_BUG_ON(sizeof(*OVS_CB(skb)) > SKB_GSO_CB_OFFSET);
- segs = __skb_gso_segment(skb, NETIF_F_SG, false);
+ segs = __skb_gso_segment(skb, NETIF_F_SG, false, 0);
if (IS_ERR(segs))
return PTR_ERR(segs);
if (segs == NULL)
|
| 3/2 | 2026/10/01 10:04 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 13027 output: 36 thoughts: 459 Thoughts: **Fuzzing Evaluation: Network GSO Patch Series** Okay, here's what I'm thinking. This patch series is touching some serious ground, and my gut reaction is that we need to fuzz this *thoroughly*. Let's break it down methodically. First, I need to make sure I'm following the right procedure. The instructions say to determine if this patch touches *reachable* code that's worth fuzzing. The key question is reachability, obviously. And, looking at the code, we're talking about changes across `net/core/dev.c`, `net/core/skbuff.c`, `net/core/gso.c`, and a couple of relevant header files. This is *core* networking territory: packet transmission, segmentation, GSO limits, and TCP resegmentation. That's a massive flag for fuzzing! This isn't just a minor tweak; it's refactoring and modifying the core Generic Segmentation Offload (GSO) logic. The patch is changing fundamental functions, adding new ones, including `__skb_gso_segment`, `skb_segment`, `validate_xmit_skb`, and `gso_features_check`, and introducing new variables like `skb_gso_output_max_segs` and `gso_within_dev_limits`. The patch touches the meat and potatoes of network performance, including limiting and segmenting, and that screams potential for subtle, hard-to-find bugs, especially around corner cases or unexpected interactions. So, yes, the initial assessment is that this is *definitely* worth fuzzing. *WorthFuzzing=true*. Now, let's zoom in on the specific functions and symbols that are being added/modified. The patch is changing: `validate_xmit_skb`, `skb_gso_output_max_segs`, `gso_within_dev_limits`, `__netif_skb_features`, `gso_features_check`, `netif_get_gso_max_size`, `__skb_gso_segment`, and `skb_segment`. Hold on a second, though. I need to make sure I'm not missing anything. I need to take a closer look at key functions like `validate_xmit_skb`, `skb_segment`, and `skb_gso_output_max_segs`. This requires a much more detailed look with the right tools. I need to check the `FocusSymbols` and `EnableConfigs` to tailor the fuzzing appropriately. It's time to dig into the codebase and understand the impact of these changes on the network stack in detail before proceeding. |
| 4/2 | 2026/10/01 10:04 | tool | grepper |
0mArgs:{
"Expression": "skb_gso_output_max_segs",
"PathPrefix": "net/core/"
}Results: {
"Output": "net/core/dev.c=3980=static unsigned int\nnet/core/dev.c:3981:skb_gso_output_max_segs(struct sk_buff *skb, struct net_device *dev)\nnet/core/dev.c-3982-{\n--\nnet/core/dev.c=4173=static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again)\n--\nnet/core/dev.c-4194-\t\tif (unlikely(!gso_within_dev_limits(skb, dev)))\nnet/core/dev.c:4195:\t\t\tmax_segs = skb_gso_output_max_segs(skb, dev);\nnet/core/dev.c-4196-\n"
} |
| 5/2 | 2026/10/01 10:04 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14329 output: 36 thoughts: 580 Thoughts: **Analyzing Kernel GSO Changes** Okay, let's break this down. First, `skb_gso_output_max_segs`. I need to confirm something – it's static within `net/core/dev.c`, right? Yup, `static unsigned int skb_gso_output_max_segs(...)`. Now, because it's static within a .c file, in a standard kernel build, it should have a symbol, unless it's inlined. Hmm, is it inlined? I should probably double-check that, or at least look at the callers and exported functions to confirm. Okay, back up, what exactly was modified or added? Let's re-examine this diff. It looks like: 1. `drivers/net/tap.c` now has `tap_handle_frame` calling `__skb_gso_segment`. 2. `include/linux/netdevice.h` had some GSO-related functions moved around, specifically moving `netif_get_gso_max_size` (static inline) out of the header and into `net/core/dev.c`. 3. `include/net/gso.h` now includes `__skb_gso_segment(..., unsigned int max_segs)`. 4. `include/net/udp.h` has `udp_rcv_segment`. 5. `net/core/dev.c` is the big one. It now includes: `netif_get_gso_max_size` (static), `gso_within_dev_limits` (static), `gso_features_check` (static), `__netif_skb_features` (EXPORT_SYMBOL), `skb_gso_output_max_segs` (static), and `validate_xmit_skb` (static). 6. `net/core/gso.c` defines `__skb_gso_segment` (non-static). 7. `net/core/skbuff.c` defines `skb_segment` (non-static, EXPORT_SYMBOL_GPL). 8. `net/openvswitch/datapath.c` has `queue_gso_packets`. 9. `net/core/net_test.c` has KUnit tests for GSO resegmentation. Alright, with the scope of changes, I need to read `net/core/dev.c` closely, particularly around `skb_gso_output_max_segs` and `validate_xmit_skb`. This should give me a better understanding of the rationale behind these changes. |
| 6/2 | 2026/10/01 10:04 | tool | read-file |
0mArgs:{
"File": "net/core/dev.c",
"FirstLine": 4180,
"LineCount": 50
}Results: {
"Contents": "4180:\t\n4181:\t\tfeatures = netif_skb_features(skb);\n4182:\t\tskb = validate_xmit_vlan(skb, features);\n4183:\t\tif (unlikely(!skb))\n4184:\t\t\tgoto out_null;\n4185:\t\n4186:\t\tskb = sk_validate_xmit_skb(skb, dev);\n4187:\t\tif (unlikely(!skb))\n4188:\t\t\tgoto out_null;\n4189:\t\n4190:\t\tif (netif_needs_gso(skb, features)) {\n4191:\t\t\tunsigned int max_segs = 0;\n4192:\t\t\tstruct sk_buff *segs;\n4193:\t\n4194:\t\t\tif (unlikely(!gso_within_dev_limits(skb, dev)))\n4195:\t\t\t\tmax_segs = skb_gso_output_max_segs(skb, dev);\n4196:\t\n4197:\t\t\tsegs = __skb_gso_segment(skb, features, true, max_segs);\n4198:\t\t\tif (IS_ERR(segs)) {\n4199:\t\t\t\tgoto out_kfree_skb;\n4200:\t\t\t} else if (segs) {\n4201:\t\t\t\tconsume_skb(skb);\n4202:\t\t\t\tskb = segs;\n4203:\t\t\t}\n4204:\t\t} else {\n4205:\t\t\tif (skb_needs_linearize(skb, features) \u0026\u0026\n4206:\t\t\t __skb_linearize(skb))\n4207:\t\t\t\tgoto out_kfree_skb;\n4208:\t\n4209:\t\t\t/* If packet is not checksummed and device does not\n4210:\t\t\t * support checksumming for this protocol, complete\n4211:\t\t\t * checksumming here.\n4212:\t\t\t */\n4213:\t\t\tif (skb-\u003eip_summed == CHECKSUM_PARTIAL) {\n4214:\t\t\t\tif (skb-\u003eencapsulation)\n4215:\t\t\t\t\tskb_set_inner_transport_header(skb,\n4216:\t\t\t\t\t\t\t\t skb_checksum_start_offset(skb));\n4217:\t\t\t\telse\n4218:\t\t\t\t\tskb_set_transport_header(skb,\n4219:\t\t\t\t\t\t\t\t skb_checksum_start_offset(skb));\n4220:\t\t\t\tif (skb_csum_hwoffload_help(skb, features))\n4221:\t\t\t\t\tgoto out_kfree_skb;\n4222:\t\t\t}\n4223:\t\t}\n4224:\t\n4225:\t\tskb = validate_xmit_xfrm(skb, features, again);\n4226:\t\n4227:\t\treturn skb;\n4228:\t\n4229:\tout_kfree_skb:\n"
} |
| 7/2 | 2026/10/01 10:04 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16324 output: 34 thoughts: 28 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving Deep into Packet Validation** Alright, so the task at hand is to understand how packets are hitting `validate_xmit_skb`. My immediate instinct is to trace the call paths – let's see which functions are calling it directly. Essentially, I need to map out the call graph for that function. This is often the most efficient way to understand the control flow, but it only shows the immediate parents. That gives me a starting point, but I'm also interested in the broader context. How *do* packets reach that critical validation point? What are the entry points into that function's domain? I need to think about the different paths that data can take through the network stack. I'll need to consider various network devices, protocols, and the specific configurations they could be running. I'll also look for interrupt handlers that could inject packets. I'm going to start with the obvious network interfaces, driver entries, but I'm going to quickly get to any relevant interrupt handlers. Essentially, I want a complete picture. This isn't just about the immediate callers. I need to understand the larger pipeline – the journey a packet takes before it's subjected to this crucial validation step. The goal is to comprehensively understand the data flow, all the possible points of entry, and all the paths by which packets traverse to reach `validate_xmit_skb`. From there, I'll be in a better position to analyze the validation logic itself. |
| 8/2 | 2026/10/01 10:04 | tool | grepper |
0mArgs:{
"Expression": "validate_xmit_skb",
"PathPrefix": "net/core/dev.c"
}Results: {
"Output": "net/core/dev.c=4106=EXPORT_SYMBOL(skb_csum_hwoffload_help);\n--\nnet/core/dev.c-4111- */\nnet/core/dev.c:4112:static struct sk_buff *sk_validate_xmit_skb(struct sk_buff *skb,\nnet/core/dev.c-4113-\t\t\t\t\t struct net_device *dev)\n--\nnet/core/dev.c-4122-\t\tif (sk_fullsock(sk))\nnet/core/dev.c:4123:\t\t\tsk_validate = sk-\u003esk_validate_xmit_skb;\nnet/core/dev.c-4124-\t\telse if (sk_is_inet(sk) \u0026\u0026 sk-\u003esk_state == TCP_TIME_WAIT)\nnet/core/dev.c:4125:\t\t\tsk_validate = inet_twsk(sk)-\u003etw_validate_xmit_skb;\nnet/core/dev.c-4126-\t}\n--\nnet/core/dev.c=4140=static struct sk_buff *validate_xmit_unreadable_skb(struct sk_buff *skb,\n--\nnet/core/dev.c-4172- */\nnet/core/dev.c:4173:static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again)\nnet/core/dev.c-4174-{\n--\nnet/core/dev.c-4185-\nnet/core/dev.c:4186:\tskb = sk_validate_xmit_skb(skb, dev);\nnet/core/dev.c-4187-\tif (unlikely(!skb))\n--\nnet/core/dev.c-4235-\nnet/core/dev.c:4236:struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again)\nnet/core/dev.c-4237-{\n--\nnet/core/dev.c-4246-\nnet/core/dev.c:4247:\t\tskb = validate_xmit_skb(skb, dev, again);\nnet/core/dev.c-4248-\t\tif (IS_ERR_OR_NULL(skb))\n--\nnet/core/dev.c-4261-}\nnet/core/dev.c:4262:EXPORT_SYMBOL_GPL(validate_xmit_skb_list);\nnet/core/dev.c-4263-\n--\nnet/core/dev.c=4924=int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)\n--\nnet/core/dev.c-5017-\nnet/core/dev.c:5018:\t\tskb = validate_xmit_skb(skb, dev, \u0026again);\nnet/core/dev.c-5019-\t\tif (IS_ERR_OR_NULL(skb)) {\n--\nnet/core/dev.c=5071=int __dev_direct_xmit(struct sk_buff *skb, u16 queue_id)\n--\nnet/core/dev.c-5082-\nnet/core/dev.c:5083:\tskb = validate_xmit_skb_list(skb, dev, \u0026again);\nnet/core/dev.c-5084-\tif (skb != orig_skb)\n"
} |
| 9/2 | 2026/10/01 10:04 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17634 output: 36 thoughts: 630 Thoughts: **Analyzing the Fuzzing Strategy for This Network Patch** Okay, let's break this down. My initial instinct was to include `validate_xmit_skb_list` in the fuzzing list because `validate_xmit_skb` is called by it, and also by `__dev_queue_xmit`. And hey, `__dev_queue_xmit` is *the* general transmit path, practically the root of every single packet transmission in the Linux network stack. It's called for *every* send. But wait... The guidelines are pretty clear: "AVOID UBIQUITOUS LIFECYCLE HOT-PATHS." Including `__dev_queue_xmit` would be a disaster, drowning the fuzzer in irrelevant tests. We'd dilute the fuzzing effort, making it impossible to focus on *this* patch's specific logic. So, let's refocus. What are the *actual* functions modified or introduced by this patch? Let's see: 1. `skb_gso_output_max_segs` in `net/core/dev.c`. Static, but implements the new max segs logic. This is promising. 2. `__netif_skb_features`, also in `net/core/dev.c`. It's exported and now takes a `bool check_gso_limits` argument. That's a good candidate. 3. `gso_within_dev_limits`, again in `net/core/dev.c`. A static helper, checking GSO against device limits. Potentially relevant. 4. `__skb_gso_segment` in `net/core/gso.c`, core GSO entrypoint, its signature changed to take `max_segs`. This is definitely in the crosshairs! 5. `skb_segment` in `net/core/skbuff.c`. The segmentation logic itself, modified to handle `max_segs`. Absolutely critical. 6. `validate_xmit_skb` and `validate_xmit_skb_list`. Okay, now we're back to where this started. *But...* this is where `skb_gso_output_max_segs` and `__skb_gso_segment` with `max_segs` are called when `!gso_within_dev_limits(skb, dev)`. However, is `validate_xmit_skb` called for *every* packet sent? I'm worried it might be just as ubiquitous as `__dev_queue_xmit`. I need to double-check this: Let me go to `net/core/dev.c` and check the call path around line 5018. It might be that `validate_xmit_skb` isn't called for every packet *generally* but only in specific scenarios, like GSO limit enforcement. |
| 10/2 | 2026/10/01 10:05 | tool | read-file |
0mArgs:{
"File": "net/core/dev.c",
"FirstLine": 5010,
"LineCount": 20
}Results: {
"Contents": "5010:\t\tcpu = smp_processor_id(); /* ok because BHs are off */\n5011:\t\n5012:\t\tif (likely(!netif_tx_owned(txq, cpu))) {\n5013:\t\t\tbool is_list = false;\n5014:\t\n5015:\t\t\tif (dev_xmit_recursion())\n5016:\t\t\t\tgoto recursion_alert;\n5017:\t\n5018:\t\t\tskb = validate_xmit_skb(skb, dev, \u0026again);\n5019:\t\t\tif (IS_ERR_OR_NULL(skb)) {\n5020:\t\t\t\tif (PTR_ERR(skb) == -EINPROGRESS)\n5021:\t\t\t\t\trc = NET_XMIT_SUCCESS;\n5022:\t\t\t\tgoto out;\n5023:\t\t\t}\n5024:\t\n5025:\t\t\tHARD_TX_LOCK(dev, txq, cpu);\n5026:\t\n5027:\t\t\tif (!netif_xmit_stopped(txq)) {\n5028:\t\t\t\tis_list = !!skb-\u003enext;\n5029:\t\n"
} |
| 11/2 | 2026/10/01 10:05 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19249 output: 26 thoughts: 684 Thoughts: **Analyzing the Core Functions Involved in Packet Segmentation and Transmission** Okay, so I'm diving into this code path, and the first thing that jumps out at me is how frequently `validate_xmit_skb` is called. It's practically *everywhere* in the packet transmission process, whether it's direct transmit or dequeuing from a queueing discipline. So, it's a critical function for almost all network traffic. But then, I need to understand where the real segmentation logic kicks in. `skb_segment` is the function responsible for software segmentation, it's only called when a GSO (Generic Segmentation Offload) packet actually *needs* segmentation, when the hardware can't handle it, or it needs to be broken down further. The same goes for `__skb_gso_segment` - it's the direct entry point for GSO segmentation. And of course, `skb_gso_output_max_segs` is specifically for calculating the maximum segments in resegmentation scenarios, when packets exceed device limits. I need to confirm that `gso_within_dev_limits` is called inside `gso_features_check` and `validate_xmit_skb`. And of course `__netif_skb_features` is called whenever `netif_skb_features` is called, and `netif_skb_features` is called in `validate_xmit_skb`. Now, let's zoom in on the specific functions this patch series is touching: `skb_gso_output_max_segs`, `gso_within_dev_limits`, `__skb_gso_segment`, `skb_segment`, `__netif_skb_features` and `gso_features_check`. I need to figure out what's really being changed. I need to verify that `skb_segment` isn't ubiquitous, and that it's only hit when there's an actual need for segmentation. That makes sense, in typical syzkaller runs with loopback devices, `skb_segment` is the GSO segmentation engine. And `__skb_gso_segment` is the direct GSO entrypoint, and `skb_gso_output_max_segs` computes max segments for resegmentation. Alright, so the key is understanding how this patch series is actually changing the behavior of these segmentation functions. Time to go to the source – the git log. Let's read the commit message and author explanation to understand the rationale behind these changes. |
| 12/2 | 2026/10/01 10:05 | tool | grepper |
0mArgs:{
"Expression": "resegment",
"PathPrefix": "net/core/"
}Results: {
"Output": "net/core/net_test.c=67=static struct gso_test_case cases[] = {\n--\nnet/core/net_test.c-151-\t\t.id = GSO_TEST_RESEGMENT,\nnet/core/net_test.c:152:\t\t.name = \"resegment\",\nnet/core/net_test.c-153-\t\t.linear_len = GSO_TEST_SIZE,\n--\nnet/core/net_test.c-166-\t\t.id = GSO_TEST_RESEGMENT_MULTI,\nnet/core/net_test.c:167:\t\t.name = \"resegment_multi\",\nnet/core/net_test.c-168-\t\t.linear_len = 2 * GSO_TEST_SIZE,\n--\nnet/core/net_test.c-182-\t\t.id = GSO_TEST_RESEGMENT_ONE_MSS,\nnet/core/net_test.c:183:\t\t.name = \"resegment_one_mss\",\nnet/core/net_test.c-184-\t\t.linear_len = GSO_TEST_SIZE,\n--\nnet/core/net_test.c=338=static struct sk_buff *gso_tcp_skb_new(unsigned int payload_len)\n--\nnet/core/net_test.c-381- */\nnet/core/net_test.c:382:static void gso_test_tcp_resegment(struct kunit *test)\nnet/core/net_test.c-383-{\n--\nnet/core/net_test.c=516=static void gso_test_tcp_limit_l3_proto(struct kunit *test)\n--\nnet/core/net_test.c-558- */\nnet/core/net_test.c:559:static void gso_test_tcp_resegment_l3_len(struct kunit *test)\nnet/core/net_test.c-560-{\n--\nnet/core/net_test.c=721=static struct kunit_case net_test_cases[] = {\nnet/core/net_test.c-722-\tKUNIT_CASE_PARAM(gso_test_func, gso_test_gen_params),\nnet/core/net_test.c:723:\tKUNIT_CASE(gso_test_tcp_resegment),\nnet/core/net_test.c-724-\tKUNIT_CASE(gso_test_tcp_limit_l3_proto),\nnet/core/net_test.c:725:\tKUNIT_CASE(gso_test_tcp_resegment_l3_len),\nnet/core/net_test.c-726-\tKUNIT_CASE_PARAM(ip_tunnel_flags_test_run,\n"
} |
| 13/2 | 2026/10/01 10:05 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21233 output: 37 thoughts: 182 Thoughts: **Analyzing the Commit and Code Changes** Okay, first things first, I need to understand this commit. I was initially going to try to use `git log` to get the commit message and context, but I don't have that tool directly available. No problem, I can work around this. Instead of a direct git log, I'll go for the diff or file reading. And, ah ha! The commit info *is* in the prompt! Excellent. Author: syz-cluster, the date, and the message “syz-cluster: applied patch under review.” That's helpful, but not enough. Now, to really grasp the impact of this change, I need to look at the code. The message mentions `skb_segment`, so I'll go directly to `net/core/skbuff.c` and specifically lines 4830-4890. That should give me the core change in context. I'll read those lines carefully and see what the patch is doing within the `skb_segment` function. Hopefully, this context will be enough to determine if the commit has any important implication. |
| 14/2 | 2026/10/01 10:05 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 4835,
"LineCount": 60
}Results: {
"Contents": "4835:\t\tproto = skb_network_protocol(head_skb, NULL);\n4836:\t\tif (unlikely(!proto))\n4837:\t\t\treturn ERR_PTR(-EINVAL);\n4838:\t\n4839:\t\tsg = !!(features \u0026 NETIF_F_SG);\n4840:\t\tcsum = !!can_checksum_protocol(features, proto);\n4841:\t\n4842:\t\tif (sg \u0026\u0026 csum \u0026\u0026 !gso_by_frags) {\n4843:\t\t\tif (!max_segs \u0026\u0026 !(features \u0026 NETIF_F_GSO_PARTIAL)) {\n4844:\t\t\t\tstruct sk_buff *iter;\n4845:\t\t\t\tunsigned int frag_len;\n4846:\t\n4847:\t\t\t\tif (!list_skb ||\n4848:\t\t\t\t !net_gso_ok(features, skb_shinfo(head_skb)-\u003egso_type))\n4849:\t\t\t\t\tgoto normal;\n4850:\t\n4851:\t\t\t\t/* If we get here then all the required\n4852:\t\t\t\t * GSO features except frag_list are supported.\n4853:\t\t\t\t * Try to split the SKB to multiple GSO SKBs\n4854:\t\t\t\t * with no frag_list.\n4855:\t\t\t\t * Currently we can do that only when the buffers don't\n4856:\t\t\t\t * have a linear part and all the buffers except\n4857:\t\t\t\t * the last are of the same length.\n4858:\t\t\t\t */\n4859:\t\t\t\tfrag_len = list_skb-\u003elen;\n4860:\t\t\t\tskb_walk_frags(head_skb, iter) {\n4861:\t\t\t\t\tif (frag_len != iter-\u003elen \u0026\u0026 iter-\u003enext)\n4862:\t\t\t\t\t\tgoto normal;\n4863:\t\t\t\t\tif (skb_headlen(iter) \u0026\u0026 !iter-\u003ehead_frag)\n4864:\t\t\t\t\t\tgoto normal;\n4865:\t\n4866:\t\t\t\t\tlen -= iter-\u003elen;\n4867:\t\t\t\t}\n4868:\t\n4869:\t\t\t\tif (len != frag_len)\n4870:\t\t\t\t\tgoto normal;\n4871:\t\t\t}\n4872:\t\n4873:\t\t\t/* GSO partial only requires that we trim off any excess that\n4874:\t\t\t * doesn't fit into an MSS sized block, so take care of that\n4875:\t\t\t * now.\n4876:\t\t\t */\n4877:\t\t\tDEBUG_NET_WARN_ON_ONCE(len / mss \u003e GSO_MAX_SEGS);\n4878:\t\t\tif (max_segs)\n4879:\t\t\t\tpartial_segs = min(len / mss, max_segs);\n4880:\t\t\telse\n4881:\t\t\t\tpartial_segs = min(len / mss, GSO_MAX_SEGS);\n4882:\t\t\tif (partial_segs \u003e 1)\n4883:\t\t\t\tmss *= partial_segs;\n4884:\t\t\telse\n4885:\t\t\t\tpartial_segs = 0;\n4886:\t\t}\n4887:\t\n4888:\tnormal:\n4889:\t\theadroom = skb_headroom(head_skb);\n4890:\t\tpos = skb_headlen(head_skb);\n4891:\t\n4892:\t\tif (skb_orphan_frags(head_skb, GFP_ATOMIC))\n4893:\t\t\treturn ERR_PTR(-ENOMEM);\n4894:\t\n"
} |
| 15/2 | 2026/10/01 10:05 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22619 output: 37 thoughts: 217 Thoughts: Okay, let me break this down. **Analyzing the `skb_segment` Code for GSO and Segmentation** Alright, I'm diving into this `skb_segment` function. Specifically, I need to see how it handles the `max_segs` parameter and its impact on Generic Segmentation Offload (GSO). The core of what I'm looking at here is the interaction between segmentation and checksum offload. If `max_segs` is set, and we're dealing with scatter-gather lists (`sg`), checksum offload (`csum`), and are *not* doing GSO by fragments (`!gso_by_frags`), we hit this conditional block. I notice that if `max_segs` isn't set, and the device doesn't support partial GSO (`NETIF_F_GSO_PARTIAL`), there's a specific path taken, though it's not the focus right now. The interesting part is the use of `partial_segs`. The code uses `min(len / mss, max_segs)` to calculate `partial_segs`. This caps the number of segments to `max_segs`, but if `max_segs` isn't set (i.e., `max_segs == 0`), it defaults to `GSO_MAX_SEGS`. There's also a debug check that throws a warning if the calculated number of segments exceeds `GSO_MAX_SEGS`, which should be avoided. If `partial_segs` turns out to be greater than 1, we adjust `mss` (Maximum Segment Size) by multiplying it by `partial_segs`. This suggests a potential optimization or adjustment in segment sizing when multiple partial segments are used. If `partial_segs` is not greater than 1, it's set to 0. This seems like a key optimization point to consider. Now I need to see how these `partial_segs` are actually used later in the segmentation process itself. The conditional here is important, but the real impact of the logic is downstream. I need to continue tracing the code. |
| 16/2 | 2026/10/01 10:05 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 5000,
"LineCount": 50
}Results: {
"Contents": "5000:\t\t\t\t\t\t\t\t len);\n5001:\t\t\t\t\tSKB_GSO_CB(nskb)-\u003ecsum_start =\n5002:\t\t\t\t\t\tskb_headroom(nskb) + doffset;\n5003:\t\t\t\t} else {\n5004:\t\t\t\t\tif (skb_copy_bits(head_skb, offset, skb_put(nskb, len), len))\n5005:\t\t\t\t\t\tgoto err;\n5006:\t\t\t\t}\n5007:\t\t\t\tcontinue;\n5008:\t\t\t}\n5009:\t\n5010:\t\t\tnskb_frag = skb_shinfo(nskb)-\u003efrags;\n5011:\t\n5012:\t\t\tskb_copy_from_linear_data_offset(head_skb, offset,\n5013:\t\t\t\t\t\t\t skb_put(nskb, hsize), hsize);\n5014:\t\n5015:\t\t\tskb_shinfo(nskb)-\u003eflags |= (skb_shinfo(head_skb)-\u003eflags |\n5016:\t\t\t\t\t\t skb_shinfo(frag_skb)-\u003eflags) \u0026\n5017:\t\t\t\t\t\t SKBFL_SHARED_FRAG;\n5018:\t\n5019:\t\t\tif (skb_zerocopy_clone(nskb, frag_skb, GFP_ATOMIC))\n5020:\t\t\t\tgoto err;\n5021:\t\n5022:\t\t\twhile (pos \u003c offset + len) {\n5023:\t\t\t\tif (i \u003e= nfrags) {\n5024:\t\t\t\t\tif (skb_orphan_frags(list_skb, GFP_ATOMIC) ||\n5025:\t\t\t\t\t skb_zerocopy_clone(nskb, list_skb,\n5026:\t\t\t\t\t\t\t GFP_ATOMIC))\n5027:\t\t\t\t\t\tgoto err;\n5028:\t\n5029:\t\t\t\t\ti = 0;\n5030:\t\t\t\t\tnfrags = skb_shinfo(list_skb)-\u003enr_frags;\n5031:\t\t\t\t\tfrag = skb_shinfo(list_skb)-\u003efrags;\n5032:\t\t\t\t\tfrag_skb = list_skb;\n5033:\t\n5034:\t\t\t\t\tskb_shinfo(nskb)-\u003eflags |= skb_shinfo(frag_skb)-\u003eflags \u0026 SKBFL_SHARED_FRAG;\n5035:\t\n5036:\t\t\t\t\tif (!skb_headlen(list_skb)) {\n5037:\t\t\t\t\t\tBUG_ON(!nfrags);\n5038:\t\t\t\t\t} else {\n5039:\t\t\t\t\t\tBUG_ON(!list_skb-\u003ehead_frag);\n5040:\t\n5041:\t\t\t\t\t\t/* to make room for head_frag. */\n5042:\t\t\t\t\t\ti--;\n5043:\t\t\t\t\t\tfrag--;\n5044:\t\t\t\t\t}\n5045:\t\n5046:\t\t\t\t\tlist_skb = list_skb-\u003enext;\n5047:\t\t\t\t}\n5048:\t\n5049:\t\t\t\tif (unlikely(skb_shinfo(nskb)-\u003enr_frags \u003e=\n"
} |
| 17/2 | 2026/10/01 10:05 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24126 output: 32 thoughts: 20 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Analyzing `partial_segs` within `skb_segment`** Okay, so I'm looking at `skb_segment` and specifically trying to understand the role of `partial_segs`. My immediate goal is to trace the flow of data and understand how this variable is manipulated during the segmentation process. I need to figure out where it's initialized, where its value is potentially modified, and how that value impacts the overall outcome of `skb_segment`. My expectation is that `partial_segs` probably relates to handling cases where the requested MSS (Maximum Segment Size) or other segmentation parameters necessitate partial segments, that is, segments that don't fill a full SKB (Socket Buffer). I need to determine if it's counting them, storing the pointers to them, or possibly tracking their sizes. Understanding its exact function is crucial to grasping the nuances of the segmentation logic, especially in scenarios involving fragmented data or constraints on segment sizes. I'll be looking for assignments, conditional branches that depend on its value, and calls to functions that might take `partial_segs` as an argument or modify its pointed-to data. I'm also anticipating that I might need to consider how `partial_segs` interacts with other segmentation related variables, like `skb_shinfo(skb)->gso_segs` or possibly even network header information. The interaction with checksum calculations would also be important. |
| 18/2 | 2026/10/01 10:05 | tool | grepper |
0mArgs:{
"Expression": "partial_segs",
"PathPrefix": "net/core/skbuff.c"
}Results: {
"Output": "net/core/skbuff.c=4790=struct sk_buff *skb_segment(struct sk_buff *head_skb,\n--\nnet/core/skbuff.c-4801-\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\nnet/core/skbuff.c:4802:\tunsigned int partial_segs = 0;\nnet/core/skbuff.c-4803-\tunsigned int headroom;\n--\nnet/core/skbuff.c-4878-\t\tif (max_segs)\nnet/core/skbuff.c:4879:\t\t\tpartial_segs = min(len / mss, max_segs);\nnet/core/skbuff.c-4880-\t\telse\nnet/core/skbuff.c:4881:\t\t\tpartial_segs = min(len / mss, GSO_MAX_SEGS);\nnet/core/skbuff.c:4882:\t\tif (partial_segs \u003e 1)\nnet/core/skbuff.c:4883:\t\t\tmss *= partial_segs;\nnet/core/skbuff.c-4884-\t\telse\nnet/core/skbuff.c:4885:\t\t\tpartial_segs = 0;\nnet/core/skbuff.c-4886-\t}\n--\nnet/core/skbuff.c-5107-\nnet/core/skbuff.c:5108:\tif (partial_segs) {\nnet/core/skbuff.c-5109-\t\tstruct sk_buff *iter;\n--\nnet/core/skbuff.c-5121-\t\t\tskb_shinfo(iter)-\u003egso_size = gso_size;\nnet/core/skbuff.c:5122:\t\t\tskb_shinfo(iter)-\u003egso_segs = partial_segs;\nnet/core/skbuff.c-5123-\t\t\tskb_shinfo(iter)-\u003egso_type = type;\n"
} |
| 19/2 | 2026/10/01 10:05 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25014 output: 28 thoughts: 2642 Thoughts: **GSO Re-segmentation Feature Analysis for Fuzzing** Alright, let's break this down. This patch introduces a crucial re-segmentation capability for Generic Segmentation Offload (GSO) within the kernel. The core idea is that when a TCP GSO packet exceeds a device's limits (specified by `gso_max_segs` or `gso_max_size`), instead of fragmenting it down to the Maximum Segment Size (MSS) immediately, it's now re-segmented into larger GSO chunks. This re-segmentation maintains the GSO characteristics while conforming to the device constraints, achieving this by setting the `partial_segs` variable and generating new GSO skbs with the correct `gso_segs` and `gso_size`. A key observation here is the modification in `net/core/dev.c`, where `vlan_get_protocol(skb)` is now employed within `netif_get_gso_max_size` instead of the more direct `skb->protocol`. This has been tested. This change is used in `skb_gso_output_max_segs` that parses TCP headers, handles transport headers, checks checksums, and recalibrates features via `__netif_skb_features`. This touches core networking's packet segmentation and transmission path. So, is this code reachable? Absolutely! Standard network devices such as veth, dummy, macvlan, loopback, tap, virtio_net all transmit packets through `validate_xmit_skb`, leveraging GSO segmentation. Additionally, tap and openvswitch also call `__skb_gso_segment`. Now, is this code worth fuzzing? Yes, without a doubt! These changes involve critical modifications to core networking components related to packet size calculations, header offsets, GSO segment counts, packet splitting, and device limit enforcement. We're dealing with packet size and device limits, and fuzzing could reveal off-by-one errors, overflows, or unexpected packet structures (malformed TCP headers, strange encapsulation, or vlan tags), any of which could trigger kernel panics, memory corruption, `BUG_ON` / `WARN_ON` assertions, or even crashes. Let's assess the `WorthFuzzing` criteria: It clearly touches core subsystems (`net/core/dev.c`, `net/core/skbuff.c`, `net/core/gso.c`) so we're good there. `WorthFuzzing = true`. Now, let's identify the `FocusSymbols`. We need to be careful here, avoiding ubiquitous lifecycle functions that might cloud our fuzzing results. The goal is to target specific feature logic and entrypoints. Here are the key symbols, as I see it, from the patch: 1. `skb_gso_output_max_segs`: This is static within `net/core/dev.c`, but it's crucial for re-segmentation. 2. `gso_within_dev_limits`: Also static, but important for checking limits. 3. `__netif_skb_features`: EXPORTED from `net/core/dev.c`, so it's a guaranteed symbol and crucial for recalculating features and checking if GSO is needed. 4. `skb_segment`: Exported function from `net/core/skbuff.c`. This is where the actual re-segmentation logic happens. It's not ubiquitous. 5. `__skb_gso_segment`: Non-static function in `net/core/gso.c`, core GSO entrypoint that now handles the `max_segs` parameter. Not ubiquitous. 6. `netif_get_gso_max_size`: static in `net/core/dev.c`. Let's address potential inlining. `skb_gso_output_max_segs` is a bit long, but compilers might inline it. `skb_segment` and `__skb_gso_segment` are definitely not inlined. The focus should be on functions that handle the new feature directly: `skb_gso_output_max_segs`, `gso_within_dev_limits`, `__skb_gso_segment`, `skb_segment`, and `__netif_skb_features`. Now, regarding Kconfig options, we need to check the relevant Makefiles (`net/core/Makefile`) to ensure the code is compiled for the fuzzer. |
| 20/2 | 2026/10/01 10:06 | tool | grepper |
0mArgs:{
"Expression": "gso.o",
"PathPrefix": "net/core/"
}Results: {
"Output": "net/core/Makefile=12=obj-y\t\t += dev.o dev_api.o dev_addr_lists.o dst.o netevent.o \\\n--\nnet/core/Makefile-15-\t\t\tfib_notifier.o xdp.o flow_offload.o gro.o \\\nnet/core/Makefile:16:\t\t\tnetdev-genl.o netdev-genl-gen.o netdev_work.o gso.o\nnet/core/Makefile-17-\n--\nnet/core/dev.c=3980=static unsigned int\nnet/core/dev.c:3981:skb_gso_output_max_segs(struct sk_buff *skb, struct net_device *dev)\nnet/core/dev.c-3982-{\n--\nnet/core/dev.c-4009-\tfeatures = __netif_skb_features(skb, false) | NETIF_F_GSO_ROBUST;\nnet/core/dev.c:4010:\tif (!net_gso_ok(features, skb_shinfo(skb)-\u003egso_type))\nnet/core/dev.c-4011-\t\treturn 0;\n--\nnet/core/dev.c=4173=static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again)\n--\nnet/core/dev.c-4194-\t\tif (unlikely(!gso_within_dev_limits(skb, dev)))\nnet/core/dev.c:4195:\t\t\tmax_segs = skb_gso_output_max_segs(skb, dev);\nnet/core/dev.c-4196-\n--\nnet/core/gso.c=90=struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\n--\nnet/core/gso.c-113-\t\tpartial_features |= dev-\u003efeatures \u0026 dev-\u003egso_partial_features;\nnet/core/gso.c:114:\t\tif (!skb_gso_ok(skb, features | partial_features))\nnet/core/gso.c-115-\t\t\tfeatures \u0026= ~NETIF_F_GSO_PARTIAL;\n--\nnet/core/skbuff.c=4790=struct sk_buff *skb_segment(struct sk_buff *head_skb,\n--\nnet/core/skbuff.c-4847-\t\t\tif (!list_skb ||\nnet/core/skbuff.c:4848:\t\t\t !net_gso_ok(features, skb_shinfo(head_skb)-\u003egso_type))\nnet/core/skbuff.c-4849-\t\t\t\tgoto normal;\n"
} |
| 21/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 29379 output: 31 thoughts: 144 Thoughts: **Investigating TCP and GSO Dependency in the Kernel** Okay, so I'm looking at `net/core/Makefile` and I see that `dev.o`, `gso.o`, and `skbuff.o` are built whenever `CONFIG_NET` is enabled. That's a good starting point, but I need to understand the dependencies a bit better, particularly concerning TCP's involvement. It's a hunch, but I'm immediately wondering about `CONFIG_INET`. I know that the networking stack generally depends on `INET`. Let's drill down. I'm recalling that `skb_gso_output_max_segs` is connected to GSO, and it does that check `skb_is_gso_tcp(skb)`. Now, I remember that `skb_is_gso_tcp(skb)` parses the TCP headers using `struct tcphdr` and related structures. The parsing of TCP headers absolutely screams `CONFIG_INET` dependency, because TCP is part of the Internet Protocol suite, right? So, I need to confirm: Is `CONFIG_INET` really required for `skb_is_gso_tcp` itself, or for TCP transmission more generally, to utilize these functions? Let's quickly verify that. Time to use grep and see where `skb_is_gso_tcp` is used. |
| 22/2 | 2026/10/01 10:06 | tool | grepper |
0mArgs:{
"Expression": "skb_is_gso_tcp",
"PathPrefix": "include/"
}Results: {
"Output": "include/linux/ip.h=39=static inline unsigned int iph_totlen(const struct sk_buff *skb, const struct iphdr *iph)\n--\ninclude/linux/ip.h-42-\ninclude/linux/ip.h:43:\treturn (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?\ninclude/linux/ip.h-44-\t len : skb-\u003elen - skb_network_offset(skb);\n--\ninclude/linux/ipv6.h=130=ipv6_payload_len(const struct sk_buff *skb, const struct ipv6hdr *ip6)\n--\ninclude/linux/ipv6.h-133-\ninclude/linux/ipv6.h:134:\treturn (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?\ninclude/linux/ipv6.h-135-\t\tlen :\n--\ninclude/linux/skbuff.h=5297=static inline bool skb_is_gso_sctp(const struct sk_buff *skb)\n--\ninclude/linux/skbuff.h-5302-/* Note: Should be called only if skb_is_gso(skb) is true */\ninclude/linux/skbuff.h:5303:static inline bool skb_is_gso_tcp(const struct sk_buff *skb)\ninclude/linux/skbuff.h-5304-{\n"
} |
| 23/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30245 output: 32 thoughts: 121 Thoughts: **Analyzing the GSO TCP Check** Okay, let's break this down. My immediate task is to understand what `skb_is_gso_tcp` actually tests for. The code in `include/linux/skbuff.h` reveals the core of the check: it's looking at `skb_shinfo(skb)->gso_type` and masking it against `(SKB_GSO_TCPV4 | SKB_GSO_TCPV6)`. So, at its heart, this is about identifying if the skb (socket buffer) is a TCP GSO (Generic Segmentation Offload) packet, either IPv4 or IPv6. The implications are clear: the `CONFIG_INET` configuration option is central here since it's fundamentally tied to IP networking, and that includes TCP packets. Of course, `CONFIG_NET` itself is also a prerequisite – it's the foundation for any networking functionality. Now, I need to consider potential dependencies. Are there any other configuration options that come into play? I need to consult the `net/Kconfig` file. Let's see what's defined for `CONFIG_NET` in that context. |
| 24/2 | 2026/10/01 10:06 | tool | grepper |
0mError:no matches Args: {
"Expression": "config INET\\b",
"PathPrefix": "net/ipv4/Kconfig"
}Results: {
"error": "no matches"
} |
| 25/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30667 output: 26 thoughts: 12 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing Network Configuration** Right, let's dive into this. The objective is clear: I need to locate the configuration related to the `INET` protocol within the `net/` directory. That "INET" bit likely refers to the Internet Protocol family. I'm assuming this is a *nix environment or something very similar, given the `net/` directory structure. My initial thought process is to use some variant of `find` or `grep`, but since I don't know the exact file structure, the more specific and informative the query, the better. I'll need to figure out the precise command or search term that will give me the relevant output without too much noise. Time to get to work. I have a feeling this will involve sifting through a few config files. |
| 26/2 | 2026/10/01 10:06 | tool | grepper |
0mArgs:{
"Expression": "config INET$",
"PathPrefix": "net/"
}Results: {
"Output": "net/Kconfig=98=config NET_HANDSHAKE_KUNIT_TEST\n--\nnet/Kconfig-112-\nnet/Kconfig:113:config INET\nnet/Kconfig-114-\tbool \"TCP/IP networking\"\n"
} |
| 27/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30964 output: 32 thoughts: 20 Thoughts: Here's a summary of my thought process, as requested: **Navigating the Kconfig Labyrinth** Okay, time to dive into the core configuration. I need to zero in on a specific area, so the first step is to pinpoint the exact location. "net/Kconfig" is the target, that's the starting point. Now, instead of a broad overview, I need to focus. Lines 112-120... that's a defined chunk. Hopefully, this section holds the specific configuration options or dependencies I'm interested in. I'll need to meticulously read through those lines and then analyse them. Hopefully the code is well-structured and documented so I can quickly identify the key parameters and their relationships. Let's get to it! |
| 28/2 | 2026/10/01 10:06 | tool | read-file |
0mArgs:{
"File": "net/Kconfig",
"FirstLine": 112,
"LineCount": 15
}Results: {
"Contents": " 112:\t\n 113:\tconfig INET\n 114:\t\tbool \"TCP/IP networking\"\n 115:\t\thelp\n 116:\t\t These are the protocols used on the Internet and on most local\n 117:\t\t Ethernets. It is highly recommended to say Y here (this will enlarge\n 118:\t\t your kernel by about 400 KB), since some programs (e.g. the X window\n 119:\t\t system) use TCP/IP even if your machine is not connected to any\n 120:\t\t other computer. You will get the so-called loopback device which\n 121:\t\t allows you to ping yourself (great fun, that!).\n 122:\t\n 123:\t\t For an excellent introduction to Linux networking, please read the\n 124:\t\t Linux Networking HOWTO, available from\n 125:\t\t \u003chttp://www.tldp.org/docs.html#howto\u003e.\n 126:\t\n"
} |
| 29/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31441 output: 29 thoughts: 77 Thoughts: Okay, here's my breakdown of what I'm thinking, tailored for someone who's already deep in the weeds with kernel configuration: **Kernel Config Dependency Deep Dive** Alright, so I'm looking at a dependency relationship. `CONFIG_INET` *clearly* depends on `CONFIG_NET`. That's the baseline, the expected setup. Now, I'm thinking, are there any *other* configuration options that come into play here, some less obvious connections that I need to be aware of? I've got `CONFIG_NET` and `CONFIG_INET` firmly in my mind, but I need to make sure I haven't missed anything. Then, the thought hits me, almost reflexively: what about testing? Specifically, what's guarding the test code? I immediately jump to the question of `CONFIG_NET_TEST` or, more broadly, how KUnit tests might fit into this picture. I know there is a file that might provide more information so, I'll go check out `net/core/net_test.c`. The next step is clear: I need to check what specific configuration options are used to guard the inclusion of the test code within that file. This is crucial for understanding how the entire testing structure behaves. |
| 30/2 | 2026/10/01 10:06 | tool | grepper |
0mArgs:{
"Expression": "net_test.o",
"PathPrefix": "net/core/"
}Results: {
"Output": "net/core/Makefile=50=obj-$(CONFIG_OF)\t+= of_net.o\nnet/core/Makefile:51:obj-$(CONFIG_NET_TEST) += net_test.o\nnet/core/Makefile-52-obj-$(CONFIG_NET_DEVMEM) += devmem.o\n"
} |
| 31/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31902 output: 28 thoughts: 904 Thoughts: **Focusing the Fuzzer on GSO Paths** Okay, so I'm thinking about how to effectively fuzz the modified GSO paths in the kernel with syzkaller. First, it's crucial to remember that KUnit tests are irrelevant here; syzkaller operates at a higher level, through syscalls, socket APIs, and netdevices. My immediate question is about the necessary kernel configurations. I know `CONFIG_NET` and `CONFIG_INET` are essential for network functionality, but I need to make sure I haven't missed anything. Ah yes, `CONFIG_IPV6`! Since GSO handles `ETH_P_IPV6` and `gso_max_size` (v6), it’s clearly relevant, too. Let me double-check - I want to verify if `CONFIG_INET` covers everything, or if `CONFIG_IPV6` adds value. Right, those three are the standard networking configs. Now, let's nail down the `FocusSymbols`. I want to identify specific kernel functions that *directly* relate to the modified GSO paths. I need to avoid including ubiquitous functions that would dilute the fuzzing effort. Let's see... I've got a list of candidates: `skb_gso_output_max_segs`, `skb_segment`, `__skb_gso_segment`, `gso_within_dev_limits`, and `__netif_skb_features`. Wait a minute... Is `__netif_skb_features` called on *every* single packet? Let me double-check the source code. Yes, in `net/core/dev.c`, `validate_xmit_skb` calls `netif_skb_features(skb)`, which is inlined to `__netif_skb_features`. And `validate_xmit_skb` is called by `__dev_queue_xmit` on every outgoing packet. This means *any* network traffic – UDP, ICMP, TCP, raw sockets, ping – will trigger `__netif_skb_features`! That's a huge problem. If I include it, almost every test case will be considered "focused," which completely defeats the purpose of the FocusSymbols. I need to remember what Section 4 said: FocusSymbols must be very specific. They should implement logic being added or altered, or be direct API entrypoints. So `__netif_skb_features` is a no-go; it's on the hot path for every packet. Alright, let's re-evaluate the other candidates. `skb_gso_output_max_segs` is called *only* when `netif_needs_gso(skb, features)` is true AND `!gso_within_dev_limits(skb, dev)` is true. That's *exactly* the condition where TCP GSO re-segmentation kicks in! What about `gso_within_dev_limits`? It's called in `gso_features_check` (when `skb_is_gso(skb)` is true) and in `validate_xmit_skb` (when `netif_needs_gso(skb, features)` is true). It's clearly tied to GSO skbs. `__skb_gso_segment` is called *only* when GSO segmentation is actually needed – when the software needs to segment the GSO skb. And finally, `skb_segment` is called by the protocol-specific gso segmenters (like `inet_gso_segment`, `tcp4_gso_segment`, etc.) to perform the *actual* packet payload segmentation, including the modified logic. Just to be absolutely sure, let's grep to double-check that `skb_segment` isn't called anywhere outside GSO segmentation. |
| 32/2 | 2026/10/01 10:06 | tool | grepper |
0mArgs:{
"Expression": "\\bskb_segment\\(",
"PathPrefix": "net/"
}Results: {
"Output": "net/core/net_test.c=204=static void gso_test_func(struct kunit *test)\n--\nnet/core/net_test.c-286-\tSKB_GSO_CB(skb)-\u003emax_segs = tcase-\u003emax_segs;\nnet/core/net_test.c:287:\tsegs = skb_segment(skb, features);\nnet/core/net_test.c-288-\tif (IS_ERR(segs)) {\n--\nnet/core/skbuff.c=4779=EXPORT_SYMBOL_GPL(skb_segment_list);\n--\nnet/core/skbuff.c-4789- */\nnet/core/skbuff.c:4790:struct sk_buff *skb_segment(struct sk_buff *head_skb,\nnet/core/skbuff.c-4791-\t\t\t netdev_features_t features)\n--\nnet/ipv4/tcp_offload.c=133=struct sk_buff *tcp_gso_segment(struct sk_buff *skb,\n--\nnet/ipv4/tcp_offload.c-180-\nnet/ipv4/tcp_offload.c:181:\tsegs = skb_segment(skb, features);\nnet/ipv4/tcp_offload.c-182-\tif (IS_ERR(segs))\n--\nnet/ipv4/udp_offload.c=481=struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,\n--\nnet/ipv4/udp_offload.c-550-\nnet/ipv4/udp_offload.c:551:\tsegs = skb_segment(gso_skb, features);\nnet/ipv4/udp_offload.c-552-\tif (IS_ERR_OR_NULL(segs)) {\n--\nnet/ipv4/udp_offload.c=633=static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,\n--\nnet/ipv4/udp_offload.c-687-\t */\nnet/ipv4/udp_offload.c:688:\tsegs = skb_segment(skb, features);\nnet/ipv4/udp_offload.c-689-out:\n--\nnet/ipv6/udp_offload.c=19=static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,\n--\nnet/ipv6/udp_offload.c-108-\t\t */\nnet/ipv6/udp_offload.c:109:\t\tsegs = skb_segment(skb, features);\nnet/ipv6/udp_offload.c-110-\t}\n--\nnet/sctp/offload.c=39=static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,\n--\nnet/sctp/offload.c-71-\nnet/sctp/offload.c:72:\tsegs = skb_segment(skb, (features | NETIF_F_HW_CSUM) \u0026 ~NETIF_F_SG);\nnet/sctp/offload.c-73-\tif (IS_ERR(segs))\n"
} |
| 33/2 | 2026/10/01 10:06 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34522 output: 199 thoughts: 1046 Thoughts: **GSO Segmentation Triage: Confirmed Fuzzing Value**
Okay, let's break this down. My initial observation is that `skb_segment` is deeply tied to GSO segmentation, specifically invoked through functions like `tcp_gso_segment`, `__udp_gso_segment`, and others. `tcp_gso_segment` is the direct caller for TCP GSO skbs, and `__skb_gso_segment` appears to be the core dispatch function here. Plus, I see `skb_gso_output_max_segs` and `gso_within_dev_limits` reside in `net/core/dev.c`. This strongly suggests we're dealing with critical GSO logic.
Now, let's zero in on the relevant symbols from the patch. I've got:
* `skb_gso_output_max_segs`
* `gso_within_dev_limits`
* `__skb_gso_segment`
* `skb_segment`
I considered whether `skb_gso_output_max_segs` and `gso_within_dev_limits` are static and potentially inlined, but even if `skb_gso_output_max_segs` *were* inlined, it's a non-trivial function with complex logic, and both `__skb_gso_segment` and `skb_segment` are definitely non-static and exported. That's good coverage.
Wait, the code also involves `gso_features_check`. Let's incorporate it. In `net/core/dev.c`, I see a modification to `gso_features_check`:
```c
static netdev_features_t gso_features_check(const struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features,
bool check_limits)
{
if (check_limits && !gso_within_dev_limits(skb, dev))
return features & ~NETIF_F_GSO_MASK;
...
```
That's relevant. So `gso_features_check` can be safely considered alongside the others because it's called on all GSO skbs.
Therefore, the focused symbols are:
* `skb_gso_output_max_segs`
* `gso_within_dev_limits`
* `skb_segment`
* `__skb_gso_segment`
* `gso_features_check`
For configuration, I'm confident we need:
* `NET` (Networking support)
* `INET` (TCP/IP networking)
* `IPV6` (IPv6, since IPv6 GSO max size / L3 limit logic is involved)
Let's do a quick triage philosophy double-check:
1. **Core Triage Philosophy:**
* **Reachability:** Directly accessible via standard networking (TCP/IP, raw sockets, etc.) and virtual devices (tap, dummy, veth, loopback).
* **Fuzzing value:** Very High. GSO is both performance and security critical. We're talking about calculating lengths and segment sizes across headers and fragments. Off-by-one errors or incorrect segmentation can lead to buffer overflows, truncation, or assertion failures (like the `DEBUG_NET_WARN_ON_ONCE` in `skb_segment`).
2. **WorthFuzzing: True.**
3. **FocusSymbols:** (as above)
* `skb_gso_output_max_segs`
* `gso_within_dev_limits`
* `skb_segment`
* `__skb_gso_segment`
* `gso_features_check`
4. **EnableConfigs:** (as above)
* `NET`
* `INET`
* `IPV6`
Finally, let's review the reasoning: "The patch introduces TCP GSO re-segmentation support in the network core when a packet exceeds the device's GSO size or segment limits. It adds skb_gso_output_max_segs() and gso_within_dev_limits() to calculate allowed segment bounds, modifies __skb_gso_segment() to pass the segment limit, and updates skb_segment() to perform partial GSO segmentation. These changes directly affect reachable network transmission paths and packet off
|
| 34/2 | 2026/10/01 10:06 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"NET",
"INET",
"IPV6"
],
"FocusSymbols": [
"skb_gso_output_max_segs",
"gso_within_dev_limits",
"__skb_gso_segment",
"skb_segment"
],
"Reasoning": "The patch adds TCP GSO re-segmentation when packets exceed device limits instead of breaking down to individual MSS segments. It adds skb_gso_output_max_segs() and gso_within_dev_limits(), passes max_segs through __skb_gso_segment(), and modifies skb_segment() to handle partial segmentation. These changes alter core network packet transmission logic reachable through virtual and physical network devices, warranting fuzzing for segmentation edge cases, off-by-one length calculations, and assertion failures.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"NET",
"INET",
"IPV6"
],
"FocusSymbols": [
"skb_gso_output_max_segs",
"gso_within_dev_limits",
"__skb_gso_segment",
"skb_segment"
],
"Reasoning": "The patch adds TCP GSO re-segmentation when packets exceed device limits instead of breaking down to individual MSS segments. It adds skb_gso_output_max_segs() and gso_within_dev_limits(), passes max_segs through __skb_gso_segment(), and modifies skb_segment() to handle partial segmentation. These changes alter core network packet transmission logic reachable through virtual and physical network devices, warranting fuzzing for segmentation edge cases, off-by-one length calculations, and assertion failures.",
"WorthFuzzing": true
} |
| 35/1 | 2026/10/01 10:06 | action | If |
3mArgs:{
"WorthFuzzing": true
}Results: null |
| 36/2 | 2026/10/01 10:06 | agent | kmsan-evaluator |
3mModel:core Args: null Results: {
"KMSANReasoning": "The patch modifies the GSO (Generic Segmentation Offload) engine and packet transmission path to allow re-segmenting TCP packets to match device limits without dropping down to individual MTU segments. Specifically:\n1. It adds a new field `max_segs` to `struct skb_gso_cb` (which resides inside `skb-\u003ecb`). This field is explicitly initialized in `__skb_gso_segment()` prior to dispatching to protocol-specific segmentation handlers and `skb_segment()`.\n2. Stack and local variables introduced by the patch (such as `_tcph` in `skb_gso_output_max_segs()`) are properly handled; `skb_header_pointer()` ensures data is copied into the buffer before `th` is accessed.\n3. No data structures or padding exposed to user space are added or modified (no copy_to_user, netlink skb attributes, ioctls, or socket options).\n4. Potential issues introduced by this patch relate to packet length calculations, header sizing, segmentation bounds, or out-of-bounds reads/writes on skb frags, all of which fall under KASAN's domain rather than KMSAN's.\n\nTherefore, the patch introduces no uninitialized memory usage or kernel-to-user info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
"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 7232dc3b3d8cd97aa2a8aa76f3df6e8c13741361
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Oct 1 10:04:03 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index ff67d99deb39e..bc111495ebbce 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -278,9 +278,10 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
if (q->flags & IFF_VNET_HDR)
features |= tap->tap_features;
if (netif_needs_gso(skb, features)) {
- struct sk_buff *segs = __skb_gso_segment(skb, features, false);
+ struct sk_buff *segs;
struct sk_buff *next;
+ segs = __skb_gso_segment(skb, features, false, 0);
if (IS_ERR(segs)) {
drop_reason = SKB_DROP_REASON_SKB_GSO_SEG;
goto drop;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d037faff7c44b..5b7b0c87e4f63 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -5495,7 +5495,14 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
netdev_features_t passthru_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features);
-netdev_features_t netif_skb_features(struct sk_buff *skb);
+netdev_features_t __netif_skb_features(struct sk_buff *skb,
+ bool check_gso_limits);
+
+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)
+{
+ return __netif_skb_features(skb, true);
+}
+
void skb_warn_bad_offload(const struct sk_buff *skb);
static inline bool net_gso_ok(netdev_features_t features, int gso_type)
@@ -5561,15 +5568,6 @@ netif_get_gro_max_size(const struct net_device *dev, const struct sk_buff *skb)
READ_ONCE(dev->gro_ipv4_max_size);
}
-static inline unsigned int
-netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
-{
- /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
- return skb->protocol == htons(ETH_P_IPV6) ?
- READ_ONCE(dev->gso_max_size) :
- READ_ONCE(dev->gso_ipv4_max_size);
-}
-
static inline bool netif_is_macsec(const struct net_device *dev)
{
return dev->priv_flags & IFF_MACSEC;
diff --git a/include/net/gso.h b/include/net/gso.h
index 29975440cad51..fccb37889965f 100644
--- a/include/net/gso.h
+++ b/include/net/gso.h
@@ -19,6 +19,7 @@ struct skb_gso_cb {
int encap_level;
__wsum csum;
__u16 csum_start;
+ __u16 max_segs; /* Max MSS segs per output skb, 0 = no limit */
};
#define SKB_GSO_CB_OFFSET 32
#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET))
@@ -75,12 +76,13 @@ static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
}
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
- netdev_features_t features, bool tx_path);
+ netdev_features_t features, bool tx_path,
+ unsigned int max_segs);
static inline struct sk_buff *skb_gso_segment(struct sk_buff *skb,
netdev_features_t features)
{
- return __skb_gso_segment(skb, features, true);
+ return __skb_gso_segment(skb, features, true, 0);
}
struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb,
diff --git a/include/net/udp.h b/include/net/udp.h
index 1fee17274745f..5bc25dcf25fba 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -613,7 +613,7 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
/* the GSO CB lays after the UDP one, no need to save and restore any
* CB fragment
*/
- segs = __skb_gso_segment(skb, features, false);
+ segs = __skb_gso_segment(skb, features, false, 0);
if (IS_ERR_OR_NULL(segs)) {
drop_count = skb_shinfo(skb)->gso_segs;
goto drop;
diff --git a/net/core/dev.c b/net/core/dev.c
index a8eb382f40caf..ff9bce2506f67 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3869,16 +3869,33 @@ static bool skb_gso_has_extension_hdr(const struct sk_buff *skb)
skb_inner_network_header_len(skb) != sizeof(struct ipv6hdr)));
}
-static netdev_features_t gso_features_check(const struct sk_buff *skb,
- struct net_device *dev,
- netdev_features_t features)
+static unsigned int
+netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
{
- u16 gso_segs = skb_shinfo(skb)->gso_segs;
+ /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
+ return vlan_get_protocol(skb) == htons(ETH_P_IPV6) ?
+ READ_ONCE(dev->gso_max_size) :
+ READ_ONCE(dev->gso_ipv4_max_size);
+}
- if (gso_segs > READ_ONCE(dev->gso_max_segs))
- return features & ~NETIF_F_GSO_MASK;
+static bool
+gso_within_dev_limits(const struct sk_buff *skb, const struct net_device *dev)
+{
+ if (skb_shinfo(skb)->gso_segs > READ_ONCE(dev->gso_max_segs))
+ return false;
if (unlikely(skb->len >= netif_get_gso_max_size(dev, skb)))
+ return false;
+
+ return true;
+}
+
+static netdev_features_t gso_features_check(const struct sk_buff *skb,
+ struct net_device *dev,
+ netdev_features_t features,
+ bool check_limits)
+{
+ if (check_limits && !gso_within_dev_limits(skb, dev))
return features & ~NETIF_F_GSO_MASK;
if (!skb_shinfo(skb)->gso_type) {
@@ -3927,13 +3944,15 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
return features;
}
-netdev_features_t netif_skb_features(struct sk_buff *skb)
+netdev_features_t
+__netif_skb_features(struct sk_buff *skb, bool check_gso_limits)
{
struct net_device *dev = skb->dev;
netdev_features_t features = dev->features;
if (skb_is_gso(skb))
- features = gso_features_check(skb, dev, features);
+ features = gso_features_check(skb, dev, features,
+ check_gso_limits);
/* If encapsulation offload request, verify we are testing
* hardware encapsulation features instead of standard
@@ -3956,7 +3975,54 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
return harmonize_features(skb, features);
}
-EXPORT_SYMBOL(netif_skb_features);
+EXPORT_SYMBOL(__netif_skb_features);
+
+static unsigned int
+skb_gso_output_max_segs(struct sk_buff *skb, struct net_device *dev)
+{
+ unsigned int mss = skb_shinfo(skb)->gso_size;
+ unsigned int gso_max_size, hdr_len, max_segs;
+ netdev_features_t features;
+ struct tcphdr _tcph, *th;
+
+ if (!skb_is_gso(skb) || !skb_is_gso_tcp(skb) ||
+ skb->encapsulation || skb_has_frag_list(skb))
+ return 0;
+
+ /*
+ * The transport offset can be unset or stale, so hdr_len is only taken
+ * from a header at the checksum start.
+ */
+ if (!skb_transport_header_was_set(skb) ||
+ skb_checksum_start(skb) != skb_transport_header(skb))
+ return 0;
+
+ th = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph),
+ &_tcph);
+ if (!th || __tcp_hdrlen(th) < sizeof(*th))
+ return 0;
+
+ hdr_len = skb_transport_header(skb) - skb_mac_header(skb) +
+ __tcp_hdrlen(th);
+
+ /* The output is still a GSO skb: recheck without the limit checks */
+ features = __netif_skb_features(skb, false) | NETIF_F_GSO_ROBUST;
+ if (!net_gso_ok(features, skb_shinfo(skb)->gso_type))
+ return 0;
+
+ gso_max_size = netif_get_gso_max_size(dev, skb);
+ gso_max_size = min(gso_max_size, GSO_LEGACY_MAX_SIZE);
+
+ /*
+ * gso_within_dev_limits() accepts gso_segs == gso_max_segs but
+ * rejects skb->len >= gso_max_size, so only the size limit needs the
+ * - 1; the inner min() keeps that subtraction from wrapping.
+ */
+ max_segs = (gso_max_size - min(gso_max_size, hdr_len + 1)) / mss;
+ max_segs = min(max_segs, READ_ONCE(dev->gso_max_segs));
+
+ return max_segs;
+}
static int xmit_one(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq, bool more)
@@ -4122,9 +4188,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
goto out_null;
if (netif_needs_gso(skb, features)) {
+ unsigned int max_segs = 0;
struct sk_buff *segs;
- segs = skb_gso_segment(skb, features);
+ if (unlikely(!gso_within_dev_limits(skb, dev)))
+ max_segs = skb_gso_output_max_segs(skb, dev);
+
+ segs = __skb_gso_segment(skb, features, true, max_segs);
if (IS_ERR(segs)) {
goto out_kfree_skb;
} else if (segs) {
diff --git a/net/core/gso.c b/net/core/gso.c
index bcd156372f4df..21a259ca392f4 100644
--- a/net/core/gso.c
+++ b/net/core/gso.c
@@ -77,6 +77,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)
* @skb: buffer to segment
* @features: features for the output path (see dev->features)
* @tx_path: whether it is called in TX path
+ * @max_segs: maximum MSS segments per output GSO skb, 0 means no limit;
+ * set only for an unencapsulated TCP skb without a frag_list
*
* This function segments the given skb and returns a list of segments.
*
@@ -86,7 +88,8 @@ static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)
* Segmentation preserves SKB_GSO_CB_OFFSET bytes of previous skb cb.
*/
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
- netdev_features_t features, bool tx_path)
+ netdev_features_t features, bool tx_path,
+ unsigned int max_segs)
{
struct sk_buff *segs;
@@ -117,6 +120,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);
SKB_GSO_CB(skb)->encap_level = 0;
+ SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);
skb_reset_mac_header(skb);
skb_reset_mac_len(skb);
diff --git a/net/core/net_test.c b/net/core/net_test.c
index 9c3a590865d26..6a91db83e5301 100644
--- a/net/core/net_test.c
+++ b/net/core/net_test.c
@@ -4,7 +4,14 @@
/* GSO */
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/netdevice.h>
#include <linux/skbuff.h>
+#include <linux/tcp.h>
+#include <net/gso.h>
static const char hdr[] = "abcdefgh";
#define GSO_TEST_SIZE 1000
@@ -34,6 +41,9 @@ enum gso_test_nr {
GSO_TEST_FRAG_LIST_PURE,
GSO_TEST_FRAG_LIST_NON_UNIFORM,
GSO_TEST_GSO_BY_FRAGS,
+ GSO_TEST_RESEGMENT,
+ GSO_TEST_RESEGMENT_MULTI,
+ GSO_TEST_RESEGMENT_ONE_MSS,
};
struct gso_test_case {
@@ -46,10 +56,12 @@ struct gso_test_case {
const unsigned int *frags;
unsigned int nr_frag_skbs;
const unsigned int *frag_skbs;
+ unsigned int max_segs;
/* output as expected */
unsigned int nr_segs;
const unsigned int *segs;
+ bool segs_are_gso;
};
static struct gso_test_case cases[] = {
@@ -135,6 +147,51 @@ static struct gso_test_case cases[] = {
.nr_segs = 4,
.segs = (const unsigned int[]) { 100, 200, 300, 400 },
},
+ {
+ .id = GSO_TEST_RESEGMENT,
+ .name = "resegment",
+ .linear_len = GSO_TEST_SIZE,
+ .nr_frags = 3,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 2,
+ .nr_segs = 2,
+ .segs = (const unsigned int[]) {
+ 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ },
+ .segs_are_gso = true,
+ },
+ {
+ .id = GSO_TEST_RESEGMENT_MULTI,
+ .name = "resegment_multi",
+ .linear_len = 2 * GSO_TEST_SIZE,
+ .nr_frags = 4,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 2,
+ .nr_segs = 3,
+ .segs = (const unsigned int[]) {
+ 2 * GSO_TEST_SIZE, 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ },
+ .segs_are_gso = true,
+ },
+ {
+ /* A max_segs of one leaves one MSS per skb, like no limit. */
+ .id = GSO_TEST_RESEGMENT_ONE_MSS,
+ .name = "resegment_one_mss",
+ .linear_len = GSO_TEST_SIZE,
+ .nr_frags = 3,
+ .frags = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ .max_segs = 1,
+ .nr_segs = 4,
+ .segs = (const unsigned int[]) {
+ GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3,
+ },
+ },
};
static void gso_test_case_to_desc(struct gso_test_case *t, char *desc)
@@ -226,6 +283,7 @@ static void gso_test_func(struct kunit *test)
if (tcase->id == GSO_TEST_FRAG_LIST_NON_UNIFORM)
features &= ~NETIF_F_SG;
+ SKB_GSO_CB(skb)->max_segs = tcase->max_segs;
segs = skb_segment(skb, features);
if (IS_ERR(segs)) {
KUNIT_FAIL(test, "segs error %pe", segs);
@@ -239,6 +297,7 @@ static void gso_test_func(struct kunit *test)
for (cur = segs, i = 0; cur; cur = next, i++) {
next = cur->next;
+ KUNIT_ASSERT_LT(test, i, tcase->nr_segs);
KUNIT_ASSERT_EQ(test, cur->len, sizeof(hdr) + tcase->segs[i]);
/* segs have skb->data pointing to the mac header */
@@ -247,6 +306,18 @@ static void gso_test_func(struct kunit *test)
/* header was copied to all segs */
KUNIT_ASSERT_EQ(test, memcmp(skb_mac_header(cur), hdr, sizeof(hdr)), 0);
+ if (tcase->segs_are_gso) {
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_size,
+ GSO_TEST_SIZE);
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_segs,
+ DIV_ROUND_UP(tcase->segs[i],
+ GSO_TEST_SIZE));
+ KUNIT_EXPECT_FALSE(test, skb_shinfo(cur)->gso_type &
+ SKB_GSO_PARTIAL);
+ } else if (tcase->max_segs) {
+ KUNIT_EXPECT_FALSE(test, skb_is_gso(cur));
+ }
/* last seg can be found through segs->prev pointer */
if (!next)
@@ -261,6 +332,283 @@ static void gso_test_func(struct kunit *test)
consume_skb(skb);
}
+#define GSO_TCP_HDR_LEN \
+ (ETH_HLEN + sizeof(struct iphdr) + sizeof(struct tcphdr))
+
+static struct sk_buff *gso_tcp_skb_new(unsigned int payload_len)
+{
+ struct sk_buff *skb;
+ struct ethhdr *eth;
+ struct tcphdr *th;
+ struct iphdr *iph;
+
+ skb = alloc_skb(NET_SKB_PAD + GSO_TCP_HDR_LEN + payload_len,
+ GFP_KERNEL);
+ if (!skb)
+ return NULL;
+ skb_reserve(skb, NET_SKB_PAD);
+ skb_put_zero(skb, GSO_TCP_HDR_LEN + payload_len);
+
+ skb_reset_mac_header(skb);
+ eth = eth_hdr(skb);
+ eth->h_proto = htons(ETH_P_IP);
+ skb->protocol = eth->h_proto;
+
+ skb_set_network_header(skb, ETH_HLEN);
+ iph = ip_hdr(skb);
+ iph->version = 4;
+ iph->ihl = sizeof(*iph) / 4;
+ iph->protocol = IPPROTO_TCP;
+ iph->tot_len = htons(sizeof(*iph) + sizeof(*th) + payload_len);
+
+ skb_set_transport_header(skb, ETH_HLEN + sizeof(*iph));
+ th = tcp_hdr(skb);
+ th->doff = sizeof(*th) / 4;
+
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct tcphdr, check);
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+ skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);
+
+ return skb;
+}
+
+/*
+ * The transmit path passes the features of the device which rejects this
+ * skb, with the GSO bits cleared, so the engine segments it.
+ */
+static void gso_test_tcp_resegment(struct kunit *test)
+{
+ netdev_features_t features = NETIF_F_SG | NETIF_F_HW_CSUM;
+ const unsigned int payload_len = 3 * GSO_TEST_SIZE + 3;
+ struct sk_buff *skb, *segs, *cur, *next;
+ const unsigned int expected[] = {
+ 2 * GSO_TEST_SIZE, GSO_TEST_SIZE + 3,
+ };
+ const unsigned int max_segs = 2;
+ int i = 0;
+
+ if (!IS_ENABLED(CONFIG_INET))
+ kunit_skip(test, "requires CONFIG_INET");
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no skb");
+ return;
+ }
+
+ segs = __skb_gso_segment(skb, features, true, max_segs);
+ if (IS_ERR_OR_NULL(segs)) {
+ KUNIT_FAIL(test, "segs error %pe", segs);
+ consume_skb(skb);
+ return;
+ }
+
+ for (cur = segs; cur; cur = next, i++) {
+ next = cur->next;
+
+ if (i < ARRAY_SIZE(expected)) {
+ KUNIT_EXPECT_EQ(test, cur->len,
+ GSO_TCP_HDR_LEN + expected[i]);
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_segs,
+ DIV_ROUND_UP(expected[i],
+ GSO_TEST_SIZE));
+ }
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, skb_shinfo(cur)->gso_size,
+ GSO_TEST_SIZE);
+
+ consume_skb(cur);
+ }
+
+ KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(expected));
+ consume_skb(skb);
+}
+
+#define GSO_TCP6_HDR_LEN \
+ (ETH_HLEN + sizeof(struct ipv6hdr) + sizeof(struct tcphdr))
+
+static struct sk_buff *gso_tcp6_skb_new(unsigned int payload_len)
+{
+ struct ipv6hdr *ip6h;
+ struct sk_buff *skb;
+ struct ethhdr *eth;
+ struct tcphdr *th;
+
+ skb = alloc_skb(NET_SKB_PAD + GSO_TCP6_HDR_LEN + payload_len,
+ GFP_KERNEL);
+ if (!skb)
+ return NULL;
+ skb_reserve(skb, NET_SKB_PAD);
+ skb_put_zero(skb, GSO_TCP6_HDR_LEN + payload_len);
+
+ skb_reset_mac_header(skb);
+ eth = eth_hdr(skb);
+ eth->h_proto = htons(ETH_P_IPV6);
+ skb->protocol = eth->h_proto;
+
+ skb_set_network_header(skb, ETH_HLEN);
+ ip6h = ipv6_hdr(skb);
+ ip6h->version = 6;
+ ip6h->nexthdr = IPPROTO_TCP;
+ ip6h->payload_len = htons(sizeof(*th) + payload_len);
+
+ skb_set_transport_header(skb, ETH_HLEN + sizeof(*ip6h));
+ th = tcp_hdr(skb);
+ th->doff = sizeof(*th) / 4;
+
+ skb->ip_summed = CHECKSUM_PARTIAL;
+ skb->csum_start = skb_transport_header(skb) - skb->head;
+ skb->csum_offset = offsetof(struct tcphdr, check);
+ skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+ skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
+ skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(payload_len, GSO_TEST_SIZE);
+
+ return skb;
+}
+
+/*
+ * The device GSO size limit is per L3 protocol, so only a lowered limit of
+ * the packet's own protocol may cost it the TSO bit, and a tag inside the
+ * frame, which replaces skb->protocol with the ethertype, must not change
+ * which limit applies. Takes ownership of @skb.
+ */
+static void gso_test_tcp_l3_limit(struct kunit *test, struct net_device *dev,
+ struct sk_buff *skb, netdev_features_t tso,
+ bool ipv6)
+{
+ unsigned int other = GSO_LEGACY_MAX_SIZE;
+ unsigned int own = GSO_MAX_SIZE;
+
+ /* The skb fits the limit of its own L3 protocol, not the other's. */
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_TRUE(test, netif_skb_features(skb) & tso);
+
+ /* ...and the other way around. */
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_FALSE(test, netif_skb_features(skb) & tso);
+
+ skb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q), 0);
+ if (!skb) {
+ KUNIT_FAIL(test, "no tagged skb");
+ return;
+ }
+ KUNIT_EXPECT_TRUE(test, skb->protocol == htons(ETH_P_8021Q));
+
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_TRUE(test, netif_skb_features(skb) & tso);
+
+ swap(own, other);
+ dev->gso_max_size = ipv6 ? own : other;
+ dev->gso_ipv4_max_size = ipv6 ? other : own;
+ KUNIT_EXPECT_FALSE(test, netif_skb_features(skb) & tso);
+
+ consume_skb(skb);
+}
+
+static void gso_test_tcp_limit_l3_proto(struct kunit *test)
+{
+ static const struct net_device_ops dummy_netdev_ops = { };
+ const unsigned int payload_len = 100 * 1024;
+ struct net_device *dev;
+ struct sk_buff *skb;
+
+ dev = alloc_etherdev(0);
+ if (!dev) {
+ KUNIT_FAIL(test, "no net_device");
+ return;
+ }
+ dev->netdev_ops = &dummy_netdev_ops;
+ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
+ NETIF_F_TSO6;
+ dev->features = dev->hw_features;
+ dev->vlan_features = dev->hw_features;
+
+ skb = gso_tcp6_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no IPv6 skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+ gso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO6, true);
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no IPv4 skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+ gso_test_tcp_l3_limit(test, dev, skb, NETIF_F_TSO, false);
+
+free_dev:
+ free_netdev(dev);
+}
+
+/*
+ * A re-segmented output is a plain GSO skb, so the whole length lands in the
+ * 16-bit L3 length field. A device which accepts GSO skbs above 64 KiB would
+ * otherwise be handed outputs whose length field truncates.
+ */
+static void gso_test_tcp_resegment_l3_len(struct kunit *test)
+{
+ static const struct net_device_ops dummy_netdev_ops = { };
+ const unsigned int payload_len = 200 * 1024;
+ struct sk_buff *skb, *segs, *cur, *next;
+ unsigned int nr_segs = 0;
+ struct net_device *dev;
+ bool again = false;
+
+ if (!IS_ENABLED(CONFIG_INET))
+ kunit_skip(test, "requires CONFIG_INET");
+
+ dev = alloc_etherdev(0);
+ if (!dev) {
+ KUNIT_FAIL(test, "no net_device");
+ return;
+ }
+ dev->netdev_ops = &dummy_netdev_ops;
+ dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
+ dev->features = dev->hw_features;
+ dev->vlan_features = dev->hw_features;
+ dev->gso_ipv4_max_size = 120 * 1024;
+
+ skb = gso_tcp_skb_new(payload_len);
+ if (!skb) {
+ KUNIT_FAIL(test, "no skb");
+ goto free_dev;
+ }
+ skb->dev = dev;
+
+ segs = validate_xmit_skb_list(skb, dev, &again);
+ if (IS_ERR_OR_NULL(segs)) {
+ KUNIT_FAIL(test, "segs error %pe", segs);
+ goto free_dev;
+ }
+
+ for (cur = segs; cur; cur = next, nr_segs++) {
+ next = cur->next;
+ cur->next = NULL;
+
+ KUNIT_EXPECT_TRUE(test, skb_is_gso(cur));
+ KUNIT_EXPECT_EQ(test, ntohs(ip_hdr(cur)->tot_len),
+ cur->len - (skb_network_header(cur) -
+ skb_mac_header(cur)));
+ consume_skb(cur);
+ }
+
+ KUNIT_EXPECT_EQ(test, nr_segs, 4);
+
+free_dev:
+ free_netdev(dev);
+}
+
/* IP tunnel flags */
#include <net/ip_tunnels.h>
@@ -372,6 +720,9 @@ static void ip_tunnel_flags_test_run(struct kunit *test)
static struct kunit_case net_test_cases[] = {
KUNIT_CASE_PARAM(gso_test_func, gso_test_gen_params),
+ KUNIT_CASE(gso_test_tcp_resegment),
+ KUNIT_CASE(gso_test_tcp_limit_l3_proto),
+ KUNIT_CASE(gso_test_tcp_resegment_l3_len),
KUNIT_CASE_PARAM(ip_tunnel_flags_test_run,
ip_tunnel_flags_test_gen_params),
{ },
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8912a66cd9097..fd10a7cdc1883 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4793,6 +4793,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
struct sk_buff *segs = NULL;
struct sk_buff *tail = NULL;
struct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;
+ unsigned int max_segs = SKB_GSO_CB(head_skb)->max_segs;
unsigned int mss = skb_shinfo(head_skb)->gso_size;
bool gso_by_frags = mss == GSO_BY_FRAGS;
unsigned int doffset = head_skb->data - skb_mac_header(head_skb);
@@ -4839,7 +4840,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
csum = !!can_checksum_protocol(features, proto);
if (sg && csum && !gso_by_frags) {
- if (!(features & NETIF_F_GSO_PARTIAL)) {
+ if (!max_segs && !(features & NETIF_F_GSO_PARTIAL)) {
struct sk_buff *iter;
unsigned int frag_len;
@@ -4874,7 +4875,10 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
* now.
*/
DEBUG_NET_WARN_ON_ONCE(len / mss > GSO_MAX_SEGS);
- partial_segs = min(len / mss, GSO_MAX_SEGS);
+ if (max_segs)
+ partial_segs = min(len / mss, max_segs);
+ else
+ partial_segs = min(len / mss, GSO_MAX_SEGS);
if (partial_segs > 1)
mss *= partial_segs;
else
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 2187034143255..e793aead68372 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -375,7 +375,7 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
int err;
BUILD_BUG_ON(sizeof(*OVS_CB(skb)) > SKB_GSO_CB_OFFSET);
- segs = __skb_gso_segment(skb, NETIF_F_SG, false);
+ segs = __skb_gso_segment(skb, NETIF_F_SG, false, 0);
if (IS_ERR(segs))
return PTR_ERR(segs);
if (segs == NULL)
|
| 37/3 | 2026/10/01 10:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 12239 output: 34 thoughts: 938 Thoughts: **KMSAN Fuzzing Session Justification: GSO Patch Analysis** Alright, let's dive into this patch and determine if it warrants a dedicated KMSAN fuzzing session. This involves a careful examination of the changes and how they might introduce new potential memory safety issues. First, I've got to break down the patch's scope. It touches a significant number of files, primarily centered around GSO (Generic Segmentation Offload) functionality within the networking stack. I see modifications in `drivers/net/tap.c`, various header files (`linux/netdevice.h`, `net/gso.h`, `net/udp.h`), core networking files (`net/core/dev.c`, `net/core/gso.c`, `net/core/skbuff.c`), and even Open vSwitch (`net/openvswitch/datapath.c`). A core theme seems to be refining the `__skb_gso_segment` function and introducing `max_segs` as a parameter. It looks like the patch aims to add more fine-grained control over the maximum number of segments an SKB can be split into during GSO. This is reflected in the changes to `struct skb_gso_cb` where the `max_segs` field is added, and it seems like the `max_segs` variable is being utilized throughout this stack. The `netif_skb_features` function is also being updated, adding a `check_gso_limits` parameter, and the `netif_get_gso_max_size` is moved. The changes in `net/core/dev.c` are also interesting. I see a `gso_within_dev_limits` function added along with `skb_gso_output_max_segs`, which seems to be calculated based on the TCP header. `validate_xmit_skb` appears to now enforce these limits by incorporating `max_segs` in the segmentation process. Further analysis reveals additions of new unit tests for gso resegmentation in `net/core/net_test.c`, which is good for verifying the patch's correctness, but it's not a silver bullet against memory safety vulnerabilities. The `skb_segment` function in `net/core/skbuff.c` is updated to utilize the `max_segs` and respect `NETIF_F_GSO_PARTIAL`. My main concern is the introduction and propagation of this `max_segs` variable. Wherever this is new logic, there is always the potential for off-by-one errors, incorrect limit checks, or mishandling of memory allocation related to segmenting. Also, the added conditional logic and new functions add complexity and surface area for potential errors, and the new unit tests don't guarantee that the corner cases are well covered. Therefore, I need to investigate the layout and offset of `struct skb_gso_cb` and its interaction with `skb->cb` to see if there could be potential alignment issues or out-of-bounds writes. The inclusion of the new `max_segs` field and associated calculations within the core segmentation logic warrants close scrutiny for potential memory corruption. I will look more closely at `include/net/gso.h` now, looking to get a deeper understanding of this `struct skb_gso_cb`. Ultimately, given the pervasive changes and the potential for off-by-one errors with `max_segs`, I think the patch merits a dedicated KMSAN fuzzing session. The impact is broad, and the added complexity increases the risk of subtle memory safety issues. |
| 38/3 | 2026/10/01 10:07 | tool | read-file |
0mArgs:{
"File": "include/net/gso.h",
"FirstLine": 1,
"LineCount": 40
}Results: {
"Contents": " 1:\t/* SPDX-License-Identifier: GPL-2.0-or-later */\n 2:\t\n 3:\t#ifndef _NET_GSO_H\n 4:\t#define _NET_GSO_H\n 5:\t\n 6:\t#include \u003clinux/skbuff.h\u003e\n 7:\t\n 8:\t/* Keeps track of mac header offset relative to skb-\u003ehead.\n 9:\t * It is useful for TSO of Tunneling protocol. e.g. GRE.\n 10:\t * For non-tunnel skb it points to skb_mac_header() and for\n 11:\t * tunnel skb it points to outer mac header.\n 12:\t * Keeps track of level of encapsulation of network headers.\n 13:\t */\n 14:\tstruct skb_gso_cb {\n 15:\t\tunion {\n 16:\t\t\tint\tmac_offset;\n 17:\t\t\tint\tdata_offset;\n 18:\t\t};\n 19:\t\tint\tencap_level;\n 20:\t\t__wsum\tcsum;\n 21:\t\t__u16\tcsum_start;\n 22:\t\t__u16\tmax_segs;\t/* Max MSS segs per output skb, 0 = no limit */\n 23:\t};\n 24:\t#define SKB_GSO_CB_OFFSET\t32\n 25:\t#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)-\u003ecb + SKB_GSO_CB_OFFSET))\n 26:\t\n 27:\tstatic inline int skb_tnl_header_len(const struct sk_buff *inner_skb)\n 28:\t{\n 29:\t\treturn (skb_mac_header(inner_skb) - inner_skb-\u003ehead) -\n 30:\t\t\tSKB_GSO_CB(inner_skb)-\u003emac_offset;\n 31:\t}\n 32:\t\n 33:\tstatic inline int gso_pskb_expand_head(struct sk_buff *skb, int extra)\n 34:\t{\n 35:\t\tint new_headroom, headroom;\n 36:\t\tint ret;\n 37:\t\n 38:\t\theadroom = skb_headroom(skb);\n 39:\t\tret = pskb_expand_head(skb, extra, 0, GFP_ATOMIC);\n 40:\t\tif (ret)\n"
} |
| 39/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14627 output: 32 thoughts: 247 Thoughts: **Analyzing skb_buff's GSO Control Block** Okay, let's dive into this `skb_buff` structure and its GSO (Generic Segmentation Offload) control block, `skb_gso_cb`. I need to verify how the `skb_gso_cb` struct fits within the `skb->cb` array, which is a common area for per-SKB metadata. First, I remember that `SKB_GSO_CB_OFFSET` is defined as 32. This is the offset within the `cb` array where the `skb_gso_cb` typically resides. Now, let's quickly refresh myself on the size of `skb->cb`. Ah yes, on a 64-bit architecture, it's usually 48 bytes - `char cb[48] __aligned(8);`. Now, for the crux of the matter: what's the actual size of `struct skb_gso_cb`? I need to know this to be certain it fits. Let's break down the members: `mac_offset` (4 bytes), `encap_level` (4 bytes), `csum` (4 bytes, since `__wsum` is `__u32`), and then `csum_start` and `max_segs` (2 bytes each, `__u16`). Adding this up: 4 + 4 + 4 + 2 + 2... that gives me 16 bytes for the `skb_gso_cb` itself. The offset is 32, add that to the 16 bytes for the struct, which gives me a total of 48. So, 32 + 16 = 48 bytes. It fits perfectly! I can see that the struct fits precisely into `skb->cb`. I should check the `skb->cb` size in `include/linux/skbuff.h` to confirm the default size. |
| 40/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "cb\\[.*\\]",
"PathPrefix": "include/linux/skbuff.h"
}Results: {
"Output": "include/linux/skbuff.h=886=struct sk_buff {\n--\ninclude/linux/skbuff.h-918-\t */\ninclude/linux/skbuff.h:919:\tchar\t\t\tcb[48] __aligned(8);\ninclude/linux/skbuff.h-920-\n"
} |
| 41/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15432 output: 21 thoughts: 132 Thoughts: **Analyzing the Impact of the GSO CB Modification** Okay, so `cb[48]`... that means 32 + 16 = 48 bytes are allocated. I need to understand the implications here. Before the patch, the `struct skb_gso_cb` struct, as I recall, consisted of the following fields: `mac_offset` (4 bytes), `encap_level` (4 bytes), `csum` (4 bytes), `csum_start` (2 bytes), and some `padding` (2 bytes). Therefore, the original structure used 14 bytes plus 2 bytes of padding, totaling 16 bytes. Now, it looks like `max_segs` is utilizing that formerly unused 2-byte padding. I need to verify that. My next step is to quickly check for any potential `BUILD_BUG_ON` instances related to `skb_gso_cb` to ensure there aren't any hidden problems from this change. |
| 42/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "skb_gso_cb"
}Results: {
"Output": "include/net/gso.h-13- */\ninclude/net/gso.h:14:struct skb_gso_cb {\ninclude/net/gso.h-15-\tunion {\n--\ninclude/net/gso.h-24-#define SKB_GSO_CB_OFFSET\t32\ninclude/net/gso.h:25:#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)-\u003ecb + SKB_GSO_CB_OFFSET))\ninclude/net/gso.h-26-\n"
} |
| 43/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15955 output: 20 thoughts: 206 Thoughts: **Analyzing SKB Segmentation** Okay, let's dive into the guts of this segmentation logic. My immediate focus is on `__skb_gso_segment` within `net/core/gso.c`. I'm going through the code. I see it's setting the `mac_offset`, `encap_level`, and `max_segs` within the `SKB_GSO_CB` struct. This is standard GSO setup, using `min` with `GSO_MAX_SEGS` to cap the segmentation. However, a question just popped into my head... I need to verify that all uses of segmentation actually go through this function. Are there any direct calls to `skb_segment` bypassing `__skb_gso_segment`? I need to know the full picture here. Let me check the callers of `skb_segment` directly. It's time to get a complete overview. |
| 44/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "\\bskb_segment\\("
}Results: {
"Output": "Documentation/networking/segmentation-offloads.rst=205=Instead, the SCTP protocol layer builds an skb with the segments correctly\nDocumentation/networking/segmentation-offloads.rst:206:padded and stored as chained skbs, and skb_segment() splits based on those.\nDocumentation/networking/segmentation-offloads.rst-207-To signal this, gso_size is set to the special value GSO_BY_FRAGS.\n--\ndrivers/s390/net/qeth_core_main.c=6890=netdev_features_t qeth_features_check(struct sk_buff *skb,\n--\ndrivers/s390/net/qeth_core_main.c-6931-\tif (netif_needs_gso(skb, features)) {\ndrivers/s390/net/qeth_core_main.c:6932:\t\t/* match skb_segment(): */\ndrivers/s390/net/qeth_core_main.c-6933-\t\tunsigned int doffset = skb-\u003edata - skb_mac_header(skb);\n--\ninclude/linux/skbuff.h=4290=void skb_scrub_packet(struct sk_buff *skb, bool xnet);\ninclude/linux/skbuff.h:4291:struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);\ninclude/linux/skbuff.h-4292-struct sk_buff *skb_segment_list(struct sk_buff *skb, netdev_features_t features,\n--\nlib/test_bpf.c=15300=static __init int test_skb_segment_single(const struct skb_segment_test *test)\n--\nlib/test_bpf.c-15310-\nlib/test_bpf.c:15311:\tsegs = skb_segment(skb, test-\u003efeatures);\nlib/test_bpf.c-15312-\tif (!IS_ERR(segs)) {\n--\nnet/core/net_test.c=204=static void gso_test_func(struct kunit *test)\n--\nnet/core/net_test.c-286-\tSKB_GSO_CB(skb)-\u003emax_segs = tcase-\u003emax_segs;\nnet/core/net_test.c:287:\tsegs = skb_segment(skb, features);\nnet/core/net_test.c-288-\tif (IS_ERR(segs)) {\n--\nnet/core/skbuff.c=4779=EXPORT_SYMBOL_GPL(skb_segment_list);\n--\nnet/core/skbuff.c-4789- */\nnet/core/skbuff.c:4790:struct sk_buff *skb_segment(struct sk_buff *head_skb,\nnet/core/skbuff.c-4791-\t\t\t netdev_features_t features)\n--\nnet/ipv4/tcp_offload.c=133=struct sk_buff *tcp_gso_segment(struct sk_buff *skb,\n--\nnet/ipv4/tcp_offload.c-180-\nnet/ipv4/tcp_offload.c:181:\tsegs = skb_segment(skb, features);\nnet/ipv4/tcp_offload.c-182-\tif (IS_ERR(segs))\n--\nnet/ipv4/udp_offload.c=481=struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,\n--\nnet/ipv4/udp_offload.c-550-\nnet/ipv4/udp_offload.c:551:\tsegs = skb_segment(gso_skb, features);\nnet/ipv4/udp_offload.c-552-\tif (IS_ERR_OR_NULL(segs)) {\n--\nnet/ipv4/udp_offload.c=633=static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,\n--\nnet/ipv4/udp_offload.c-687-\t */\nnet/ipv4/udp_offload.c:688:\tsegs = skb_segment(skb, features);\nnet/ipv4/udp_offload.c-689-out:\n--\nnet/ipv6/udp_offload.c=19=static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,\n--\nnet/ipv6/udp_offload.c-108-\t\t */\nnet/ipv6/udp_offload.c:109:\t\tsegs = skb_segment(skb, features);\nnet/ipv6/udp_offload.c-110-\t}\n--\nnet/sctp/offload.c=39=static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,\n--\nnet/sctp/offload.c-71-\nnet/sctp/offload.c:72:\tsegs = skb_segment(skb, (features | NETIF_F_HW_CSUM) \u0026 ~NETIF_F_SG);\nnet/sctp/offload.c-73-\tif (IS_ERR(segs))\n"
} |
| 45/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17750 output: 38 thoughts: 90 Thoughts: Okay, here's my assessment of this code snippet, distilled into a first-person perspective, assuming I'm already quite familiar with BPF and kernel networking. **Inspecting SKB Segmentation in `lib/test_bpf.c`** Alright, I'm digging into `lib/test_bpf.c`, specifically looking at how they're handling segmentation. I see `segs = skb_segment(skb, test->features);`. Hmm, interesting. Now, my immediate concern, the thing that pops into my head when I see `skb_segment` and thinking about possible issues within that context, is about the initialization of `SKB_GSO_CB(head_skb)->max_segs`. This is a classic point for bugs, especially when you're dealing with GSO (Generic Segmentation Offload) and the potential for offload of segmentation to hardware. If `max_segs` isn't properly set, things can go sideways *very* quickly. Right, so to make sure it is initialized correctly, I'm going to jump straight to line 15300 in `lib/test_bpf.c`. That's where I'll expect to find the relevant logic. I'm keen to confirm that `max_segs` is set prior to the `skb_segment` call. Any uninitialized values can cause some nasty issues. |
| 46/3 | 2026/10/01 10:07 | tool | read-file |
0mArgs:{
"File": "lib/test_bpf.c",
"FirstLine": 15290,
"LineCount": 40
}Results: {
"Contents": "15290:\t\t{\n15291:\t\t\t.descr = \"gso_linear_no_head_frag\",\n15292:\t\t\t.build_skb = build_test_skb_linear_no_head_frag,\n15293:\t\t\t.features = NETIF_F_SG | NETIF_F_FRAGLIST |\n15294:\t\t\t\t NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_GSO |\n15295:\t\t\t\t NETIF_F_GRO | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\n15296:\t\t\t\t NETIF_F_HW_VLAN_STAG_TX\n15297:\t\t}\n15298:\t};\n15299:\t\n15300:\tstatic __init int test_skb_segment_single(const struct skb_segment_test *test)\n15301:\t{\n15302:\t\tstruct sk_buff *skb, *segs;\n15303:\t\tint ret = -1;\n15304:\t\n15305:\t\tskb = test-\u003ebuild_skb();\n15306:\t\tif (!skb) {\n15307:\t\t\tpr_info(\"%s: failed to build_test_skb\", __func__);\n15308:\t\t\tgoto done;\n15309:\t\t}\n15310:\t\n15311:\t\tsegs = skb_segment(skb, test-\u003efeatures);\n15312:\t\tif (!IS_ERR(segs)) {\n15313:\t\t\tkfree_skb_list(segs);\n15314:\t\t\tret = 0;\n15315:\t\t}\n15316:\t\tkfree_skb(skb);\n15317:\tdone:\n15318:\t\treturn ret;\n15319:\t}\n15320:\t\n15321:\tstatic __init int test_skb_segment(void)\n15322:\t{\n15323:\t\tint i, err_cnt = 0, pass_cnt = 0;\n15324:\t\n15325:\t\tfor (i = 0; i \u003c ARRAY_SIZE(skb_segment_tests); i++) {\n15326:\t\t\tconst struct skb_segment_test *test = \u0026skb_segment_tests[i];\n15327:\t\n15328:\t\t\tcond_resched();\n15329:\t\t\tif (exclude_test(i))\n"
} |
| 47/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18866 output: 34 thoughts: 41 Thoughts: Here's my thought process, as if I were considering this myself: **Investigating SKB Allocation in `build_test_skb`** Okay, hold on a second. I need to understand something fundamental here. How *exactly* is `build_test_skb` allocating the `skb`? That's a crucial detail that I'm missing at this point. I'm going to jump straight into the source code to get the answer. Specifically, I'll need to look at the implementation of `build_test_skb` in `lib/test_bpf.c`. Time to see how this thing is actually allocating and initializing that socket buffer. I need to understand that process completely to continue with my analysis. Let's see what's what in there. |
| 48/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "build_test_skb",
"PathPrefix": "lib/test_bpf.c"
}Results: {
"Output": "lib/test_bpf.c=15158=static bool exclude_test(int test_id)\n--\nlib/test_bpf.c-15162-\nlib/test_bpf.c:15163:static __init struct sk_buff *build_test_skb(void)\nlib/test_bpf.c-15164-{\n--\nlib/test_bpf.c-15222-\nlib/test_bpf.c:15223:static __init struct sk_buff *build_test_skb_linear_no_head_frag(void)\nlib/test_bpf.c-15224-{\n--\nlib/test_bpf.c=15283=static struct skb_segment_test skb_segment_tests[] __initconst = {\n--\nlib/test_bpf.c-15285-\t\t.descr = \"gso_with_rx_frags\",\nlib/test_bpf.c:15286:\t\t.build_skb = build_test_skb,\nlib/test_bpf.c-15287-\t\t.features = NETIF_F_SG | NETIF_F_GSO_PARTIAL | NETIF_F_IP_CSUM |\n--\nlib/test_bpf.c-15291-\t\t.descr = \"gso_linear_no_head_frag\",\nlib/test_bpf.c:15292:\t\t.build_skb = build_test_skb_linear_no_head_frag,\nlib/test_bpf.c-15293-\t\t.features = NETIF_F_SG | NETIF_F_FRAGLIST |\n--\nlib/test_bpf.c=15300=static __init int test_skb_segment_single(const struct skb_segment_test *test)\n--\nlib/test_bpf.c-15306-\tif (!skb) {\nlib/test_bpf.c:15307:\t\tpr_info(\"%s: failed to build_test_skb\", __func__);\nlib/test_bpf.c-15308-\t\tgoto done;\n"
} |
| 49/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19671 output: 38 thoughts: 24 Thoughts: Okay, let's dive into this. Here's my thought process on tackling this: **Analyzing `build_test_skb` in `lib/test_bpf.c`** Alright, the first step is clear: I need to take a look at the `build_test_skb` function within `lib/test_bpf.c`. That's the likely starting point for understanding how test packets are constructed within this BPF testing framework. I'm already anticipating I'll be looking for details on how packet headers are crafted, what data is injected into the packet payloads, and how any metadata crucial for BPF program execution is set up. Knowing how these test SKBs are built is fundamental for debugging and writing effective tests. I expect to see considerations for different network protocols (Ethernet, IPv4, IPv6, TCP, UDP, etc.) and potentially even custom or experimental headers used in the BPF testing context. I'll need to pay close attention to the data structures involved, the memory allocation strategies used, and any helper functions called within `build_test_skb`. This is all about gaining a solid understanding of the foundation of this testing process. I'll be checking for any potential optimization opportunities to make it more efficient or easier to debug. Let's see what we've got! |
| 50/3 | 2026/10/01 10:07 | tool | read-file |
0mArgs:{
"File": "lib/test_bpf.c",
"FirstLine": 15163,
"LineCount": 40
}Results: {
"Contents": "15163:\tstatic __init struct sk_buff *build_test_skb(void)\n15164:\t{\n15165:\t\tu32 headroom = NET_SKB_PAD + NET_IP_ALIGN + ETH_HLEN;\n15166:\t\tstruct sk_buff *skb[2];\n15167:\t\tstruct page *page[2];\n15168:\t\tint i, data_size = 8;\n15169:\t\n15170:\t\tfor (i = 0; i \u003c 2; i++) {\n15171:\t\t\tpage[i] = alloc_page(GFP_KERNEL);\n15172:\t\t\tif (!page[i]) {\n15173:\t\t\t\tif (i == 0)\n15174:\t\t\t\t\tgoto err_page0;\n15175:\t\t\t\telse\n15176:\t\t\t\t\tgoto err_page1;\n15177:\t\t\t}\n15178:\t\n15179:\t\t\t/* this will set skb[i]-\u003ehead_frag */\n15180:\t\t\tskb[i] = dev_alloc_skb(headroom + data_size);\n15181:\t\t\tif (!skb[i]) {\n15182:\t\t\t\tif (i == 0)\n15183:\t\t\t\t\tgoto err_skb0;\n15184:\t\t\t\telse\n15185:\t\t\t\t\tgoto err_skb1;\n15186:\t\t\t}\n15187:\t\n15188:\t\t\tskb_reserve(skb[i], headroom);\n15189:\t\t\tskb_put(skb[i], data_size);\n15190:\t\t\tskb[i]-\u003eprotocol = htons(ETH_P_IP);\n15191:\t\t\tskb_reset_network_header(skb[i]);\n15192:\t\t\tskb_set_mac_header(skb[i], -ETH_HLEN);\n15193:\t\n15194:\t\t\tskb_add_rx_frag(skb[i], 0, page[i], 0, 64, 64);\n15195:\t\t\t// skb_headlen(skb[i]): 8, skb[i]-\u003ehead_frag = 1\n15196:\t\t}\n15197:\t\n15198:\t\t/* setup shinfo */\n15199:\t\tskb_shinfo(skb[0])-\u003egso_size = 1448;\n15200:\t\tskb_shinfo(skb[0])-\u003egso_type = SKB_GSO_TCPV4;\n15201:\t\tskb_shinfo(skb[0])-\u003egso_type |= SKB_GSO_DODGY;\n15202:\t\tskb_shinfo(skb[0])-\u003egso_segs = 0;\n"
} |
| 51/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20771 output: 32 thoughts: 58 Thoughts: Here's my summary, as if I were thinking these thoughts: **SKB Allocation Question** Hang on a second. I need to be absolutely certain about this. When we're allocating an SKB, whether it's through `dev_alloc_skb` or `__alloc_skb`, I can't immediately recall if `skb->cb` gets zeroed out as part of the allocation process. That's a critical detail for ensuring data integrity and avoiding potential security vulnerabilities down the line, especially in the context of our current project. Okay, no need to guess. Time to go directly to the source. I'm going to quickly check the `__alloc_skb` function in `net/core/skbuff.c`. I need to confirm whether the control buffer (`skb->cb`) is initialized to all zeros during the allocation. That's the definitive answer I require. Let's see what the code has to say. |
| 52/3 | 2026/10/01 10:07 | tool | grepper |
0mError:no matches Args: {
"Expression": "memset\\(.*cb",
"PathPrefix": "net/core/skbuff.c"
}Results: {
"error": "no matches"
} |
| 53/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21080 output: 38 thoughts: 22 Thoughts: Okay, let's dive into it. **Diving into `__alloc_skb`** Alright, let's pull up the source code for `__alloc_skb` in `net/core/skbuff.c`. I need to refresh my understanding of the core allocation logic for SKBs. I'm especially interested in how this interacts with memory management, page allocation, and potential performance bottlenecks. I want to see how this function handles various scenarios: small allocations, large allocations, the presence or absence of headroom, tailroom, and data, and how it potentially interacts with slab caches or page pools if configured. I want to pinpoint where the critical path lies and if there are any obvious areas for optimization or potential issues, especially concerning fragmentation. Let's see how they're handling atomic contexts and GFP flags too. I'm keen to examine the allocation strategies. Let's see how it's dealing with potential out-of-memory scenarios and error handling too. Gotta keep an eye on concurrency issues too. I'm also thinking this is a good opportunity to re-evaluate potential areas for improvements I've considered. Right, let's get into it. |
| 54/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "struct sk_buff \\*__alloc_skb",
"PathPrefix": "net/core/skbuff.c"
}Results: {
"Output": "net/core/skbuff.c=606=static void *kmalloc_reserve(unsigned int *size, gfp_t flags, int node,\n--\nnet/core/skbuff.c-673- */\nnet/core/skbuff.c:674:struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,\nnet/core/skbuff.c-675-\t\t\t int flags, int node)\n"
} |
| 55/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21513 output: 36 thoughts: 20 Thoughts: Okay, here's my interpretation of that request, formatted as requested: **Diving into the Network Core** Alright, let's get down to brass tacks. I need to take a look at the heart of the networking stack – `net/core/skbuff.c`. I'm specifically interested in that section around line 674. I know what's likely happening in that area, but I need to confirm the details and refresh my understanding. This is where the intricacies of the `sk_buff` structure and its associated operations are truly exposed. It's time to dive in and get my hands dirty, so I'm looking forward to reading the code to determine how I can make the most relevant changes. |
| 56/3 | 2026/10/01 10:07 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 674,
"LineCount": 60
}Results: {
"Contents": " 674:\tstruct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,\n 675:\t\t\t\t int flags, int node)\n 676:\t{\n 677:\t\tstruct sk_buff *skb = NULL;\n 678:\t\tstruct kmem_cache *cache;\n 679:\t\tu8 *data;\n 680:\t\n 681:\t\tif (sk_memalloc_socks() \u0026\u0026 (flags \u0026 SKB_ALLOC_RX))\n 682:\t\t\tgfp_mask |= __GFP_MEMALLOC;\n 683:\t\n 684:\t\tif (flags \u0026 SKB_ALLOC_FCLONE) {\n 685:\t\t\tcache = net_hotdata.skbuff_fclone_cache;\n 686:\t\t\tgoto fallback;\n 687:\t\t}\n 688:\t\tcache = net_hotdata.skbuff_cache;\n 689:\t\tif (unlikely(node != NUMA_NO_NODE \u0026\u0026 node != numa_mem_id()))\n 690:\t\t\tgoto fallback;\n 691:\t\n 692:\t\tif (flags \u0026 SKB_ALLOC_NAPI) {\n 693:\t\t\tskb = napi_skb_cache_get(true);\n 694:\t\t\tif (unlikely(!skb))\n 695:\t\t\t\treturn NULL;\n 696:\t\t} else if (!in_hardirq() \u0026\u0026 !irqs_disabled()) {\n 697:\t\t\tlocal_bh_disable();\n 698:\t\t\tskb = napi_skb_cache_get(false);\n 699:\t\t\tlocal_bh_enable();\n 700:\t\t}\n 701:\t\n 702:\t\tif (!skb) {\n 703:\tfallback:\n 704:\t\t\tskb = kmem_cache_alloc_node(cache, gfp_mask \u0026 ~GFP_DMA, node);\n 705:\t\t\tif (unlikely(!skb))\n 706:\t\t\t\treturn NULL;\n 707:\t\t}\n 708:\t\tskbuff_clear(skb);\n 709:\t\n 710:\t\t/* We do our best to align skb_shared_info on a separate cache\n 711:\t\t * line. It usually works because kmalloc(X \u003e SMP_CACHE_BYTES) gives\n 712:\t\t * aligned memory blocks, unless SLUB/SLAB debug is enabled.\n 713:\t\t * Both skb-\u003ehead and skb_shared_info are cache line aligned.\n 714:\t\t */\n 715:\t\tdata = kmalloc_reserve(\u0026size, gfp_mask, node, skb);\n 716:\t\tif (unlikely(!data))\n 717:\t\t\tgoto nodata;\n 718:\t\t/* kmalloc_size_roundup() might give us more room than requested.\n 719:\t\t * Put skb_shared_info exactly at the end of allocated zone,\n 720:\t\t * to allow max possible filling before reallocation.\n 721:\t\t */\n 722:\t\t__finalize_skb_around(skb, data, size);\n 723:\t\n 724:\t\tif (flags \u0026 SKB_ALLOC_FCLONE) {\n 725:\t\t\tstruct sk_buff_fclones *fclones;\n 726:\t\n 727:\t\t\tfclones = container_of(skb, struct sk_buff_fclones, skb1);\n 728:\t\n 729:\t\t\t/* skb-\u003efclone is a 2bits field.\n 730:\t\t\t * Replace expensive RMW (skb-\u003efclone = SKB_FCLONE_ORIG)\n 731:\t\t\t * with a single OR.\n 732:\t\t\t */\n 733:\t\t\tBUILD_BUG_ON(SKB_FCLONE_UNAVAILABLE != 0);\n"
} |
| 57/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22719 output: 18 thoughts: 50 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing the `skbuff_clear` Call** Alright, my focus is zeroing in on line 708, the `skbuff_clear(skb);` call. This is where the magic (or potential problem) might be happening. My immediate instinct is to dissect the implications of this function. Let's dig into its implementation. I'll need to locate the definition of `skbuff_clear`. I'm going to quickly check in either `net/core/skbuff.c` or, more likely, the header file `include/linux/skbuff.h`. The header is usually where you'd find function prototypes and maybe inline implementations of functions like this, especially if it's performance-critical and needs to be optimized for inclusion. It's highly probable that I need to understand what this function does with the `skb`, whether it's deallocating, zeroing out data, or resetting pointers within the struct. This call is a red flag to me because it's the point where the `skb` is potentially being touched, so the implication of any errors are relevant. |
| 58/3 | 2026/10/01 10:07 | tool | grepper |
0mArgs:{
"Expression": "skbuff_clear"
}Results: {
"Output": "net/core/skbuff.c=284=static inline struct sk_buff *napi_skb_cache_get(bool alloc)\n--\nnet/core/skbuff.c-315- */\nnet/core/skbuff.c:316:static inline void skbuff_clear(struct sk_buff *skb)\nnet/core/skbuff.c-317-{\n--\nnet/core/skbuff.c=344=u32 napi_skb_cache_get_bulk(void **skbs, u32 n)\n--\nnet/core/skbuff.c-379-\t\tkasan_mempool_unpoison_object(skbs[i], skbuff_cache_size);\nnet/core/skbuff.c:380:\t\tskbuff_clear(skbs[i]);\nnet/core/skbuff.c-381-\t}\n--\nnet/core/skbuff.c=437=struct sk_buff *slab_build_skb(void *data)\n--\nnet/core/skbuff.c-446-\nnet/core/skbuff.c:447:\tskbuff_clear(skb);\nnet/core/skbuff.c-448-\tdata = __slab_build_skb(data, \u0026size);\n--\nnet/core/skbuff.c=490=struct sk_buff *__build_skb(void *data, unsigned int frag_size)\n--\nnet/core/skbuff.c-498-\nnet/core/skbuff.c:499:\tskbuff_clear(skb);\nnet/core/skbuff.c-500-\t__build_skb_around(skb, data, frag_size);\n--\nnet/core/skbuff.c=552=static struct sk_buff *__napi_build_skb(void *data, unsigned int frag_size)\n--\nnet/core/skbuff.c-559-\nnet/core/skbuff.c:560:\tskbuff_clear(skb);\nnet/core/skbuff.c-561-\t__build_skb_around(skb, data, frag_size);\n--\nnet/core/skbuff.c=674=struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,\n--\nnet/core/skbuff.c-707-\t}\nnet/core/skbuff.c:708:\tskbuff_clear(skb);\nnet/core/skbuff.c-709-\n"
} |
| 59/3 | 2026/10/01 10:07 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23687 output: 36 thoughts: 13 Thoughts: Okay, let's dive into this. Here's my take on understanding `skbuff_clear`: **Dissecting `skbuff_clear` - Let's Get to the Core** Alright, my first instinct is to understand the exact mechanics behind `skbuff_clear`. I need to figure out what this function is *really* doing. I know the basics of an `sk_buff`, but a function with "clear" in its name always warrants a closer look. Is it truly clearing the entire buffer? Or is it more selective? Does it reset pointers within the `sk_buff` structure? Are there potential memory leaks or vulnerabilities I should immediately consider? What's the context in which this function is typically used within the networking stack? Understanding these implementation details is crucial. My goal is to know this function's purpose inside and out, so that I can anticipate how it behaves in different situations. Let's see what's what. |
| 60/3 | 2026/10/01 10:08 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 315,
"LineCount": 25
}Results: {
"Contents": " 315:\t */\n 316:\tstatic inline void skbuff_clear(struct sk_buff *skb)\n 317:\t{\n 318:\t\t/* Replace memset(skb, 0, offsetof(struct sk_buff, tail))\n 319:\t\t * with two smaller memset(), with a barrier() between them.\n 320:\t\t * This forces the compiler to inline both calls.\n 321:\t\t */\n 322:\t\tBUILD_BUG_ON(offsetof(struct sk_buff, tail) \u003c= 128);\n 323:\t\tmemset(skb, 0, 128);\n 324:\t\tbarrier();\n 325:\t\tmemset((void *)skb + 128, 0, offsetof(struct sk_buff, tail) - 128);\n 326:\t}\n 327:\t\n 328:\t/**\n 329:\t * napi_skb_cache_get_bulk - obtain a number of zeroed skb heads from the cache\n 330:\t * @skbs: pointer to an at least @n-sized array to fill with skb pointers\n 331:\t * @n: number of entries to provide\n 332:\t *\n 333:\t * Tries to obtain @n \u0026sk_buff entries from the NAPI percpu cache and writes\n 334:\t * the pointers into the provided array @skbs. If there are less entries\n 335:\t * available, tries to replenish the cache and bulk-allocates the diff from\n 336:\t * the MM layer if needed.\n 337:\t * The heads are being zeroed with either memset() or %__GFP_ZERO, so they are\n 338:\t * ready for {,__}build_skb_around() and don't have any data buffers attached.\n 339:\t * Must be called *only* from the BH context.\n"
} |
| 61/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24427 output: 36 thoughts: 41 Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue: **Investigating `cb` Offset within `sk_buff`** Right, so I'm looking at something in the kernel and I need to quickly ascertain the location of `cb` within the `sk_buff` structure. Specifically, I need to understand its relationship to `tail`. This likely relates to some network packet manipulation or buffer management logic I'm working through. I'm visualizing the memory layout, and the best way to get this right and stop guessing is to look at the definitive source: `include/linux/skbuff.h`. No need to rely on assumptions or vague recollections; the header file will contain the exact definition of `struct sk_buff`, including the offsets of all its members. That's where I need to be, and quickly. Let's get to it! |
| 62/3 | 2026/10/01 10:08 | tool | read-file |
0mArgs:{
"File": "include/linux/skbuff.h",
"FirstLine": 885,
"LineCount": 75
}Results: {
"Contents": " 885:\t\n 886:\tstruct sk_buff {\n 887:\t\tunion {\n 888:\t\t\tstruct {\n 889:\t\t\t\t/* These two members must be first to match sk_buff_head. */\n 890:\t\t\t\tstruct sk_buff\t\t*next;\n 891:\t\t\t\tstruct sk_buff\t\t*prev;\n 892:\t\n 893:\t\t\t\tunion {\n 894:\t\t\t\t\tstruct net_device\t*dev;\n 895:\t\t\t\t\t/* Some protocols might use this space to store information,\n 896:\t\t\t\t\t * while device pointer would be NULL.\n 897:\t\t\t\t\t * UDP receive path is one user.\n 898:\t\t\t\t\t */\n 899:\t\t\t\t\tunsigned long\t\tdev_scratch;\n 900:\t\t\t\t};\n 901:\t\t\t};\n 902:\t\t\tstruct rb_node\t\trbnode; /* used in netem, ip4 defrag, and tcp stack */\n 903:\t\t\tstruct list_head\tlist;\n 904:\t\t\tstruct llist_node\tll_node;\n 905:\t\t};\n 906:\t\n 907:\t\tstruct sock\t\t*sk;\n 908:\t\n 909:\t\tunion {\n 910:\t\t\tktime_t\t\ttstamp;\n 911:\t\t\tu64\t\tskb_mstamp_ns; /* earliest departure time */\n 912:\t\t};\n 913:\t\t/*\n 914:\t\t * This is the control buffer. It is free to use for every\n 915:\t\t * layer. Please put your private variables there. If you\n 916:\t\t * want to keep them across layers you have to do a skb_clone()\n 917:\t\t * first. This is owned by whoever has the skb queued ATM.\n 918:\t\t */\n 919:\t\tchar\t\t\tcb[48] __aligned(8);\n 920:\t\n 921:\t\tunion {\n 922:\t\t\tstruct {\n 923:\t\t\t\tunsigned long\t_skb_refdst;\n 924:\t\t\t\tvoid\t\t(*destructor)(struct sk_buff *skb);\n 925:\t\t\t};\n 926:\t\t\tstruct list_head\ttcp_tsorted_anchor;\n 927:\t#ifdef CONFIG_NET_SOCK_MSG\n 928:\t\t\tunsigned long\t\t_sk_redir;\n 929:\t#endif\n 930:\t\t};\n 931:\t\n 932:\t#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)\n 933:\t\tunsigned long\t\t _nfct;\n 934:\t#endif\n 935:\t\tunsigned int\t\tlen,\n 936:\t\t\t\t\tdata_len;\n 937:\t\t__u16\t\t\tmac_len,\n 938:\t\t\t\t\thdr_len;\n 939:\t\n 940:\t\t/* Following fields are _not_ copied in __copy_skb_header()\n 941:\t\t * Note that queue_mapping is here mostly to fill a hole.\n 942:\t\t */\n 943:\t\t__u16\t\t\tqueue_mapping;\n 944:\t\n 945:\t/* if you move cloned around you also must adapt those constants */\n 946:\t#ifdef __BIG_ENDIAN_BITFIELD\n 947:\t#define CLONED_MASK\t(1 \u003c\u003c 7)\n 948:\t#else\n 949:\t#define CLONED_MASK\t1\n 950:\t#endif\n 951:\t#define CLONED_OFFSET\t\toffsetof(struct sk_buff, __cloned_offset)\n 952:\t\n 953:\t\t/* private: */\n 954:\t\t__u8\t\t\t__cloned_offset[0];\n 955:\t\t/* public: */\n 956:\t\t__u8\t\t\tcloned:1,\n 957:\t\t\t\t\tnohdr:1,\n 958:\t\t\t\t\tfclone:2,\n 959:\t\t\t\t\tpeeked:1,\n"
} |
| 63/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25737 output: 37 thoughts: 17 Thoughts: Here's my take on those thoughts: **Navigating the SKB Structure** Okay, so I need to understand where the `tail` pointer resides within the `sk_buff` structure. That's fundamental for understanding how data is appended to and managed within a socket buffer, and ultimately, how packets are constructed and processed. I need to get a clear picture of its offset, or maybe how it relates to other crucial fields like `data`, `len`, or `head`. Knowing the exact memory layout is critical for optimization, debugging, and any manipulation of the buffer directly at the kernel level. Let's see how I can get that information quickly and accurately. The goal is to ensure efficient network performance. |
| 64/3 | 2026/10/01 10:08 | tool | grepper |
0mArgs:{
"Expression": "sk_buff_data_t.*tail",
"PathPrefix": "include/linux/skbuff.h"
}Results: {
"Output": "include/linux/skbuff.h=886=struct sk_buff {\n--\ninclude/linux/skbuff.h-1091-\t/* These elements must be at the end, see alloc_skb() for details. */\ninclude/linux/skbuff.h:1092:\tsk_buff_data_t\t\ttail;\ninclude/linux/skbuff.h-1093-\tsk_buff_data_t\t\tend;\n"
} |
| 65/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26062 output: 36 thoughts: 442 Thoughts: **Analyzing the Initialization and Re-use of `skb->cb` during GSO Segmentation** Okay, so I'm looking at this `skb->cb` field and trying to understand its initialization and lifecycle, especially in the context of Generic Segmentation Offload (GSO). I see that `tail` is at line 1092 and `cb` is at line 919. Therefore, when `skbuff_clear` is called, it zeroes out everything from the beginning of `skb` all the way up to `tail`, which includes `cb`. So, fresh allocation means `cb` is definitely zeroed. But that's the *initial* state. The real concern is how `cb` gets handled when an `skb` is reused, or when it moves through different network layers. What data might linger in `cb`? I need to know how it's treated during GSO segmentation, so I'm diving into `__skb_gso_segment` in `net/core/gso.c`. Okay, I'm reading through this `__skb_gso_segment` function. Here, I spot `SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);`, `SKB_GSO_CB(skb)->encap_level = 0;`, and `SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);`. So these fields are explicitly initialized. Then, the `mac_header` and `mac_len` are reset. But where is `csum` and `csum_start` in `SKB_GSO_CB`? Let me scan the code around line 115 in `net/core/gso.c`. I need to figure out what happens to those checksum-related fields during the GSO process, since those can be critical. |
| 66/3 | 2026/10/01 10:08 | tool | read-file |
0mArgs:{
"File": "net/core/gso.c",
"FirstLine": 100,
"LineCount": 45
}Results: {
"Contents": " 100:\t\t\terr = skb_cow_head(skb, 0);\n 101:\t\t\tif (err \u003c 0)\n 102:\t\t\t\treturn ERR_PTR(err);\n 103:\t\t}\n 104:\t\n 105:\t\t/* Only report GSO partial support if it will enable us to\n 106:\t\t * support segmentation on this frame without needing additional\n 107:\t\t * work.\n 108:\t\t */\n 109:\t\tif (features \u0026 NETIF_F_GSO_PARTIAL) {\n 110:\t\t\tnetdev_features_t partial_features = NETIF_F_GSO_ROBUST;\n 111:\t\t\tstruct net_device *dev = skb-\u003edev;\n 112:\t\n 113:\t\t\tpartial_features |= dev-\u003efeatures \u0026 dev-\u003egso_partial_features;\n 114:\t\t\tif (!skb_gso_ok(skb, features | partial_features))\n 115:\t\t\t\tfeatures \u0026= ~NETIF_F_GSO_PARTIAL;\n 116:\t\t}\n 117:\t\n 118:\t\tBUILD_BUG_ON(SKB_GSO_CB_OFFSET +\n 119:\t\t\t sizeof(*SKB_GSO_CB(skb)) \u003e sizeof(skb-\u003ecb));\n 120:\t\n 121:\t\tSKB_GSO_CB(skb)-\u003emac_offset = skb_headroom(skb);\n 122:\t\tSKB_GSO_CB(skb)-\u003eencap_level = 0;\n 123:\t\tSKB_GSO_CB(skb)-\u003emax_segs = min(max_segs, GSO_MAX_SEGS);\n 124:\t\n 125:\t\tskb_reset_mac_header(skb);\n 126:\t\tskb_reset_mac_len(skb);\n 127:\t\n 128:\t\tsegs = skb_mac_gso_segment(skb, features);\n 129:\t\n 130:\t\tif (segs != skb \u0026\u0026 unlikely(skb_needs_check(skb, tx_path) \u0026\u0026 !IS_ERR(segs)))\n 131:\t\t\tskb_warn_bad_offload(skb);\n 132:\t\n 133:\t\treturn segs;\n 134:\t}\n 135:\tEXPORT_SYMBOL(__skb_gso_segment);\n 136:\t\n 137:\t/**\n 138:\t * skb_gso_transport_seglen - Return length of individual segments of a gso packet\n 139:\t *\n 140:\t * @skb: GSO skb\n 141:\t *\n 142:\t * skb_gso_transport_seglen is used to determine the real size of the\n 143:\t * individual segments, including Layer4 headers (TCP/UDP).\n 144:\t *\n"
} |
| 67/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 27737 output: 37 thoughts: 120 Thoughts: Here's my analysis of the code, as I understand it: **Digging into GSO and SKBs** Okay, so I'm looking at this code and something immediately jumps out at me around line 118: `BUILD_BUG_ON(SKB_GSO_CB_OFFSET + sizeof(*SKB_GSO_CB(skb)) > sizeof(skb->cb));`. It's a `BUILD_BUG_ON`, so it's a compile-time check, and what it's saying is, the size of the GSO control block plus its offset *must not* exceed the available space in `skb->cb`. That's fundamental; if it does, we're going to overrun the control block and memory corruption will ensue. Good to see this explicit safeguard. And, I see `SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);` is definitely initialized. Excellent. Now, my mind shifts to `skb_segment`. What's happening there? How are these GSO fields used? Let me quickly pull up `net/core/skbuff.c` and take a look around line 4790. I need to understand how this segmentation function is utilizing these control block fields I just reviewed, to ensure data is handled correctly during GSO operations. That's the key. |
| 68/3 | 2026/10/01 10:08 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 4790,
"LineCount": 60
}Results: {
"Contents": "4790:\tstruct sk_buff *skb_segment(struct sk_buff *head_skb,\n4791:\t\t\t\t netdev_features_t features)\n4792:\t{\n4793:\t\tstruct sk_buff *segs = NULL;\n4794:\t\tstruct sk_buff *tail = NULL;\n4795:\t\tstruct sk_buff *list_skb = skb_shinfo(head_skb)-\u003efrag_list;\n4796:\t\tunsigned int max_segs = SKB_GSO_CB(head_skb)-\u003emax_segs;\n4797:\t\tunsigned int mss = skb_shinfo(head_skb)-\u003egso_size;\n4798:\t\tbool gso_by_frags = mss == GSO_BY_FRAGS;\n4799:\t\tunsigned int doffset = head_skb-\u003edata - skb_mac_header(head_skb);\n4800:\t\tunsigned int offset = doffset;\n4801:\t\tunsigned int tnl_hlen = skb_tnl_header_len(head_skb);\n4802:\t\tunsigned int partial_segs = 0;\n4803:\t\tunsigned int headroom;\n4804:\t\tunsigned int len = head_skb-\u003elen;\n4805:\t\tstruct sk_buff *frag_skb;\n4806:\t\tskb_frag_t *frag;\n4807:\t\t__be16 proto;\n4808:\t\tbool csum, sg;\n4809:\t\tint err = -ENOMEM;\n4810:\t\tint i = 0;\n4811:\t\tint nfrags, pos;\n4812:\t\n4813:\t\tif ((skb_shinfo(head_skb)-\u003egso_type \u0026 SKB_GSO_DODGY) \u0026\u0026\n4814:\t\t !gso_by_frags \u0026\u0026 mss != skb_headlen(head_skb)) {\n4815:\t\t\tstruct sk_buff *check_skb;\n4816:\t\n4817:\t\t\tfor (check_skb = list_skb; check_skb; check_skb = check_skb-\u003enext) {\n4818:\t\t\t\tif (skb_headlen(check_skb) \u0026\u0026 !check_skb-\u003ehead_frag) {\n4819:\t\t\t\t\t/* gso_size is untrusted, and we have a frag_list with\n4820:\t\t\t\t\t * a linear non head_frag item.\n4821:\t\t\t\t\t *\n4822:\t\t\t\t\t * If head_skb's headlen does not fit requested gso_size,\n4823:\t\t\t\t\t * it means that the frag_list members do NOT terminate\n4824:\t\t\t\t\t * on exact gso_size boundaries. Hence we cannot perform\n4825:\t\t\t\t\t * skb_frag_t page sharing. Therefore we must fallback to\n4826:\t\t\t\t\t * copying the frag_list skbs; we do so by disabling SG.\n4827:\t\t\t\t\t */\n4828:\t\t\t\t\tfeatures \u0026= ~NETIF_F_SG;\n4829:\t\t\t\t\tbreak;\n4830:\t\t\t\t}\n4831:\t\t\t}\n4832:\t\t}\n4833:\t\n4834:\t\t__skb_push(head_skb, doffset);\n4835:\t\tproto = skb_network_protocol(head_skb, NULL);\n4836:\t\tif (unlikely(!proto))\n4837:\t\t\treturn ERR_PTR(-EINVAL);\n4838:\t\n4839:\t\tsg = !!(features \u0026 NETIF_F_SG);\n4840:\t\tcsum = !!can_checksum_protocol(features, proto);\n4841:\t\n4842:\t\tif (sg \u0026\u0026 csum \u0026\u0026 !gso_by_frags) {\n4843:\t\t\tif (!max_segs \u0026\u0026 !(features \u0026 NETIF_F_GSO_PARTIAL)) {\n4844:\t\t\t\tstruct sk_buff *iter;\n4845:\t\t\t\tunsigned int frag_len;\n4846:\t\n4847:\t\t\t\tif (!list_skb ||\n4848:\t\t\t\t !net_gso_ok(features, skb_shinfo(head_skb)-\u003egso_type))\n4849:\t\t\t\t\tgoto normal;\n"
} |
| 69/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 29308 output: 35 thoughts: 2170 Thoughts: **Analyzing Potential KMSAN Issues in `skb_segment`** Okay, let's break this down. I'm looking at `skb_segment` and specifically, that `max_segs` variable within it. The key question is, where does `head_skb` come from, and how is its GSO control block initialized, especially in cases where we might be calling `skb_segment` directly, bypassing the usual `__skb_gso_segment` path. My concern stems from the possibility of uninitialized memory being read. The standard GSO path uses `__skb_gso_segment`, which sets the `max_segs` field in the SKB's control block. However, I need to understand what happens if a function like `skb_segment()` is called directly, since the value in the control block might not be initialized, leading to undefined behavior. I am thinking about how values are set in `SKB_GSO_CB(skb)->max_segs`. I've traced the callers of `skb_segment`. I see cases where `max_segs` is explicitly set (e.g., `net/core/net_test.c`). I also see calls from within the standard GSO functions (e.g., `tcp_gso_segment`, `udp4_ufo_fragment`), where `__skb_gso_segment` should have already taken care of initializing `max_segs`. But then, there's `test_skb_segment_single` in `lib/test_bpf.c` where `dev_alloc_skb()` is used, and it explicitly clears `cb`, meaning `max_segs` is zero. The next point I need to check is `skb_gso_output_max_segs`. I'm going through this function line-by-line now to check how this function works. I'm focusing on the calculations within, specifically regarding the `hdr_len`, `mss`, and `max_segs` variables. I'm checking each step, making sure that `mss` is never zero, and that we are not reading unitialized values. I was briefly concerned that an `mss == 0` could cause a division by zero. However, that would be caught by standard detectors. My real concern is the potential for uninitialized memory usage, which is why I'm looking for KMSAN issues. KMSAN detects reads of uninitialized memory. I'm looking for where we copy data to user space. I'm reviewing the KMSAN criteria, specifically looking at any code paths where potentially uninitialized variables could be read, or where kernel structures are being sent to user space via copy_to_user, netlink, or the like. I'm now focusing on the `tap_handle_frame` function. I see that `__skb_gso_segment` is called, and a zero is being passed for `max_segs`. I'm now checking if the TAP device could be a way to expose uninitialized data since TAP reads packets to user space. If `skb_segment` were to copy unitialized memory to user space, this is a potential issue. I must check the processing of segments to ensure no memory leaks or issues. |
| 70/3 | 2026/10/01 10:08 | tool | read-file |
0mArgs:{
"File": "drivers/net/tap.c",
"FirstLine": 275,
"LineCount": 45
}Results: {
"Contents": " 275:\t\t * according to users wishes. This only works if VNET_HDR is\n 276:\t\t * enabled.\n 277:\t\t */\n 278:\t\tif (q-\u003eflags \u0026 IFF_VNET_HDR)\n 279:\t\t\tfeatures |= tap-\u003etap_features;\n 280:\t\tif (netif_needs_gso(skb, features)) {\n 281:\t\t\tstruct sk_buff *segs;\n 282:\t\t\tstruct sk_buff *next;\n 283:\t\n 284:\t\t\tsegs = __skb_gso_segment(skb, features, false, 0);\n 285:\t\t\tif (IS_ERR(segs)) {\n 286:\t\t\t\tdrop_reason = SKB_DROP_REASON_SKB_GSO_SEG;\n 287:\t\t\t\tgoto drop;\n 288:\t\t\t}\n 289:\t\n 290:\t\t\tif (!segs) {\n 291:\t\t\t\tif (ptr_ring_produce(\u0026q-\u003ering, skb)) {\n 292:\t\t\t\t\tdrop_reason = SKB_DROP_REASON_FULL_RING;\n 293:\t\t\t\t\tgoto drop;\n 294:\t\t\t\t}\n 295:\t\t\t\tgoto wake_up;\n 296:\t\t\t}\n 297:\t\n 298:\t\t\tconsume_skb(skb);\n 299:\t\t\tskb_list_walk_safe(segs, skb, next) {\n 300:\t\t\t\tskb_mark_not_on_list(skb);\n 301:\t\t\t\tif (ptr_ring_produce(\u0026q-\u003ering, skb)) {\n 302:\t\t\t\t\tdrop_reason = SKB_DROP_REASON_FULL_RING;\n 303:\t\t\t\t\tkfree_skb_reason(skb, drop_reason);\n 304:\t\t\t\t\tkfree_skb_list_reason(next, drop_reason);\n 305:\t\t\t\t\tbreak;\n 306:\t\t\t\t}\n 307:\t\t\t}\n 308:\t\t} else {\n 309:\t\t\t/* If we receive a partial checksum and the tap side\n 310:\t\t\t * doesn't support checksum offload, compute the checksum.\n 311:\t\t\t * Note: it doesn't matter which checksum feature to\n 312:\t\t\t *\t check, we either support them all or none.\n 313:\t\t\t */\n 314:\t\t\tif (skb-\u003eip_summed == CHECKSUM_PARTIAL \u0026\u0026\n 315:\t\t\t !(features \u0026 NETIF_F_CSUM_MASK) \u0026\u0026\n 316:\t\t\t skb_checksum_help(skb)) {\n 317:\t\t\t\tdrop_reason = SKB_DROP_REASON_SKB_CSUM;\n 318:\t\t\t\tgoto drop;\n 319:\t\t\t}\n"
} |
| 71/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32959 output: 19 thoughts: 330 Thoughts: **Analyzing Potential Uninitialized Variable Issues in the GSO Segmentation Path** Okay, so I'm digging into this TAP issue, and it looks like `max_segs` is being passed as 0, which doesn't change anything, that's fine. My main concern is Point 2: possible branching or conditional logic based on uninitialized variables, or struct fields. I'm focusing on `SKB_GSO_CB(skb)->max_segs`. I need to figure out if there's a chance this value could be read before it's written, a classic initialization bug. Let's start by tracing its usage. I see that `SKB_GSO_CB(head_skb)->max_segs` is read in `skb_segment`, specifically this line: `unsigned int max_segs = SKB_GSO_CB(head_skb)->max_segs;`. Now, where is it written? I find it's written in `__skb_gso_segment`: `SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);`. Aha! Here's the potential issue. What if `skb_segment` is called *without* a corresponding call to `__skb_gso_segment`? That's what I need to verify. I need to make sure `max_segs` is always initialized before it's read. So, I need to check every single place `skb_segment` is called. Let's look at the call sites. The first hit is in `tcp_gso_segment` within `net/ipv4/tcp_offload.c`. This is called from `inet_gso_segment`, which is the .gso_segment handler for both IPv4 and IPv6. That's a good start. I need to find all the places that call the `.gso_segment` function. To be thorough, I'll `grep` for both `.gso_segment` and `gso_segment` to cover all my bases. I need to verify that in every case, `__skb_gso_segment` is called *before* `skb_segment` to ensure that `SKB_GSO_CB(skb)->max_segs` is initialized. |
| 72/3 | 2026/10/01 10:08 | tool | grepper |
0mError:no matches Args: {
"Expression": "-\u003egso_segment"
}Results: {
"error": "no matches"
} |
| 73/3 | 2026/10/01 10:08 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 33841 output: 19 thoughts: 12 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing the Callers of `gso_segment`** Alright, so the task at hand is to pinpoint the callers of the `gso_segment` function. This isn't just a casual exercise; we're likely chasing down performance bottlenecks, debugging a subtle issue related to segmentation offload, or maybe even investigating security vulnerabilities related to how this function is used. The context matters, obviously. Knowing *why* we're interested will drive the appropriate level of depth in the investigation. My initial thought is to go about this methodically. I'll need to leverage all the tools at my disposal – the debugger, static analysis, maybe even some dynamic instrumentation if static methods fall short. I’ll start with a straightforward call graph search across the relevant codebase. I'm assuming we have access to the source code; otherwise, this becomes exponentially more complex. I'll need to be mindful of indirect calls via function pointers, macros that might expand into calls to `gso_segment`, and any conditional compilation that might affect when this function is actually invoked. From there, I'll need to carefully inspect each caller. What's the context? What data is being passed in? How is the returned data from `gso_segment` being used? I’ll be looking for potential race conditions, buffer overflows (especially if we're dealing with packet data), or inefficient implementations that could be optimized. Also, I need to look for any logic that might bypass the normal GSO flow. I know that depending on the NIC, and even the hardware configuration, some calls to `gso_segment` may behave differently based on the driver configuration. I need to quickly assess the complexity of the calling functions. Are they simple, well-defined routines, or sprawling, convoluted code blocks? The more complex, the higher the likelihood of subtle bugs. I should also be mindful of the possible interactions with other kernel subsystems or network stacks. A small change in `gso_segment` can have cascading effects in other subsystems, so I need to be aware of the dependencies. It's time to dig in! |
| 74/3 | 2026/10/01 10:09 | tool | grepper |
0mArgs:{
"Expression": "gso_segment\\("
}Results: {
"Output": "\nFull output is too long, showing 200 out of 469 lines.\nUse more precise expression if possible.\n\ndrivers/net/ethernet/broadcom/tg3.c=7922=static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,\n--\ndrivers/net/ethernet/broadcom/tg3.c-7943-\ndrivers/net/ethernet/broadcom/tg3.c:7944:\tsegs = skb_gso_segment(skb, tp-\u003edev-\u003efeatures \u0026\ndrivers/net/ethernet/broadcom/tg3.c-7945-\t\t\t\t ~(NETIF_F_TSO | NETIF_F_TSO6));\n--\ndrivers/net/ethernet/myricom/myri10ge/myri10ge.c=2912=static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb,\n--\ndrivers/net/ethernet/myricom/myri10ge/myri10ge.c-2919-\ndrivers/net/ethernet/myricom/myri10ge/myri10ge.c:2920:\tsegs = skb_gso_segment(skb, dev-\u003efeatures \u0026 ~NETIF_F_TSO6);\ndrivers/net/ethernet/myricom/myri10ge/myri10ge.c-2921-\tif (IS_ERR(segs))\n--\ndrivers/net/ethernet/sfc/siena/tx_common.c=430=int efx_siena_tx_tso_fallback(struct efx_tx_queue *tx_queue,\n--\ndrivers/net/ethernet/sfc/siena/tx_common.c-434-\ndrivers/net/ethernet/sfc/siena/tx_common.c:435:\tsegments = skb_gso_segment(skb, 0);\ndrivers/net/ethernet/sfc/siena/tx_common.c-436-\tif (IS_ERR(segments))\n--\ndrivers/net/ethernet/sfc/tx_common.c=471=int efx_tx_tso_fallback(struct efx_tx_queue *tx_queue, struct sk_buff *skb)\n--\ndrivers/net/ethernet/sfc/tx_common.c-474-\ndrivers/net/ethernet/sfc/tx_common.c:475:\tsegments = skb_gso_segment(skb, 0);\ndrivers/net/ethernet/sfc/tx_common.c-476-\tif (IS_ERR(segments))\n--\ndrivers/net/ethernet/sun/sunvnet_common.c=1221=vnet_handle_offloads(struct vnet_port *port, struct sk_buff *skb,\n--\ndrivers/net/ethernet/sun/sunvnet_common.c-1277-\t}\ndrivers/net/ethernet/sun/sunvnet_common.c:1278:\tsegs = skb_gso_segment(skb, dev-\u003efeatures \u0026 ~NETIF_F_TSO);\ndrivers/net/ethernet/sun/sunvnet_common.c-1279-\tif (IS_ERR(segs))\n--\ndrivers/net/ovpn/io.c=356=netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)\n--\ndrivers/net/ovpn/io.c-394-\tif (skb_is_gso(skb)) {\ndrivers/net/ovpn/io.c:395:\t\tsegments = skb_gso_segment(skb, 0);\ndrivers/net/ovpn/io.c-396-\t\tif (IS_ERR(segments)) {\n--\ndrivers/net/ppp/pppoe.c=1178=static int pppoe_gro_complete(struct sk_buff *skb, int nhoff)\n--\ndrivers/net/ppp/pppoe.c-1197-\ndrivers/net/ppp/pppoe.c:1198:static struct sk_buff *pppoe_gso_segment(struct sk_buff *skb,\ndrivers/net/ppp/pppoe.c-1199-\t\t\t\t\t netdev_features_t features)\n--\ndrivers/net/ppp/pppoe.c-1221-\tfeatures \u0026= ~NETIF_F_GSO_SOFTWARE;\ndrivers/net/ppp/pppoe.c:1222:\tsegs = ptype-\u003ecallbacks.gso_segment(skb, features);\ndrivers/net/ppp/pppoe.c-1223-\tif (IS_ERR_OR_NULL(segs))\n--\ndrivers/net/tap.c=255=rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)\n--\ndrivers/net/tap.c-283-\ndrivers/net/tap.c:284:\t\tsegs = __skb_gso_segment(skb, features, false, 0);\ndrivers/net/tap.c-285-\t\tif (IS_ERR(segs)) {\n--\ndrivers/net/usb/r8152.c=2539=static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb,\n--\ndrivers/net/usb/r8152.c-2547-\t\tfeatures \u0026= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6);\ndrivers/net/usb/r8152.c:2548:\t\tsegs = skb_gso_segment(skb, features);\ndrivers/net/usb/r8152.c-2549-\t\tif (IS_ERR(segs) || !segs)\n--\ndrivers/net/wireguard/device.c=137=static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev)\n--\ndrivers/net/wireguard/device.c-178-\t} else {\ndrivers/net/wireguard/device.c:179:\t\tstruct sk_buff *segs = skb_gso_segment(skb, 0);\ndrivers/net/wireguard/device.c-180-\n--\ndrivers/net/wireless/intel/iwlwifi/iwl-utils.c=13=int iwl_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,\n--\ndrivers/net/wireless/intel/iwlwifi/iwl-utils.c-29-\ndrivers/net/wireless/intel/iwlwifi/iwl-utils.c:30:\tnext = skb_gso_segment(skb, netdev_flags);\ndrivers/net/wireless/intel/iwlwifi/iwl-utils.c-31-\tskb_shinfo(skb)-\u003egso_size = mss;\n--\ninclude/net/gso.h=66=static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)\n--\ninclude/net/gso.h-77-\ninclude/net/gso.h:78:struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\ninclude/net/gso.h-79-\t\t\t\t netdev_features_t features, bool tx_path,\n--\ninclude/net/gso.h-81-\ninclude/net/gso.h:82:static inline struct sk_buff *skb_gso_segment(struct sk_buff *skb,\ninclude/net/gso.h-83-\t\t\t\t\t netdev_features_t features)\ninclude/net/gso.h-84-{\ninclude/net/gso.h:85:\treturn __skb_gso_segment(skb, features, true, 0);\ninclude/net/gso.h-86-}\ninclude/net/gso.h-87-\ninclude/net/gso.h:88:struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb,\ninclude/net/gso.h-89-\t\t\t\t netdev_features_t features, __be16 type);\ninclude/net/gso.h-90-\ninclude/net/gso.h:91:struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,\ninclude/net/gso.h-92-\t\t\t\t netdev_features_t features);\n--\ninclude/net/inet_common.h=65=int inet_gro_complete(struct sk_buff *skb, int nhoff);\ninclude/net/inet_common.h:66:struct sk_buff *inet_gso_segment(struct sk_buff *skb,\ninclude/net/inet_common.h-67-\t\t\t\t netdev_features_t features);\n--\ninclude/net/tcp.h=2440=void tcp_v4_destroy_sock(struct sock *sk);\ninclude/net/tcp.h-2441-\ninclude/net/tcp.h:2442:struct sk_buff *tcp_gso_segment(struct sk_buff *skb,\ninclude/net/tcp.h-2443-\t\t\t\tnetdev_features_t features);\n--\ninclude/net/udp.h=279=INDIRECT_CALLABLE_DECLARE(int udpv6_recvmsg(struct sock *sk, struct msghdr *msg,\n--\ninclude/net/udp.h-281-\ninclude/net/udp.h:282:struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,\ninclude/net/udp.h-283-\t\t\t\t netdev_features_t features, bool is_ipv6);\n--\ninclude/net/udp.h=580=static inline struct sk_buff *udp_rcv_segment(struct sock *sk,\n--\ninclude/net/udp.h-615-\t */\ninclude/net/udp.h:616:\tsegs = __skb_gso_segment(skb, features, false, 0);\ninclude/net/udp.h-617-\tif (IS_ERR_OR_NULL(segs)) {\n--\nnet/core/dev.c=4173=static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev, bool *again)\n--\nnet/core/dev.c-4196-\nnet/core/dev.c:4197:\t\tsegs = __skb_gso_segment(skb, features, true, max_segs);\nnet/core/dev.c-4198-\t\tif (IS_ERR(segs)) {\n--\nnet/core/gso.c-12- */\nnet/core/gso.c:13:struct sk_buff *skb_eth_gso_segment(struct sk_buff *skb,\nnet/core/gso.c-14-\t\t\t\t netdev_features_t features, __be16 type)\n--\nnet/core/gso.c-21-\t\tif (ptype-\u003etype == type \u0026\u0026 ptype-\u003ecallbacks.gso_segment) {\nnet/core/gso.c:22:\t\t\tsegs = ptype-\u003ecallbacks.gso_segment(skb, features);\nnet/core/gso.c-23-\t\t\tbreak;\n--\nnet/core/gso.c=30=EXPORT_SYMBOL(skb_eth_gso_segment);\n--\nnet/core/gso.c-36- */\nnet/core/gso.c:37:struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,\nnet/core/gso.c-38-\t\t\t\t netdev_features_t features)\n--\nnet/core/gso.c-52-\t\tif (ptype-\u003etype == type \u0026\u0026 ptype-\u003ecallbacks.gso_segment) {\nnet/core/gso.c:53:\t\t\tsegs = ptype-\u003ecallbacks.gso_segment(skb, features);\nnet/core/gso.c-54-\t\t\tbreak;\n--\nnet/core/gso.c=66=static bool skb_needs_check(const struct sk_buff *skb, bool tx_path)\n--\nnet/core/gso.c-89- */\nnet/core/gso.c:90:struct sk_buff *__skb_gso_segment(struct sk_buff *skb,\nnet/core/gso.c-91-\t\t\t\t netdev_features_t features, bool tx_path,\n--\nnet/core/gso.c-127-\nnet/core/gso.c:128:\tsegs = skb_mac_gso_segment(skb, features);\nnet/core/gso.c-129-\n--\nnet/core/net_test.c=382=static void gso_test_tcp_resegment(struct kunit *test)\n--\nnet/core/net_test.c-401-\nnet/core/net_test.c:402:\tsegs = __skb_gso_segment(skb, features, true, max_segs);\nnet/core/net_test.c-403-\tif (IS_ERR_OR_NULL(segs)) {\n--\nnet/ipv4/af_inet.c=1355=void inet_sk_state_store(struct sock *sk, int newstate)\n--\nnet/ipv4/af_inet.c-1360-\nnet/ipv4/af_inet.c:1361:struct sk_buff *inet_gso_segment(struct sk_buff *skb,\nnet/ipv4/af_inet.c-1362-\t\t\t\t netdev_features_t features)\n--\nnet/ipv4/af_inet.c-1407-\tif (likely(ops \u0026\u0026 ops-\u003ecallbacks.gso_segment)) {\nnet/ipv4/af_inet.c:1408:\t\tsegs = ops-\u003ecallbacks.gso_segment(skb, features);\nnet/ipv4/af_inet.c-1409-\t\tif (!segs)\n--\nnet/ipv4/af_inet.c-1455-\nnet/ipv4/af_inet.c:1456:static struct sk_buff *ipip_gso_segment(struct sk_buff *skb,\nnet/ipv4/af_inet.c-1457-\t\t\t\t\tnetdev_features_t features)\n--\nnet/ipv4/af_inet.c-1461-\nnet/ipv4/af_inet.c:1462:\treturn inet_gso_segment(skb, features);\nnet/ipv4/af_inet.c-1463-}\n--\nnet/ipv4/esp4_offload.c=104=static void esp4_gso_encap(struct xfrm_state *x, struct sk_buff *skb)\n--\nnet/ipv4/esp4_offload.c-120-\nnet/ipv4/esp4_offload.c:121:static struct sk_buff *xfrm4_tunnel_gso_segment(struct xfrm_state *x,\nnet/ipv4/esp4_offload.c-122-\t\t\t\t\t\tstruct sk_buff *skb,\n--\nnet/ipv4/esp4_offload.c-129-\nnet/ipv4/esp4_offload.c:130:\treturn skb_eth_gso_segment(skb, features, type);\nnet/ipv4/esp4_offload.c-131-}\nnet/ipv4/esp4_offload.c-132-\nnet/ipv4/esp4_offload.c:133:static struct sk_buff *xfrm4_transport_gso_segment(struct xfrm_state *x,\nnet/ipv4/esp4_offload.c-134-\t\t\t\t\t\t struct sk_buff *skb,\n--\nnet/ipv4/esp4_offload.c-143-\tif (likely(ops \u0026\u0026 ops-\u003ecallbacks.gso_segment))\nnet/ipv4/esp4_offload.c:144:\t\tsegs = ops-\u003ecallbacks.gso_segment(skb, features);\nnet/ipv4/esp4_offload.c-145-\n--\nnet/ipv4/esp4_offload.c-148-\nnet/ipv4/esp4_offload.c:149:static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x,\nnet/ipv4/esp4_offload.c-150-\t\t\t\t\t struct sk_buff *skb,\n--\nnet/ipv4/esp4_offload.c-184-\tif (likely(ops \u0026\u0026 ops-\u003ecallbacks.gso_segment))\nnet/ipv4/esp4_offload.c:185:\t\tsegs = ops-\u003ecallbacks.gso_segment(skb, features);\nnet/ipv4/esp4_offload.c-186-\n--\nnet/ipv4/esp4_offload.c-189-\nnet/ipv4/esp4_offload.c:190:static struct sk_buff *xfrm4_outer_mode_gso_segment(struct xfrm_state *x,\nnet/ipv4/esp4_offload.c-191-\t\t\t\t\t\t struct sk_buff *skb,\n--\nnet/ipv4/esp4_offload.c-195-\tcase XFRM_MODE_TUNNEL:\nnet/ipv4/esp4_offload.c:196:\t\treturn xfrm4_tunnel_gso_segment(x, skb, features);\nnet/ipv4/esp4_offload.c-197-\tcase XFRM_MODE_TRANSPORT:\n\n"
} |
| 75/3 | 2026/10/01 10:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38861 output: 30 thoughts: 234 Thoughts: **GSO Segmentation Deep Dive** Okay, so I'm looking at GSO segmentation, and the key thing that jumps out is that *everything* seems to funnel through either `skb_gso_segment` or `__skb_gso_segment`. `skb_gso_segment` is an inline function, so it's practically a wrapper for `__skb_gso_segment`, with the call `__skb_gso_segment(skb, features, true, 0)`. That makes it the central point. Now, inside `__skb_gso_segment`, I see this line: `SKB_GSO_CB(skb)->max_segs = min(max_segs, GSO_MAX_SEGS);`. Aha! That means `SKB_GSO_CB(skb)->max_segs` *always* gets initialized before any further segmentation steps. Which is good to know. It's essentially setting the maximum segment count, capped by `GSO_MAX_SEGS`. So, what happens *after* that initialization? The segmentation eventually goes through `skb_mac_gso_segment` -> `ptype->callbacks.gso_segment` -> `skb_segment`. Got it. But... hang on. What about the segments that `skb_segment` itself *creates*? I need to understand what happens to *those* new SKBs (the `nskb` or `tail` variables). I need to check how they're handled. Let's head over to `net/core/skbuff.c` and dig into `skb_segment` itself. This feels like a critical detail I'm missing! |
| 76/3 | 2026/10/01 10:09 | tool | grepper |
0mArgs:{
"Expression": "nskb",
"PathPrefix": "net/core/skbuff.c"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 265 lines.\nUse more precise expression if possible.\n\nnet/core/skbuff.c=942=int skb_pp_cow_data(struct page_pool *pool, struct sk_buff **pskb,\n--\nnet/core/skbuff.c-946-\tu32 size, truesize, len, max_head_size, off;\nnet/core/skbuff.c:947:\tstruct sk_buff *skb = *pskb, *nskb;\nnet/core/skbuff.c-948-\tint err, i, head_off;\n--\nnet/core/skbuff.c-960-\nnet/core/skbuff.c:961:\tnskb = napi_build_skb(data, truesize);\nnet/core/skbuff.c:962:\tif (!nskb) {\nnet/core/skbuff.c-963-\t\tpage_pool_free_va(pool, data, true);\n--\nnet/core/skbuff.c-966-\nnet/core/skbuff.c:967:\tskb_reserve(nskb, headroom);\nnet/core/skbuff.c:968:\tskb_copy_header(nskb, skb);\nnet/core/skbuff.c:969:\tskb_mark_for_recycle(nskb);\nnet/core/skbuff.c-970-\nnet/core/skbuff.c:971:\terr = skb_copy_bits(skb, 0, nskb-\u003edata, size);\nnet/core/skbuff.c-972-\tif (err) {\nnet/core/skbuff.c:973:\t\tconsume_skb(nskb);\nnet/core/skbuff.c-974-\t\treturn err;\nnet/core/skbuff.c-975-\t}\nnet/core/skbuff.c:976:\tskb_put(nskb, size);\nnet/core/skbuff.c-977-\nnet/core/skbuff.c:978:\thead_off = skb_headroom(nskb) - skb_headroom(skb);\nnet/core/skbuff.c:979:\tskb_headers_offset_update(nskb, head_off);\nnet/core/skbuff.c-980-\n--\nnet/core/skbuff.c-991-\t\tif (!page) {\nnet/core/skbuff.c:992:\t\t\tconsume_skb(nskb);\nnet/core/skbuff.c-993-\t\t\treturn -ENOMEM;\n--\nnet/core/skbuff.c-995-\nnet/core/skbuff.c:996:\t\tskb_add_rx_frag(nskb, i, page, page_off, size, truesize);\nnet/core/skbuff.c-997-\t\terr = skb_copy_bits(skb, off, page_address(page) + page_off,\n--\nnet/core/skbuff.c-999-\t\tif (err) {\nnet/core/skbuff.c:1000:\t\t\tconsume_skb(nskb);\nnet/core/skbuff.c-1001-\t\t\treturn err;\n--\nnet/core/skbuff.c-1008-\tconsume_skb(skb);\nnet/core/skbuff.c:1009:\t*pskb = nskb;\nnet/core/skbuff.c-1010-\n--\nnet/core/skbuff.c=1963=EXPORT_SYMBOL_GPL(__skb_zcopy_downgrade_managed);\nnet/core/skbuff.c-1964-\nnet/core/skbuff.c:1965:static int skb_zerocopy_clone(struct sk_buff *nskb, struct sk_buff *orig,\nnet/core/skbuff.c-1966-\t\t\t gfp_t gfp_mask)\n--\nnet/core/skbuff.c-1968-\tif (skb_zcopy(orig)) {\nnet/core/skbuff.c:1969:\t\tif (skb_zcopy(nskb)) {\nnet/core/skbuff.c:1970:\t\t\t/* !gfp_mask callers are verified to !skb_zcopy(nskb) */\nnet/core/skbuff.c-1971-\t\t\tif (!gfp_mask) {\n--\nnet/core/skbuff.c-1974-\t\t\t}\nnet/core/skbuff.c:1975:\t\t\tif (skb_uarg(nskb) == skb_uarg(orig))\nnet/core/skbuff.c-1976-\t\t\t\treturn 0;\nnet/core/skbuff.c:1977:\t\t\tif (skb_copy_ubufs(nskb, GFP_ATOMIC))\nnet/core/skbuff.c-1978-\t\t\t\treturn -EIO;\nnet/core/skbuff.c-1979-\t\t}\nnet/core/skbuff.c:1980:\t\tskb_zcopy_set(nskb, skb_uarg(orig), NULL);\nnet/core/skbuff.c-1981-\t}\n--\nnet/core/skbuff.c=2448=struct sk_buff *skb_expand_head(struct sk_buff *skb, unsigned int headroom)\n--\nnet/core/skbuff.c-2460-\tif (skb_shared(skb) || !is_skb_wmem(skb)) {\nnet/core/skbuff.c:2461:\t\tstruct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);\nnet/core/skbuff.c-2462-\nnet/core/skbuff.c:2463:\t\tif (unlikely(!nskb))\nnet/core/skbuff.c-2464-\t\t\tgoto fail;\n--\nnet/core/skbuff.c-2466-\t\tif (sk)\nnet/core/skbuff.c:2467:\t\t\tskb_set_owner_w(nskb, sk);\nnet/core/skbuff.c-2468-\t\tconsume_skb(skb);\nnet/core/skbuff.c:2469:\t\tskb = nskb;\nnet/core/skbuff.c-2470-\t}\n--\nnet/core/skbuff.c=4687=struct sk_buff *skb_segment_list(struct sk_buff *skb,\n--\nnet/core/skbuff.c-4694-\tstruct sk_buff *tail = NULL;\nnet/core/skbuff.c:4695:\tstruct sk_buff *nskb, *tmp;\nnet/core/skbuff.c-4696-\tint len_diff, err;\n--\nnet/core/skbuff.c-4710-\twhile (list_skb) {\nnet/core/skbuff.c:4711:\t\tnskb = list_skb;\nnet/core/skbuff.c-4712-\t\tlist_skb = list_skb-\u003enext;\nnet/core/skbuff.c-4713-\nnet/core/skbuff.c:4714:\t\tDEBUG_NET_WARN_ON_ONCE(nskb-\u003esk);\nnet/core/skbuff.c-4715-\nnet/core/skbuff.c-4716-\t\terr = 0;\nnet/core/skbuff.c:4717:\t\tif (skb_shared(nskb)) {\nnet/core/skbuff.c:4718:\t\t\ttmp = skb_clone(nskb, GFP_ATOMIC);\nnet/core/skbuff.c-4719-\t\t\tif (tmp) {\nnet/core/skbuff.c:4720:\t\t\t\tconsume_skb(nskb);\nnet/core/skbuff.c:4721:\t\t\t\tnskb = tmp;\nnet/core/skbuff.c:4722:\t\t\t\terr = skb_unclone(nskb, GFP_ATOMIC);\nnet/core/skbuff.c-4723-\t\t\t} else {\n--\nnet/core/skbuff.c-4728-\t\tif (!tail)\nnet/core/skbuff.c:4729:\t\t\tskb-\u003enext = nskb;\nnet/core/skbuff.c-4730-\t\telse\nnet/core/skbuff.c:4731:\t\t\ttail-\u003enext = nskb;\nnet/core/skbuff.c-4732-\nnet/core/skbuff.c-4733-\t\tif (unlikely(err)) {\nnet/core/skbuff.c:4734:\t\t\tnskb-\u003enext = list_skb;\nnet/core/skbuff.c-4735-\t\t\tgoto err_linearize;\n--\nnet/core/skbuff.c-4737-\nnet/core/skbuff.c:4738:\t\ttail = nskb;\nnet/core/skbuff.c-4739-\nnet/core/skbuff.c:4740:\t\tdelta_len += nskb-\u003elen;\nnet/core/skbuff.c-4741-\nnet/core/skbuff.c:4742:\t\tskb_push(nskb, -skb_network_offset(nskb) + offset);\nnet/core/skbuff.c-4743-\nnet/core/skbuff.c:4744:\t\tskb_release_head_state(nskb);\nnet/core/skbuff.c:4745:\t\tlen_diff = skb_network_header_len(nskb) - skb_network_header_len(skb);\nnet/core/skbuff.c:4746:\t\t__copy_skb_header(nskb, skb);\nnet/core/skbuff.c-4747-\nnet/core/skbuff.c:4748:\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - skb_headroom(skb));\nnet/core/skbuff.c:4749:\t\tnskb-\u003etransport_header += len_diff;\nnet/core/skbuff.c-4750-\t\tskb_copy_from_linear_data_offset(skb, -tnl_hlen,\nnet/core/skbuff.c:4751:\t\t\t\t\t\t nskb-\u003edata - tnl_hlen,\nnet/core/skbuff.c-4752-\t\t\t\t\t\t offset + tnl_hlen);\nnet/core/skbuff.c-4753-\nnet/core/skbuff.c:4754:\t\tif (skb_needs_linearize(nskb, features) \u0026\u0026\nnet/core/skbuff.c:4755:\t\t __skb_linearize(nskb))\nnet/core/skbuff.c-4756-\t\t\tgoto err_linearize;\n--\nnet/core/skbuff.c=4790=struct sk_buff *skb_segment(struct sk_buff *head_skb,\n--\nnet/core/skbuff.c-4899-\tdo {\nnet/core/skbuff.c:4900:\t\tstruct sk_buff *nskb;\nnet/core/skbuff.c:4901:\t\tskb_frag_t *nskb_frag;\nnet/core/skbuff.c-4902-\t\tint hsize;\n--\nnet/core/skbuff.c-4918-\nnet/core/skbuff.c:4919:\t\t\tnskb = skb_clone(list_skb, GFP_ATOMIC);\nnet/core/skbuff.c:4920:\t\t\tif (unlikely(!nskb))\nnet/core/skbuff.c-4921-\t\t\t\tgoto err;\n--\nnet/core/skbuff.c-4942-\nnet/core/skbuff.c:4943:\t\t\tif (unlikely(pskb_trim(nskb, len))) {\nnet/core/skbuff.c:4944:\t\t\t\tkfree_skb(nskb);\nnet/core/skbuff.c-4945-\t\t\t\tgoto err;\n--\nnet/core/skbuff.c-4947-\nnet/core/skbuff.c:4948:\t\t\thsize = skb_end_offset(nskb);\nnet/core/skbuff.c:4949:\t\t\tif (skb_cow_head(nskb, doffset + headroom)) {\nnet/core/skbuff.c:4950:\t\t\t\tkfree_skb(nskb);\nnet/core/skbuff.c-4951-\t\t\t\tgoto err;\n--\nnet/core/skbuff.c-4953-\nnet/core/skbuff.c:4954:\t\t\tnskb-\u003etruesize += skb_end_offset(nskb) - hsize;\nnet/core/skbuff.c:4955:\t\t\tskb_release_head_state(nskb);\nnet/core/skbuff.c:4956:\t\t\t__skb_push(nskb, doffset);\nnet/core/skbuff.c-4957-\t\t} else {\n--\nnet/core/skbuff.c-4962-\nnet/core/skbuff.c:4963:\t\t\tnskb = __alloc_skb(hsize + doffset + headroom,\nnet/core/skbuff.c-4964-\t\t\t\t\t GFP_ATOMIC, skb_alloc_rx_flag(head_skb),\n--\nnet/core/skbuff.c-4966-\nnet/core/skbuff.c:4967:\t\t\tif (unlikely(!nskb))\nnet/core/skbuff.c-4968-\t\t\t\tgoto err;\nnet/core/skbuff.c-4969-\nnet/core/skbuff.c:4970:\t\t\tskb_reserve(nskb, headroom);\nnet/core/skbuff.c:4971:\t\t\t__skb_put(nskb, doffset);\nnet/core/skbuff.c-4972-\t\t}\n--\nnet/core/skbuff.c-4974-\t\tif (segs)\nnet/core/skbuff.c:4975:\t\t\ttail-\u003enext = nskb;\nnet/core/skbuff.c-4976-\t\telse\nnet/core/skbuff.c:4977:\t\t\tsegs = nskb;\nnet/core/skbuff.c:4978:\t\ttail = nskb;\nnet/core/skbuff.c-4979-\nnet/core/skbuff.c:4980:\t\t__copy_skb_header(nskb, head_skb);\nnet/core/skbuff.c-4981-\nnet/core/skbuff.c:4982:\t\tskb_headers_offset_update(nskb, skb_headroom(nskb) - headroom);\nnet/core/skbuff.c:4983:\t\tskb_reset_mac_len(nskb);\nnet/core/skbuff.c-4984-\nnet/core/skbuff.c-4985-\t\tskb_copy_from_linear_data_offset(head_skb, -tnl_hlen,\nnet/core/skbuff.c:4986:\t\t\t\t\t\t nskb-\u003edata - tnl_hlen,\nnet/core/skbuff.c-4987-\t\t\t\t\t\t doffset + tnl_hlen);\nnet/core/skbuff.c-4988-\nnet/core/skbuff.c:4989:\t\tif (nskb-\u003elen == len + doffset)\nnet/core/skbuff.c-4990-\t\t\tgoto perform_csum_check;\n--\nnet/core/skbuff.c-4993-\t\t\tif (!csum) {\nnet/core/skbuff.c:4994:\t\t\t\tif (!nskb-\u003eremcsum_offload)\nnet/core/skbuff.c:4995:\t\t\t\t\tnskb-\u003eip_summed = CHECKSUM_NONE;\nnet/core/skbuff.c:4996:\t\t\t\tSKB_GSO_CB(nskb)-\u003ecsum =\nnet/core/skbuff.c-4997-\t\t\t\t\tskb_copy_and_csum_bits(head_skb, offset,\nnet/core/skbuff.c:4998:\t\t\t\t\t\t\t skb_put(nskb,\nnet/core/skbuff.c-4999-\t\t\t\t\t\t\t\t len),\nnet/core/skbuff.c-5000-\t\t\t\t\t\t\t len);\nnet/core/skbuff.c:5001:\t\t\t\tSKB_GSO_CB(nskb)-\u003ecsum_start =\nnet/core/skbuff.c:5002:\t\t\t\t\tskb_headroom(nskb) + doffset;\nnet/core/skbuff.c-5003-\t\t\t} else {\nnet/core/skbuff.c:5004:\t\t\t\tif (skb_copy_bits(head_skb, offset, skb_put(nskb, len), len))\nnet/core/skbuff.c-5005-\t\t\t\t\tgoto err;\n--\n\n"
} |
| 77/3 | 2026/10/01 10:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 43863 output: 37 thoughts: 36 Thoughts: Okay, let's dive into this. Here's my take on those lines of code: **Analyzing `skb_segment` in `net/core/skbuff.c`** Alright, I need to get my head around this segmentation process. I want to really dig into `skb_segment`, specifically around lines 4870 to 4895 in `net/core/skbuff.c`. I'm thinking, what's the core logic here? What crucial decisions are being made within that specific chunk of code related to segmenting a socket buffer? Are there any potential optimizations or, conversely, areas that might present bottlenecks if the data size or network load increases? I'm anticipating that these lines contain the essence of how the buffer is actually broken down into smaller packets, handling the TCP options, and determining what goes where. I need to understand the relationship between the original SKB, the new fragmented SKBs, and how metadata and pointers are being managed to maintain data integrity. I wonder if there are any specific error paths I should focus on for robustness or if there are any hints related to performance characteristics based on the code layout. Time to pull it up and see. |
| 78/3 | 2026/10/01 10:09 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 4865,
"LineCount": 40
}Results: {
"Contents": "4865:\t\n4866:\t\t\t\t\tlen -= iter-\u003elen;\n4867:\t\t\t\t}\n4868:\t\n4869:\t\t\t\tif (len != frag_len)\n4870:\t\t\t\t\tgoto normal;\n4871:\t\t\t}\n4872:\t\n4873:\t\t\t/* GSO partial only requires that we trim off any excess that\n4874:\t\t\t * doesn't fit into an MSS sized block, so take care of that\n4875:\t\t\t * now.\n4876:\t\t\t */\n4877:\t\t\tDEBUG_NET_WARN_ON_ONCE(len / mss \u003e GSO_MAX_SEGS);\n4878:\t\t\tif (max_segs)\n4879:\t\t\t\tpartial_segs = min(len / mss, max_segs);\n4880:\t\t\telse\n4881:\t\t\t\tpartial_segs = min(len / mss, GSO_MAX_SEGS);\n4882:\t\t\tif (partial_segs \u003e 1)\n4883:\t\t\t\tmss *= partial_segs;\n4884:\t\t\telse\n4885:\t\t\t\tpartial_segs = 0;\n4886:\t\t}\n4887:\t\n4888:\tnormal:\n4889:\t\theadroom = skb_headroom(head_skb);\n4890:\t\tpos = skb_headlen(head_skb);\n4891:\t\n4892:\t\tif (skb_orphan_frags(head_skb, GFP_ATOMIC))\n4893:\t\t\treturn ERR_PTR(-ENOMEM);\n4894:\t\n4895:\t\tnfrags = skb_shinfo(head_skb)-\u003enr_frags;\n4896:\t\tfrag = skb_shinfo(head_skb)-\u003efrags;\n4897:\t\tfrag_skb = head_skb;\n4898:\t\n4899:\t\tdo {\n4900:\t\t\tstruct sk_buff *nskb;\n4901:\t\t\tskb_frag_t *nskb_frag;\n4902:\t\t\tint hsize;\n4903:\t\t\tint size;\n4904:\t\n"
} |
| 79/3 | 2026/10/01 10:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44761 output: 37 thoughts: 40 Thoughts: Here's my summary, as if I were thinking these thoughts: **Analyzing `skb_segment` and `partial_segs`** Okay, let's dive back into `skb_segment`. I'm particularly interested in what's going on with `partial_segs`. I recall we were looking at some potential optimizations or edge cases around it, so let's refresh the details. My plan is to zero in on lines roughly between 5040 and 5080. That should give me the relevant context surrounding how the function handles or manipulates those segments. Hopefully, by reviewing this specific section, the logic governing `partial_segs` will become clear. |
| 80/3 | 2026/10/01 10:09 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 5040,
"LineCount": 40
}Results: {
"Contents": "5040:\t\n5041:\t\t\t\t\t\t/* to make room for head_frag. */\n5042:\t\t\t\t\t\ti--;\n5043:\t\t\t\t\t\tfrag--;\n5044:\t\t\t\t\t}\n5045:\t\n5046:\t\t\t\t\tlist_skb = list_skb-\u003enext;\n5047:\t\t\t\t}\n5048:\t\n5049:\t\t\t\tif (unlikely(skb_shinfo(nskb)-\u003enr_frags \u003e=\n5050:\t\t\t\t\t MAX_SKB_FRAGS)) {\n5051:\t\t\t\t\tnet_warn_ratelimited(\n5052:\t\t\t\t\t\t\"skb_segment: too many frags: %u %u\\n\",\n5053:\t\t\t\t\t\tpos, mss);\n5054:\t\t\t\t\terr = -EINVAL;\n5055:\t\t\t\t\tgoto err;\n5056:\t\t\t\t}\n5057:\t\n5058:\t\t\t\t*nskb_frag = (i \u003c 0) ? skb_head_frag_to_page_desc(frag_skb) : *frag;\n5059:\t\t\t\t__skb_frag_ref(nskb_frag);\n5060:\t\t\t\tsize = skb_frag_size(nskb_frag);\n5061:\t\n5062:\t\t\t\tif (pos \u003c offset) {\n5063:\t\t\t\t\tskb_frag_off_add(nskb_frag, offset - pos);\n5064:\t\t\t\t\tskb_frag_size_sub(nskb_frag, offset - pos);\n5065:\t\t\t\t}\n5066:\t\n5067:\t\t\t\tskb_shinfo(nskb)-\u003enr_frags++;\n5068:\t\n5069:\t\t\t\tif (pos + size \u003c= offset + len) {\n5070:\t\t\t\t\ti++;\n5071:\t\t\t\t\tfrag++;\n5072:\t\t\t\t\tpos += size;\n5073:\t\t\t\t} else {\n5074:\t\t\t\t\tskb_frag_size_sub(nskb_frag, pos + size - (offset + len));\n5075:\t\t\t\t\tgoto skip_fraglist;\n5076:\t\t\t\t}\n5077:\t\n5078:\t\t\t\tnskb_frag++;\n5079:\t\t\t}\n"
} |
| 81/3 | 2026/10/01 10:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 45557 output: 37 thoughts: 29 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Diving Deeper into `skb_segment` and `partial_segs`** Alright, I'm digging into `skb_segment` now, specifically to understand the relationship between `partial_segs` and the newly allocated `nskb`. I need to see how the fragmentation logic is implemented here. It's crucial to understand how we're building these partial segments, and how they contribute to the overall segmented buffer. Knowing precisely *how* `nskb` interacts with `partial_segs` is key to grasping the intricacies of the offload process and, more importantly, to identify any potential bottlenecks or inefficiencies in the future. I'm looking for the data structures and control flow that define how these things are linked and when `partial_segs` are actually populated. A deep understanding of that interaction will allow me to assess the performance ramifications, especially under heavy load or with varying packet sizes. I'm anticipating some subtle pointer manipulation and likely some crucial checks to ensure buffer integrity. Let's see if the code tells a clear story. |
| 82/3 | 2026/10/01 10:09 | tool | read-file |
0mArgs:{
"File": "net/core/skbuff.c",
"FirstLine": 5080,
"LineCount": 50
}Results: {
"Contents": "5080:\t\n5081:\tskip_fraglist:\n5082:\t\t\tnskb-\u003edata_len = len - hsize;\n5083:\t\t\tnskb-\u003elen += nskb-\u003edata_len;\n5084:\t\t\tnskb-\u003etruesize += nskb-\u003edata_len;\n5085:\t\n5086:\tperform_csum_check:\n5087:\t\t\tif (!csum) {\n5088:\t\t\t\tif (skb_has_shared_frag(nskb) \u0026\u0026\n5089:\t\t\t\t __skb_linearize(nskb))\n5090:\t\t\t\t\tgoto err;\n5091:\t\n5092:\t\t\t\tif (!nskb-\u003eremcsum_offload)\n5093:\t\t\t\t\tnskb-\u003eip_summed = CHECKSUM_NONE;\n5094:\t\t\t\tSKB_GSO_CB(nskb)-\u003ecsum =\n5095:\t\t\t\t\tskb_checksum(nskb, doffset,\n5096:\t\t\t\t\t\t nskb-\u003elen - doffset, 0);\n5097:\t\t\t\tSKB_GSO_CB(nskb)-\u003ecsum_start =\n5098:\t\t\t\t\tskb_headroom(nskb) + doffset;\n5099:\t\t\t}\n5100:\t\t} while ((offset += len) \u003c head_skb-\u003elen);\n5101:\t\n5102:\t\t/* Some callers want to get the end of the list.\n5103:\t\t * Put it in segs-\u003eprev to avoid walking the list.\n5104:\t\t * (see validate_xmit_skb_list() for example)\n5105:\t\t */\n5106:\t\tsegs-\u003eprev = tail;\n5107:\t\n5108:\t\tif (partial_segs) {\n5109:\t\t\tstruct sk_buff *iter;\n5110:\t\t\tint type = skb_shinfo(head_skb)-\u003egso_type;\n5111:\t\t\tunsigned short gso_size = skb_shinfo(head_skb)-\u003egso_size;\n5112:\t\n5113:\t\t\t/* Update type to add partial and then remove dodgy if set */\n5114:\t\t\ttype |= (features \u0026 NETIF_F_GSO_PARTIAL) / NETIF_F_GSO_PARTIAL * SKB_GSO_PARTIAL;\n5115:\t\t\ttype \u0026= ~SKB_GSO_DODGY;\n5116:\t\n5117:\t\t\t/* Update GSO info and prepare to start updating headers on\n5118:\t\t\t * our way back down the stack of protocols.\n5119:\t\t\t */\n5120:\t\t\tfor (iter = segs; iter; iter = iter-\u003enext) {\n5121:\t\t\t\tskb_shinfo(iter)-\u003egso_size = gso_size;\n5122:\t\t\t\tskb_shinfo(iter)-\u003egso_segs = partial_segs;\n5123:\t\t\t\tskb_shinfo(iter)-\u003egso_type = type;\n5124:\t\t\t\tSKB_GSO_CB(iter)-\u003edata_offset = skb_headroom(iter) + doffset;\n5125:\t\t\t}\n5126:\t\n5127:\t\t\tif (tail-\u003elen - doffset \u003c= gso_size)\n5128:\t\t\t\tskb_shinfo(tail)-\u003egso_size = 0;\n5129:\t\t\telse if (tail != segs)\n"
} |
| 83/3 | 2026/10/01 10:09 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46753 output: 20 thoughts: 1437 Thoughts: **Analyzing Potential Uninitialized Memory Access in GSO TCP Resegmentation** Okay, let's break this down. My immediate concern is this: I need to verify whether the GSO TCP resegmentation code could lead to the kind of uninitialized memory access that's described in Point 4. That is, whether the resegmented SKBs could, somehow, have data or metadata that is not properly initialized, and therefore potentially leak data or cause a security issue. First, I looked at lines 5114-5125. I noted that the `NETIF_F_GSO_PARTIAL` feature flag is critical. Specifically, if the `max_segs` configuration is used to bypass the usual check where `NETIF_F_GSO_PARTIAL` is present, it *could* mean that `SKB_GSO_PARTIAL` might not be set in the `type` field. However, even if `SKB_GSO_PARTIAL` isn't set, the `gso_size`, `gso_segs`, `gso_type`, and `data_offset` are all explicitly set. Importantly, the tests seem to *expect* `SKB_GSO_PARTIAL` to be *not* set in these circumstances, which indicates that not setting it is the intended and correct behavior. So, that doesn't seem to be a problem in and of itself. Next, I zeroed in on the question of how the new, resegmented SKBs are created. The data for `nskb` comes from `head_skb`, via `skb_copy_bits` or fragment page referencing. The input buffers – the initial packet payload and headers – are already initialized because they are network packets that have been received or are being transmitted. This suggests that the data in the resegmented SKBs should *also* be initialized, since they're derived from initialized sources. Then, I looked at what happens when the resegmented TCP GSO SKB is actually sent out. I checked the `skb_gso_output_max_segs` function which seems like the critical path. My concern here was whether the function itself introduces a potential for uninitialized reads. In particular I was looking at this line: `th = skb_header_pointer(skb, skb_transport_offset(skb), sizeof(_tcph), &_tcph);` Here, the `skb_header_pointer` function *could* either return a pointer directly into `skb->data`, or it copies the data into the local variable `_tcph` using `skb_copy_bits`. I realized that, if there *were* insufficient bytes for the copy via `skb_copy_bits`, the function would return `NULL`. This means the code *explicitly* checks for a `NULL` return value. So, the `th` pointer either points to initialized bytes from the SKB or to bytes that were written directly by a copy. The subsequent check `if (!th || __tcp_hdrlen(th) < sizeof(*th))` handles the `NULL` case (which means the TCP header is not available or too short). Therefore, I don't see any immediate issue there. The other potentially problematic area I saw was the `netif_get_gso_max_size` function, specifically how it uses `vlan_get_protocol(skb)`. My thought was, could this be reading uninitialized memory? To be sure, I'll need to look at the implementation of `vlan_get_protocol(skb)` to see precisely how it accesses the SKB data. But at this point, I don't suspect a vulnerability, but it would be wise to be thorough here. |
| 84/3 | 2026/10/01 10:10 | tool | grepper |
0mArgs:{
"Expression": "vlan_get_protocol"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 538 lines.\nUse more precise expression if possible.\n\ndrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c=3362=static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)\n--\ndrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c-3370-\ndrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:3371:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c-3372-\tif (protocol == htons(ETH_P_IPV6)) {\n--\ndrivers/net/ethernet/broadcom/bnxt/bnxt.c=14264=static netdev_features_t bnxt_features_check(struct sk_buff *skb,\n--\ndrivers/net/ethernet/broadcom/bnxt/bnxt.c-14271-\tfeatures = vlan_features_check(skb, features);\ndrivers/net/ethernet/broadcom/bnxt/bnxt.c:14272:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/broadcom/bnxt/bnxt.c-14273-\tcase htons(ETH_P_IP):\n--\ndrivers/net/ethernet/brocade/bna/bnad.c=2480=bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)\n--\ndrivers/net/ethernet/brocade/bna/bnad.c-2493-\t */\ndrivers/net/ethernet/brocade/bna/bnad.c:2494:\tif (vlan_get_protocol(skb) == htons(ETH_P_IP)) {\ndrivers/net/ethernet/brocade/bna/bnad.c-2495-\t\tstruct iphdr *iph = ip_hdr(skb);\n--\ndrivers/net/ethernet/brocade/bna/bnad.c=2818=bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb,\n--\ndrivers/net/ethernet/brocade/bna/bnad.c-2869-\t\tif (skb-\u003eip_summed == CHECKSUM_PARTIAL) {\ndrivers/net/ethernet/brocade/bna/bnad.c:2870:\t\t\t__be16 net_proto = vlan_get_protocol(skb);\ndrivers/net/ethernet/brocade/bna/bnad.c-2871-\t\t\tu8 proto = 0;\n--\ndrivers/net/ethernet/chelsio/cxgb4/sge.c=1267=enum cpl_tx_tnl_lso_type cxgb_encap_offload_supported(struct sk_buff *skb)\n--\ndrivers/net/ethernet/chelsio/cxgb4/sge.c-1277-\ndrivers/net/ethernet/chelsio/cxgb4/sge.c:1278:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/chelsio/cxgb4/sge.c-1279-\tcase htons(ETH_P_IP):\n--\ndrivers/net/ethernet/cisco/enic/enic_main.c=246=static netdev_features_t enic_features_check(struct sk_buff *skb,\n--\ndrivers/net/ethernet/cisco/enic/enic_main.c-260-\ndrivers/net/ethernet/cisco/enic/enic_main.c:261:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/cisco/enic/enic_main.c-262-\tcase htons(ETH_P_IPV6):\n--\ndrivers/net/ethernet/emulex/benet/be_main.c=5060=static netdev_features_t be_features_check(struct sk_buff *skb,\n--\ndrivers/net/ethernet/emulex/benet/be_main.c-5098-\t */\ndrivers/net/ethernet/emulex/benet/be_main.c:5099:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/emulex/benet/be_main.c-5100-\tcase htons(ETH_P_IP):\n--\ndrivers/net/ethernet/freescale/enetc/enetc.c=229=static bool enetc_skb_is_ipv6(struct sk_buff *skb)\ndrivers/net/ethernet/freescale/enetc/enetc.c-230-{\ndrivers/net/ethernet/freescale/enetc/enetc.c:231:\treturn vlan_get_protocol(skb) == htons(ETH_P_IPV6);\ndrivers/net/ethernet/freescale/enetc/enetc.c-232-}\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c=35=static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size,\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-78-\t\t\t\tip_offset += VLAN_HLEN;\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c:79:\t\t\t\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-80-\t\t\t\tskb-\u003eprotocol = protocol;\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c=143=static void fill_desc(struct hnae_ring *ring, void *priv,\n--\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-178-\t\t\t\tip_offset += VLAN_HLEN;\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c:179:\t\t\t\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns/hns_enet.c-180-\t\t\t\tskb-\u003eprotocol = protocol;\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c=1517=static int hns3_handle_vtags(struct hns3_enet_ring *tx_ring,\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1545-\t\t */\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c:1546:\t\tskb-\u003eprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1547-\t\treturn 0;\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1560-\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c:1561:\t\tskb-\u003eprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1562-\t\treturn rc;\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1572-\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c:1573:\tskb-\u003eprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-1574-\treturn 0;\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c=3032=static u8 hns3_get_skb_dscp(struct sk_buff *skb)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-3037-\tif (protocol == htons(ETH_P_8021Q))\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c:3038:\t\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-3039-\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_rx.c=367=static void hinic3_lro_set_gso_params(struct sk_buff *skb, u16 num_lro)\n--\ndrivers/net/ethernet/huawei/hinic3/hinic3_rx.c-371-\ndrivers/net/ethernet/huawei/hinic3/hinic3_rx.c:372:\tproto = __vlan_get_protocol(skb, eth-\u003eh_proto, NULL);\ndrivers/net/ethernet/huawei/hinic3/hinic3_rx.c-373-\n--\ndrivers/net/ethernet/intel/e1000/e1000_main.c=3097=static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/e1000/e1000_main.c-3111-\tunsigned int f;\ndrivers/net/ethernet/intel/e1000/e1000_main.c:3112:\t__be16 protocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/e1000/e1000_main.c-3113-\n--\ndrivers/net/ethernet/intel/e1000e/netdev.c=5815=static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/e1000e/netdev.c-5827-\tunsigned int f;\ndrivers/net/ethernet/intel/e1000e/netdev.c:5828:\t__be16 protocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/e1000e/netdev.c-5829-\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c=653=static struct ethhdr *fm10k_gre_is_nvgre(struct sk_buff *skb)\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-658-\t/* currently only IPv4 is supported due to hlen above */\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c:659:\tif (vlan_get_protocol(skb) != htons(ETH_P_IP))\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-660-\t\treturn NULL;\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c=676=__be16 fm10k_tx_encap_offload(struct sk_buff *skb)\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-684-\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c:685:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-686-\tcase htons(ETH_P_IP):\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c=789=static void fm10k_tx_csum(struct fm10k_ring *tx_ring,\n--\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-819-\t} else {\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c:820:\t\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/fm10k/fm10k_main.c-821-\t\tnetwork_hdr.raw = skb_network_header(skb);\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c=3004=static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3019-\t\t */\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c:3020:\t\tskb-\u003eprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3021-\t\tgoto out;\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c=3078=static int i40e_tso(struct i40e_tx_buffer *first, u8 *hdr_len,\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3107-\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c:3108:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3109-\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c=3245=static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,\n--\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3268-\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c:3269:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/i40e/i40e_txrx.c-3270-\n--\ndrivers/net/ethernet/intel/iavf/iavf_txrx.c=2291=static netdev_tx_t iavf_xmit_frame_ring(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/iavf/iavf_txrx.c-2344-\t/* obtain protocol of skb */\ndrivers/net/ethernet/intel/iavf/iavf_txrx.c:2345:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/iavf/iavf_txrx.c-2346-\n--\ndrivers/net/ethernet/intel/ice/ice_txrx.c=1594=int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)\n--\ndrivers/net/ethernet/intel/ice/ice_txrx.c-1615-\ndrivers/net/ethernet/intel/ice/ice_txrx.c:1616:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/ice/ice_txrx.c-1617-\n--\ndrivers/net/ethernet/intel/ice/ice_txrx.c=1841=int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)\n--\ndrivers/net/ethernet/intel/ice/ice_txrx.c-1869-\ndrivers/net/ethernet/intel/ice/ice_txrx.c:1870:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/ice/ice_txrx.c-1871-\n--\ndrivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c=412=netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c-437-\ndrivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c:438:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c-439-\tif (protocol == htons(ETH_P_IP))\n--\ndrivers/net/ethernet/intel/igb/igb_main.c=6526=netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/igb/igb_main.c-6533-\tu16 count = TXD_USE_COUNT(skb_headlen(skb));\ndrivers/net/ethernet/intel/igb/igb_main.c:6534:\t__be16 protocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/igb/igb_main.c-6535-\tu8 hdr_len = 0;\n--\ndrivers/net/ethernet/intel/igbvf/netdev.c=2265=static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/igbvf/netdev.c-2273-\tint tso = 0;\ndrivers/net/ethernet/intel/igbvf/netdev.c:2274:\t__be16 protocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/igbvf/netdev.c-2275-\n--\ndrivers/net/ethernet/intel/igc/igc_main.c=1597=static netdev_tx_t igc_xmit_frame_ring(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/igc/igc_main.c-1602-\tu16 count = TXD_USE_COUNT(skb_headlen(skb));\ndrivers/net/ethernet/intel/igc/igc_main.c:1603:\t__be16 protocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/igc/igc_main.c-1604-\tstruct igc_tx_buffer *first;\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c=9266=static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c-9288-\t */\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9289:\tswitch (vlan_get_protocol(skb)) {\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c-9290-\tcase htons(ETH_P_FCOE):\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c=9395=netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c-9444-\t}\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9445:\tprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/ixgbe/ixgbe_main.c-9446-\n--\ndrivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c=4184=static int ixgbevf_xmit_frame_ring(struct sk_buff *skb,\n--\ndrivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c-4236-\tfirst-\u003etx_flags = tx_flags;\ndrivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4237:\tfirst-\u003eprotocol = vlan_get_protocol(skb);\ndrivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c-4238-\n--\ndrivers/net/ethernet/marvell/mvneta.c=1955=static u32 mvneta_skb_tx_csum(struct sk_buff *skb)\n--\ndrivers/net/ethernet/marvell/mvneta.c-1958-\t\tint ip_hdr_len = 0;\ndrivers/net/ethernet/marvell/mvneta.c:1959:\t\t__be16 l3_proto = vlan_get_protocol(skb);\ndrivers/net/ethernet/marvell/mvneta.c-1960-\t\tu8 l4_proto;\n--\ndrivers/net/ethernet/marvell/mvpp2/mvpp2_main.c=3606=static u32 mvpp2_skb_tx_csum(struct mvpp2_port *port, struct sk_buff *skb)\n\n"
} |
| 85/3 | 2026/10/01 10:10 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54552 output: 320 thoughts: 1424 Thoughts: **GSO Segmentation Optimization Review** Okay, let's break this down. First, `vlan_get_protocol(skb)` is the go-to helper, so that's good to see its widespread usage. Looking at the diffs, it's clear the changes revolve around refining Generic Segmentation Offload (GSO), specifically by introducing and managing a `max_segs` limit. The changes touch a lot of core network components, including `tap.c`, `netdevice.h`, `gso.h`, `udp.h`, `dev.c`, `gso.c`, `net_test.c`, `skbuff.c`, and `datapath.c`. My primary concern, as always, is potential security vulnerabilities. I need to make sure this doesn't open any doors for information leaks or memory corruption. The key here is the introduction of `max_segs` within `struct skb_gso_cb`. I'm seeing it's being placed within the `skb->cb` which is crucial and potentially a common source of memory corruption bugs. Now, it looks like `max_segs` is explicitly set in `__skb_gso_segment()`, ensuring it's initialized before any segmentation callbacks. This is good. Similarly, in `validate_xmit_skb`, the local variable `max_segs` is also initialized to 0. Also, `_tcph` in `skb_gso_output_max_segs` is used correctly and safely. The patch seems to correctly handle all potential risks: There are no changes to the user space copy logic. `max_segs` is set prior to segmentation. The packet data being segmented is valid network data. Bounds checks, and other calculations adjust the size of packet chunks, and if there are memory overruns or other errors, KASAN would pick them up. The patch modifies existing logic and doesn't introduce any new structures with potentially uninitialized fields, and all allocations and accesses are safe. Finally, checking against the rules for KMSAN, I'm confident that these changes don't introduce any risks detectable *only* by KMSAN. All variables are initialized, there's no potential for leaking uninitialized memory, and any bounds errors would be caught by KASAN. Therefore, `NeedsKMSAN=false` is correct. Ready to call the `set-results` tool and mark this as good. |
| 86/3 | 2026/10/01 10:10 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch modifies the GSO (Generic Segmentation Offload) engine and packet transmission path to allow re-segmenting TCP packets to match device limits without dropping down to individual MTU segments. Specifically:\n1. It adds a new field `max_segs` to `struct skb_gso_cb` (which resides inside `skb-\u003ecb`). This field is explicitly initialized in `__skb_gso_segment()` prior to dispatching to protocol-specific segmentation handlers and `skb_segment()`.\n2. Stack and local variables introduced by the patch (such as `_tcph` in `skb_gso_output_max_segs()`) are properly handled; `skb_header_pointer()` ensures data is copied into the buffer before `th` is accessed.\n3. No data structures or padding exposed to user space are added or modified (no copy_to_user, netlink skb attributes, ioctls, or socket options).\n4. Potential issues introduced by this patch relate to packet length calculations, header sizing, segmentation bounds, or out-of-bounds reads/writes on skb frags, all of which fall under KASAN's domain rather than KMSAN's.\n\nTherefore, the patch introduces no uninitialized memory usage or kernel-to-user info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch modifies the GSO (Generic Segmentation Offload) engine and packet transmission path to allow re-segmenting TCP packets to match device limits without dropping down to individual MTU segments. Specifically:\n1. It adds a new field `max_segs` to `struct skb_gso_cb` (which resides inside `skb-\u003ecb`). This field is explicitly initialized in `__skb_gso_segment()` prior to dispatching to protocol-specific segmentation handlers and `skb_segment()`.\n2. Stack and local variables introduced by the patch (such as `_tcph` in `skb_gso_output_max_segs()`) are properly handled; `skb_header_pointer()` ensures data is copied into the buffer before `th` is accessed.\n3. No data structures or padding exposed to user space are added or modified (no copy_to_user, netlink skb attributes, ioctls, or socket options).\n4. Potential issues introduced by this patch relate to packet length calculations, header sizing, segmentation bounds, or out-of-bounds reads/writes on skb frags, all of which fall under KASAN's domain rather than KMSAN's.\n\nTherefore, the patch introduces no uninitialized memory usage or kernel-to-user info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|