| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/11 19:54 | flow | patch-triage |
12mArgs:null Results: {
"EnableConfigs": [
"IPV6",
"IPV6_SEG6_LWTUNNEL"
],
"FocusSymbols": [
"input_action_end",
"end_flv8986_core",
"seg6_pop_srh",
"seg6_use_next_csid",
"seg6_flv8986_get_srh",
"seg6_local_input"
],
"KMSANReasoning": "The patch modifies the IPv6 SRv6 local behavior implementation in `net/ipv6/seg6_local.c` to properly combine NEXT-C-SID with RFC 8986 flavors (such as PSP) and correctly handle extension header traversal when popping an SRH preceded by another routing header, along with adding self-tests.\n\nReviewing KMSAN vs. KASAN applicability:\n1. No uninitialized memory or info-leak risks: The patch does not introduce or modify any kernel-to-user copies (copy_to_user, netlink attributes, ioctl structures, socket options) or allocate new uninitialized data structures.\n2. Variable and buffer safety: All variables introduced or used (such as `fops`, `addr`, `off`, `nexthdr`) are fully initialized. Packet data accessed during header parsing is checked and validated via `skb_header_pointer()`, `pskb_may_pull()`, and `skb_ensure_writable()`.\n3. Standard sanitizers sufficiency: Any potential issues arising from the changes would be logic errors or out-of-bounds accesses during skb header adjustments, both of which are caught by functional tests and standard KASAN. There is no uninitialized memory reading or branching on uninitialized data that would necessitate dedicated KMSAN fuzzing.",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies the SRv6 (Segment Routing over IPv6) local behavior handling in net/ipv6/seg6_local.c, specifically altering how the NEXT-C-SID flavor interacts with RFC8986 flavors (such as PSP) and how SRH headers are parsed and popped (seg6_pop_srh and seg6_flv8986_get_srh) when dealing with preceding or consumed routing headers. This touches reachable core networking packet-processing and header-mangling logic that can be tested in virtualized environments via standard IPv6 sockets, netlink route configuration, and virtual interfaces.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/11 19:54 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit b4212b90c23edcde19abd37fec5edc03ee10dfb8\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Oct 11 19:54:37 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c\nindex 0c3d1be7f1299..427d12fedfc3e 100644\n--- a/net/ipv6/seg6_local.c\n+++ b/net/ipv6/seg6_local.c\n@@ -551,6 +551,47 @@ static bool seg6_next_csid_enabled(__u32 fops)\n \treturn fops \u0026 SEG6_F_LOCAL_FLV_NEXT_CSID;\n }\n \n+static bool seg6_flv8986_enabled(__u32 fops)\n+{\n+\treturn fops \u0026 SEG6_LOCAL_FLV8986_SUPP_OPS;\n+}\n+\n+/* check whether the NEXT-C-SID processing has to be used for the packet,\n+ * instead of the RFC8986 flavors set for the given SRv6 End* behavior\n+ * instance.\n+ *\n+ * This function returns:\n+ * - true, when the packet has to go through the NEXT-C-SID processing;\n+ * - false, when NEXT-C-SID is not configured or the packet has to be\n+ * processed on the basis of the RFC8986 flavors.\n+ */\n+static bool seg6_use_next_csid(struct sk_buff *skb,\n+\t\t\t const struct seg6_flavors_info *finfo)\n+{\n+\tconst struct in6_addr *addr;\n+\t__u32 fops = finfo-\u003eflv_ops;\n+\n+\tif (!seg6_next_csid_enabled(fops))\n+\t\treturn false;\n+\n+\taddr = \u0026ipv6_hdr(skb)-\u003edaddr;\n+\n+\t/* NEXT-C-SID and the RFC8986 flavors combine according to the\n+\t * DA.Argument (see RFC9800, sections 4.1.1 and 4.1.7):\n+\t *\n+\t * DA.Argument RFC8986 flavors processing\n+\t * (1) != 0 any NEXT-C-SID only, SL unchanged\n+\t * (2) == 0 none the behavior, e.g. End\n+\t * (3) == 0 one or more the behavior with its flavors,\n+\t * e.g. End with PSP\n+\t *\n+\t * In (2), the packet still goes through the NEXT-C-SID processing,\n+\t * which runs the behavior (e.g. End) when the DA.Argument is zero.\n+\t */\n+\treturn !seg6_flv8986_enabled(fops) ||\n+\t !seg6_next_csid_is_arg_zero(addr, finfo);\n+}\n+\n /* Processing of SRv6 End, End.X, and End.T behaviors can be extended through\n * the flavors framework. These behaviors must report the subset of (flavor)\n * operations they currently implement. In this way, if a user specifies a\n@@ -775,11 +816,14 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\n \t\tskb_set_transport_header(skb, thoff);\n \n \tiph = ipv6_hdr(skb);\n-\tif (iph-\u003enexthdr == NEXTHDR_ROUTING) {\n+\tif (srhoff == sizeof(*iph)) {\n \t\tiph-\u003enexthdr = srh_nexthdr;\n \t} else {\n \t\t/* we must look for the extension header (EXTH, for short) that\n-\t\t * immediately precedes the SRH we have just removed.\n+\t\t * immediately precedes the SRH we have just removed, i.e. the\n+\t\t * EXTH that ends at srhoff. We find it by its position and not\n+\t\t * by its nexthdr, since another routing header (e.g. an SRH\n+\t\t * with SL = 0) may come before the removed SRH.\n \t\t * Then, we update the value of the EXTH nexthdr with the one\n \t\t * contained in the SRH nexthdr.\n \t\t */\n@@ -796,11 +840,6 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\n \t\t\tif (unlikely(!hp))\n \t\t\t\treturn false;\n \n-\t\t\tif (hp-\u003enexthdr == NEXTHDR_ROUTING) {\n-\t\t\t\thp-\u003enexthdr = srh_nexthdr;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\n \t\t\tswitch (nexthdr) {\n \t\t\tcase NEXTHDR_FRAGMENT:\n \t\t\t\tfallthrough;\n@@ -812,6 +851,11 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\n \t\t\t\tbreak;\n \t\t\t}\n \n+\t\t\tif (off == srhoff) {\n+\t\t\t\thp-\u003enexthdr = srh_nexthdr;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n \t\t\tnexthdr = hp-\u003enexthdr;\n \t\t}\n \t}\n@@ -823,6 +867,24 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\n \treturn true;\n }\n \n+/* look up the SRH to be processed by the RFC8986 flavors. As End does, a\n+ * routing header with SL = 0 is skipped (e.g. an SRH already consumed).\n+ * This function returns NULL when no valid SRH is found.\n+ */\n+static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)\n+{\n+\tstruct ipv6_sr_hdr *srh;\n+\n+\tsrh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);\n+\tif (srh)\n+\t\treturn srh;\n+\n+\t/* we take the first routing header without skipping it. In this way,\n+\t * seg6_get_srh_pktinfo() reports SL = 0 and not a missing SRH.\n+\t */\n+\treturn seg6_get_srh(skb, 0);\n+}\n+\n /* process the packet on the basis of the RFC8986 flavors set for the given\n * SRv6 End behavior instance.\n */\n@@ -837,14 +899,17 @@ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n \t__u32 flvmask;\n \tint srhoff;\n \n-\tsrh = seg6_get_srh(skb, 0);\n+\tsrh = seg6_flv8986_get_srh(skb);\n \tsrhoff = srh ? ((unsigned char *)srh - skb-\u003edata) : 0;\n \tpinfo = seg6_get_srh_pktinfo(srh);\n #ifdef CONFIG_IPV6_SEG6_HMAC\n \tif (srh \u0026\u0026 !seg6_hmac_validate_skb(skb, srh))\n \t\tgoto drop;\n #endif\n-\tflvmask = finfo-\u003eflv_ops;\n+\t/* NEXT-C-SID, when configured, has already been evaluated by the\n+\t * caller. Only the RFC8986 flavors are left here.\n+\t */\n+\tflvmask = finfo-\u003eflv_ops \u0026 ~SEG6_F_LOCAL_FLV_NEXT_CSID;\n \tif (unlikely(flvmask \u0026 ~SEG6_LOCAL_FLV8986_SUPP_OPS)) {\n \t\tpr_warn_once(\"seg6local: invalid RFC8986 flavors\\n\");\n \t\tgoto drop;\n@@ -898,8 +963,8 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n \tif (!fops)\n \t\treturn input_action_end_core(skb, slwt);\n \n-\t/* check for the presence of NEXT-C-SID since it applies first */\n-\tif (seg6_next_csid_enabled(fops))\n+\t/* NEXT-C-SID is evaluated first, when configured */\n+\tif (seg6_use_next_csid(skb, finfo))\n \t\treturn end_next_csid_core(skb, slwt);\n \n \t/* the specific processing function to be performed on the packet\ndiff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh\nindex 30a939392eea4..b5dbf53a7f238 100755\n--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh\n+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh\n@@ -16,13 +16,13 @@\n #\n # The End, End.X, and End.T behaviors can support these flavors either\n # individually or in combinations.\n-# Currently in this selftest we consider only the PSP flavor for the SRv6 End\n-# behavior. However, it is possible to extend the script as soon as other\n+# Currently in this selftest we consider the PSP flavor for the SRv6 End\n+# behavior, both alone and combined with the NEXT-C-SID flavor defined in\n+# RFC9800 [2]. However, it is possible to extend the script as soon as other\n # flavors will be supported in the kernel.\n #\n # The purpose of the PSP flavor consists in instructing the penultimate node\n-# listed in the SRv6 policy to remove (i.e. pop) the outermost SRH from the IPv6\n-# header.\n+# listed in the SRv6 policy to remove (i.e. pop) the SRH from the IPv6 header.\n # A PSP enabled SRv6 End behavior instance processes the SRH by:\n # - decrementing the Segment Left (SL) value from 1 to 0;\n # - copying the last SID from the SID List into the IPv6 Destination Address\n@@ -47,7 +47,20 @@\n # \"standard\" End packet processing, ignoring the configured PSP flavor at\n # all.\n #\n+# The NEXT-C-SID flavor (referred to as NEXT-CSID in RFC9800 [2]) and the\n+# C-SID containers are described in srv6_end_next_csid_l3vpn_test.sh, which\n+# also tests this flavor for the SRv6 End behavior.\n+#\n+# When the NEXT-C-SID flavor is combined with the PSP, USP or USD flavors, these\n+# flavors are left unchanged [2]. The NEXT-C-SID processing comes first: with a\n+# non-zero Argument, the IPv6 DA is updated with the next C-SID and the packet\n+# is forwarded without changing the SRH, if any. The packet goes through the End\n+# behavior with the other flavors only when the Argument is zero, i.e. when the\n+# IPv6 DA carries no further C-SID. For example, the PSP operation takes place\n+# only for a C-SID container with a zero Argument and SL=1.\n+#\n # [1] RFC8986: https://datatracker.ietf.org/doc/html/rfc8986\n+# [2] RFC9800: https://datatracker.ietf.org/doc/html/rfc9800\n #\n # Network topology\n # ================\n@@ -115,12 +128,30 @@\n # +---------------------------------------------------------------------+\n # |fcff:x::e is associated with the SRv6 End behavior |\n # |fcff:x::ef1 is associated with the SRv6 End behavior with PSP flavor |\n+# |fcbb:0:0xyy::/48 is associated with the SRv6 behavior and the |\n+# | flavors of the Function yy |\n # +---------------------------------------------------------------------+\n #\n # The fcff::/16 prefix is reserved by the operator for the SIDs. Reachability of\n # SIDs is ensured by proper configuration of the IPv6 operator's network and\n # SRv6 routers.\n #\n+# Similarly, the fcbb:0::/32 prefix is reserved by the operator for the C-SID\n+# containers and it is used as their Locator-Block.\n+# A C-SID (16 bits) is made of the Locator-Node (8 bits), i.e. the ID of the\n+# router, followed by the Function (8 bits). The first digit of the Function\n+# selects the SRv6 behavior and the second one the flavors combined with\n+# NEXT-C-SID:\n+#\n+# +----------+----------+--------------------+\n+# | Function | behavior | flavors |\n+# +----------+----------+--------------------+\n+# | a1 | End | NEXT-C-SID and PSP |\n+# +----------+----------+--------------------+\n+#\n+# For example, fcbb:0:04a1:02a1:: is a C-SID container carrying the C-SID of\n+# rt-4 followed by the C-SID of rt-2, both with the NEXT-C-SID and PSP flavors.\n+#\n #\n # SRv6 Policies\n # =============\n@@ -193,6 +224,93 @@\n # set with the last SID; iii) the SRH is removed from the extension headers\n # after the IPv6 header. At this point, the packet with IPv6 DA=cafe::1 is sent\n # to the destination, i.e. hs-1.\n+#\n+# Traffic to the loopback addresses of the hosts\n+# ----------------------------------------------\n+#\n+# Each host has an address on its loopback, cafe::x:a1. The traffic from the\n+# other host towards this address is steered with C-SID containers: after the\n+# ingress router, every router crossed applies the SRv6 End behavior with the\n+# NEXT-C-SID and PSP flavors. The following SRv6 Policies are applied by rt-1\n+# to the traffic towards cafe::2:a1 (i.c) and by rt-2 to the traffic towards\n+# cafe::1:a1 (i.d):\n+#\n+# i.c) IPv6 traffic, SID List=fcbb:0:03a1::,fcbb:0:04a1:02a1::,cafe::2:a1\n+# i.d) IPv6 traffic, SID List=fcbb:0:04a1:03a1:01a1::,cafe::1:a1\n+#\n+# In the Policy (i.c), rt-3 receives a zero Argument with SL=2 and applies the\n+# \"standard\" End processing. rt-4 receives a non-zero Argument with SL=1: it\n+# advances to the next C-SID and does *NOT* apply the PSP operation. rt-2\n+# receives a zero Argument with SL=1 and applies the PSP operation.\n+#\n+# In the Policy (i.d), a single C-SID container carries three C-SIDs. rt-4 and\n+# rt-3 receive a non-zero Argument with SL=1: they advance to the next C-SID and\n+# do *NOT* apply the PSP operation. rt-1 receives a zero Argument with SL=1\n+# and applies the PSP operation.\n+#\n+# The hosts use cafe::x as the source address, not the loopback address. The\n+# replies are sent to cafe::x and follow the Policies (i.a) and (i.b), which\n+# are tested first. This way, each ping checks a single Policy with the\n+# NEXT-C-SID flavor, and a failure points directly to that Policy.\n+#\n+# The hosts drop the packets that carry an SRH (seg6_enabled is set to 0 on\n+# the hosts). The loopback address of a host is reached only through the\n+# router connected to that host: the ping succeeds only if the SRH is removed\n+# by that router.\n+#\n+# Traffic with a consumed SRH\n+# ---------------------------\n+#\n+# A packet can carry more than one SRH. The SRv6 End behavior skips an SRH with\n+# SL=0 and processes the next header [1].\n+#\n+# The traffic of this section reuses the Policies (i.a), (i.b), (i.c) and (i.d).\n+# A router on the path inserts an extra SRH in front of the Policy's SRH, and\n+# another router then consumes the extra SRH.\n+#\n+# The Policy (i.a) has SID List=fcff:3::e,fcff:4::ef1,fcff:2::ef1,cafe::2. A\n+# packet from hs-1 to hs-2 goes as follows:\n+#\n+# - rt-1 applies the Policy and sends the packet to rt-3:\n+# IPv6 DA=fcff:3::e | Policy's SRH, SL=3 | Payload\n+#\n+# - rt-3 (End) processes the Policy's SRH and sends the packet to rt-4:\n+# IPv6 DA=fcff:4::ef1 | Policy's SRH, SL=2 | Payload\n+#\n+# - rt-4 (End with PSP and SL\u003e1, acting as End) processes the Policy's SRH.\n+# The new DA is fcff:2::ef1:\n+# IPv6 DA=fcff:2::ef1 | Policy's SRH, SL=1 | Payload\n+# On rt-4, the route added by the test for fcff:2::ef1 then inserts the\n+# extra SRH, with SID List=fcff:3::e,fcff:2::ef1, and the packet goes back to\n+# rt-3:\n+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload\n+#\n+# - rt-3 (End) consumes the extra SRH and sets the DA back to fcff:2::ef1:\n+# IPv6 DA=fcff:2::ef1 | extra SRH, SL=0 | Policy's SRH, SL=1 | Payload\n+#\n+# - rt-2 (End with PSP) skips the extra SRH, processes the Policy's SRH and\n+# removes it:\n+# IPv6 DA=cafe::2 | extra SRH, SL=0 | Payload\n+#\n+# The extra SRH reaches hs-2, which skips it as its SL is 0. The other\n+# Policies work in the same way:\n+#\n+# (i.b) hs-2 -\u003e hs-1: on the packets with DA=fcff:1::ef1, rt-2 inserts the\n+# extra SRH with SID List=fcff:3::e,fcff:1::ef1, and rt-3 consumes it.\n+# (i.c) hs-1 -\u003e hs-2: on the packets with DA=fcbb:0:02a1::, rt-4 inserts the\n+# extra SRH with SID List=fcff:3::e,fcbb:0:02a1::, and rt-3 consumes it.\n+# (i.d) hs-2 -\u003e hs-1: on the packets with DA=fcbb:0:01a1::, rt-3 inserts the\n+# extra SRH with SID List=fcff:4::e,fcbb:0:01a1::, and rt-4 consumes it.\n+#\n+# The Policy (i.b) has no router between rt-2 and rt-1. For this reason, rt-2\n+# applies the Policy, inserts the extra SRH and sends the packet to rt-3:\n+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload\n+# rt-3 consumes the extra SRH, and rt-1 removes the Policy's SRH.\n+#\n+# The hosts need seg6_enabled set to 1 to accept the extra SRH, and it is set\n+# back to 0 at the end. These tests only check that the ping succeeds: PSP\n+# itself is checked by the PSP flavor and NEXT-C-SID,PSP tests, which run with\n+# seg6_enabled set to 0.\n \n # shellcheck source=lib.sh\n source lib.sh\n@@ -207,6 +325,17 @@ readonly IPv6_TESTS_ADDR=2001:db8::1\n readonly LOCATOR_SERVICE=fcff\n readonly END_FUNC=000e\n readonly END_PSP_FUNC=0ef1\n+readonly END_CSID_PSP_FUNC=a1\n+\n+readonly LCBLOCK_ADDR=fcbb:0\n+readonly LCBLOCK_BLEN=32\n+# do not add ':' as separator\n+readonly LCNODE_FMT=\"0%d\"\n+readonly LCNODE_BLEN=8\n+readonly LCNODEFUNC_BLEN=16\n+\n+readonly LCBLOCK_NODE_BLEN=$((LCBLOCK_BLEN + LCNODE_BLEN))\n+readonly LCBLOCK_NODEFUNC_BLEN=$((LCBLOCK_BLEN + LCNODEFUNC_BLEN))\n \n PING_TIMEOUT_SEC=4\n PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}\n@@ -397,6 +526,40 @@ __get_srv6_rtcfg_op()\n \t\txargs | sed 's/ /,/g'\n }\n \n+# Given the ID of a router and a Function, the function returns the C-SID made\n+# of the Locator-Node (8 bits), i.e. the ID of the router, followed by the\n+# Function (8 bits).\n+# e.g. input: \"4\" \"a1\"\n+# output: \"04a1\"\n+build_csid()\n+{\n+\tlocal nodeid=\"$1\"\n+\tlocal func=\"$2\"\n+\n+\tprintf \"${LCNODE_FMT}%s\" \"${nodeid}\" \"${func}\"\n+}\n+\n+# Given the \u003cnodeid\u003e token of a \"next-csid,\u003cflavors\u003e\" element, i.e. a\n+# comma-separated list of node IDs, and a Function, the function returns the\n+# C-SID container carrying the C-SIDs of these nodes.\n+# e.g. input: \"4,2\" \"a1\"\n+# output: \"fcbb:0:04a1:02a1::\"\n+build_csid_container()\n+{\n+\tlocal nodeids=\"$1\"\n+\tlocal func=\"$2\"\n+\tlocal csids=''\n+\tlocal nodes\n+\tlocal node\n+\n+\tnodes=\"$(echo \"${nodeids}\" | sed 's/,/ /g')\"\n+\tfor node in ${nodes}; do\n+\t\tcsids=\"${csids}:$(build_csid \"${node}\" \"${func}\")\"\n+\tdone\n+\n+\techo \"${LCBLOCK_ADDR}${csids}::\"\n+}\n+\n # Setup the basic networking for the routers\n setup_rt_networking()\n {\n@@ -439,6 +602,7 @@ setup_rt_local_sids()\n \tlocal devname\n \tlocal nsname\n \tlocal neigh\n+\tlocal csid\n \n \tnsname=\"$(get_rtname \"${rt}\")\"\n \n@@ -452,6 +616,14 @@ setup_rt_local_sids()\n \t\t\tadd \"${LOCATOR_SERVICE}:${neigh}::/32\" \\\n \t\t\ttable \"${LOCALSID_TABLE_ID}\" \\\n \t\t\tvia \"${net_prefix}::${neigh}\" dev \"${devname}\"\n+\n+\t\t# set underlay network routes to reach the C-SID containers\n+\t\t# that start with a C-SID of the neighbor, for any Function.\n+\t\tcsid=\"$(build_csid \"${neigh}\" 00)\"\n+\t\tip -netns \"${nsname}\" -6 route \\\n+\t\t\tadd \"${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODE_BLEN}\" \\\n+\t\t\ttable \"${LOCALSID_TABLE_ID}\" \\\n+\t\t\tvia \"${net_prefix}::${neigh}\" dev \"${devname}\"\n \tdone\n \n \t# Local End behavior (note that \"dev\" is a dummy interface chosen for\n@@ -461,6 +633,17 @@ setup_rt_local_sids()\n \t\ttable \"${LOCALSID_TABLE_ID}\" \\\n \t\tencap seg6local action End dev \"${DUMMY_DEVNAME}\"\n \n+\t# Local End behavior with the NEXT-C-SID and PSP flavors, bound to the\n+\t# C-SID of the router (e.g. fcbb:0:04a1::/48 on rt-4). The /48 prefix\n+\t# covers every C-SID container whose first C-SID is this one, whatever\n+\t# the Argument that follows.\n+\tcsid=\"$(build_csid \"${rt}\" \"${END_CSID_PSP_FUNC}\")\"\n+\tip -netns \"${nsname}\" -6 route \\\n+\t\tadd \"${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODEFUNC_BLEN}\" \\\n+\t\ttable \"${LOCALSID_TABLE_ID}\" \\\n+\t\tencap seg6local action End flavors next-csid,psp \\\n+\t\tlblen \"${LCBLOCK_BLEN}\" nflen \"${LCNODEFUNC_BLEN}\" \\\n+\t\tdev \"${DUMMY_DEVNAME}\"\n \n \t# all SIDs start with a common locator. Routes and SRv6 Endpoint\n \t# behavior instances are grouped together in the 'localsid' table.\n@@ -468,6 +651,12 @@ setup_rt_local_sids()\n \t\tadd to \"${LOCATOR_SERVICE}::/16\" \\\n \t\tlookup \"${LOCALSID_TABLE_ID}\" prio 999\n \n+\t# the C-SID containers use their own Locator-Block. Their routes and\n+\t# SRv6 Endpoint behavior instances are in the 'localsid' table too.\n+\tip -netns \"${nsname}\" -6 rule \\\n+\t\tadd to \"${LCBLOCK_ADDR}::/${LCBLOCK_BLEN}\" \\\n+\t\tlookup \"${LOCALSID_TABLE_ID}\" prio 999\n+\n \t# set default routes to unreachable\n \tip -netns \"${nsname}\" -6 route \\\n \t\tadd unreachable default metric 4278198272 \\\n@@ -479,12 +668,16 @@ setup_rt_local_sids()\n # configures the SRv6 nodes specified in the SID List to process the traffic\n # according to the operations required by the Policy itself.\n # args:\n-# $1 - destination host (i.e. cafe::x host)\n+# $1 - destination host (i.e. cafe::x host), or x:a1 for the address\n+# cafe::x:a1 on the loopback of the host\n # $2 - SRv6 router configured for enforcing the SRv6 Policy\n # $3 - compact way to represent a list of SRv6 routers with their operations\n # (i.e. behaviors) that each of them needs to perform. Every \u003cnodeid:op\u003e\n # element constructs a SID that is associated with the behavior \u003cop\u003e on\n # the \u003cnodeid\u003e node. The list of such elements forms an SRv6 Policy.\n+# For \"next-csid,psp\", \u003cnodeid\u003e is a comma-separated list of node IDs.\n+# The element constructs a C-SID container with the C-SIDs of these\n+# nodes, e.g. \"4,2:next-csid,psp\" gives fcbb:0:04a1:02a1::.\n __setup_rt_policy()\n {\n \tlocal dst=\"$1\"\n@@ -494,6 +687,7 @@ __setup_rt_policy()\n \tlocal in_nsname\n \tlocal rt_nsname\n \tlocal policy=''\n+\tlocal container\n \tlocal function\n \tlocal fullsid\n \tlocal op_type\n@@ -520,6 +714,15 @@ __setup_rt_policy()\n \t\t\tbehavior_cfg=\"End flavors psp\"\n \t\t\t;;\n \n+\t\t\"next-csid,psp\")\n+\t\t\t# the behavior is already set up on every router by\n+\t\t\t# setup_rt_local_sids.\n+\t\t\tcontainer=\"$(build_csid_container \"${node}\" \\\n+\t\t\t\t\"${END_CSID_PSP_FUNC}\")\"\n+\t\t\tpolicy=\"${policy}${container},\"\n+\t\t\tcontinue\n+\t\t\t;;\n+\n \t\t*)\n \t\t\tbreak\n \t\t\t;;\n@@ -571,6 +774,7 @@ setup_hs()\n \n \tip netns exec \"${hsname}\" sysctl -wq net.ipv6.conf.all.accept_dad=0\n \tip netns exec \"${hsname}\" sysctl -wq net.ipv6.conf.default.accept_dad=0\n+\tip netns exec \"${hsname}\" sysctl -wq net.ipv6.conf.all.seg6_enabled=0\n \n \tip -netns \"${hsname}\" link add veth0 type veth \\\n \t\tpeer name \"${RT2HS_DEVNAME}\" netns \"${rtname}\"\n@@ -590,6 +794,33 @@ setup_hs()\n \t\tsysctl -wq net.ipv6.conf.\"${RT2HS_DEVNAME}\".proxy_ndp=1\n }\n \n+# Set up an address on the loopback of a host, and the route towards it on the\n+# router connected to the host.\n+# args:\n+# $1 - host\n+# $2 - router connected to the host\n+# $3 - suffix of the address (i.e. cafe::\u003chost\u003e:\u003csuffix\u003e)\n+setup_hs_lo_addr()\n+{\n+\tlocal hs=\"$1\"\n+\tlocal rt=\"$2\"\n+\tlocal suffix=\"$3\"\n+\tlocal hsname\n+\tlocal rtname\n+\tlocal addr\n+\n+\thsname=\"$(get_hsname \"${hs}\")\"\n+\trtname=\"$(get_rtname \"${rt}\")\"\n+\taddr=\"${IPv6_HS_NETWORK}::${hs}:${suffix}\"\n+\n+\tip -netns \"${hsname}\" addr \\\n+\t\tadd \"${addr}/128\" dev lo nodad\n+\n+\tip -netns \"${rtname}\" -6 route \\\n+\t\tadd \"${addr}\" \\\n+\t\tvia \"${IPv6_HS_NETWORK}::${hs}\" dev \"${RT2HS_DEVNAME}\"\n+}\n+\n setup()\n {\n \tlocal i\n@@ -622,6 +853,11 @@ setup()\n \tsetup_hs 1 1\n \tsetup_hs 2 2\n \n+\t# set up the loopback addresses of the hosts used by the Policies (i.c)\n+\t# and (i.d).\n+\tsetup_hs_lo_addr 1 1 \"${END_CSID_PSP_FUNC}\"\n+\tsetup_hs_lo_addr 2 2 \"${END_CSID_PSP_FUNC}\"\n+\n \t# set up default SRv6 Endpoints (i.e. SRv6 End behavior)\n \tsetup_rt_local_sids 1 \"2 3 4\"\n \tsetup_rt_local_sids 2 \"1 3 4\"\n@@ -645,6 +881,21 @@ setup()\n \tsetup_rt_policy_ipv6 2 1 \"3:noflv 4:psp 2:psp\"\n \tsetup_rt_policy_ipv6 1 2 \"1:psp\"\n \n+\t# Direction hs-1 -\u003e hs-2 (cafe::2:a1, NEXT-C-SID and PSP flavors)\n+\t# - rt-1 (SRv6 H.Insert policy)\n+\t# - rt-3 (Argument=0 and SL\u003e1, acting as an End behavior)\n+\t# - rt-4 (Argument!=0 and SL=1, advancing the C-SID)\n+\t# - rt-2 (Argument=0 and SL=1, PSP)\n+\t#\n+\t# Direction hs-2 -\u003e hs-1 (cafe::1:a1, NEXT-C-SID and PSP flavors)\n+\t# - rt-2 (SRv6 H.Insert policy)\n+\t# - rt-4 (Argument!=0 and SL=1, advancing the C-SID)\n+\t# - rt-3 (Argument!=0 and SL=1, advancing the C-SID)\n+\t# - rt-1 (Argument=0 and SL=1, PSP)\n+\tsetup_rt_policy_ipv6 \"2:${END_CSID_PSP_FUNC}\" 1 \\\n+\t\t\"3:next-csid,psp 4,2:next-csid,psp\"\n+\tsetup_rt_policy_ipv6 \"1:${END_CSID_PSP_FUNC}\" 2 \"4,3,1:next-csid,psp\"\n+\n \t# testing environment was set up successfully\n \tSETUP_ERR=0\n }\n@@ -710,6 +961,20 @@ check_and_log_hs_connectivity()\n \tcheck_and_log_hs_ipv6_connectivity \"${hssrc}\" \"${hsdst}\"\n }\n \n+check_and_log_hs_lo_addr_connectivity()\n+{\n+\tlocal hssrc=\"$1\"\n+\tlocal hsdst=\"$2\"\n+\tlocal suffix=\"$3\"\n+\tlocal dst\n+\n+\tdst=\"${IPv6_HS_NETWORK}::${hsdst}:${suffix}\"\n+\n+\tcheck_hs_ipv6_connectivity \"${hssrc}\" \"${hsdst}:${suffix}\"\n+\tlog_test $? 0 \\\n+\t\t\"IPv6 Hosts connectivity: hs-${hssrc} -\u003e hs-${hsdst} (${dst})\"\n+}\n+\n router_tests()\n {\n \tlocal i\n@@ -747,6 +1012,100 @@ host_srv6_end_flv_psp_tests()\n \tcheck_and_log_hs_connectivity 2 1\n }\n \n+host_srv6_end_flv_next_csid_psp_tests()\n+{\n+\tlog_section \"SRv6 connectivity test hosts (h1 \u003c-\u003e h2, NEXT-C-SID,PSP)\"\n+\n+\tcheck_and_log_hs_lo_addr_connectivity 1 2 \"${END_CSID_PSP_FUNC}\"\n+\tcheck_and_log_hs_lo_addr_connectivity 2 1 \"${END_CSID_PSP_FUNC}\"\n+}\n+\n+# On a router, add a route for a SID with seg6 encap in inline mode. The packets\n+# that the router forwards to that SID get an extra SRH with the End SID of the\n+# router that consumes it.\n+# args:\n+# $1 - router on which the route is added\n+# $2 - SID of the route\n+# $3 - router with the SRv6 End behavior that consumes the extra SRH\n+setup_rt_consumed_srh()\n+{\n+\tlocal rt=\"$1\"\n+\tlocal sid=\"$2\"\n+\tlocal end_rt=\"$3\"\n+\tlocal nsname\n+\n+\tnsname=\"$(get_rtname \"${rt}\")\"\n+\n+\tip -netns \"${nsname}\" -6 route \\\n+\t\tadd \"${sid}\" table \"${LOCALSID_TABLE_ID}\" \\\n+\t\tencap seg6 mode inline \\\n+\t\tsegs \"${LOCATOR_SERVICE}:${end_rt}::${END_FUNC}\" \\\n+\t\tdev \"${DUMMY_DEVNAME}\"\n+}\n+\n+cleanup_rt_consumed_srh()\n+{\n+\tlocal rt=\"$1\"\n+\tlocal sid=\"$2\"\n+\tlocal nsname\n+\n+\tnsname=\"$(get_rtname \"${rt}\")\"\n+\n+\tip -netns \"${nsname}\" -6 route \\\n+\t\tdel \"${sid}\" table \"${LOCALSID_TABLE_ID}\"\n+}\n+\n+set_hs_seg6_enabled()\n+{\n+\tlocal val=\"$1\"\n+\tlocal hsname\n+\tlocal hs\n+\n+\tfor hs in ${HOSTS}; do\n+\t\thsname=\"$(get_hsname \"${hs}\")\"\n+\n+\t\tip netns exec \"${hsname}\" \\\n+\t\t\tsysctl -wq net.ipv6.conf.all.seg6_enabled=\"${val}\"\n+\t\tip netns exec \"${hsname}\" \\\n+\t\t\tsysctl -wq net.ipv6.conf.veth0.seg6_enabled=\"${val}\"\n+\tdone\n+}\n+\n+host_srv6_end_flv_consumed_srh_tests()\n+{\n+\tlocal sid\n+\n+\tlog_section \"SRv6 connectivity test hosts (h1 \u003c-\u003e h2, consumed SRH)\"\n+\n+\tset_hs_seg6_enabled 1\n+\n+\t# Policy (i.a): rt-4 inserts the extra SRH consumed by rt-3\n+\tsid=\"${LOCATOR_SERVICE}:2::${END_PSP_FUNC}\"\n+\tsetup_rt_consumed_srh 4 \"${sid}\" 3\n+\tcheck_and_log_hs_connectivity 1 2\n+\tcleanup_rt_consumed_srh 4 \"${sid}\"\n+\n+\t# Policy (i.b): rt-2 inserts the extra SRH consumed by rt-3\n+\tsid=\"${LOCATOR_SERVICE}:1::${END_PSP_FUNC}\"\n+\tsetup_rt_consumed_srh 2 \"${sid}\" 3\n+\tcheck_and_log_hs_connectivity 2 1\n+\tcleanup_rt_consumed_srh 2 \"${sid}\"\n+\n+\t# Policy (i.c): rt-4 inserts the extra SRH consumed by rt-3\n+\tsid=\"$(build_csid_container 2 \"${END_CSID_PSP_FUNC}\")\"\n+\tsetup_rt_consumed_srh 4 \"${sid}\" 3\n+\tcheck_and_log_hs_lo_addr_connectivity 1 2 \"${END_CSID_PSP_FUNC}\"\n+\tcleanup_rt_consumed_srh 4 \"${sid}\"\n+\n+\t# Policy (i.d): rt-3 inserts the extra SRH consumed by rt-4\n+\tsid=\"$(build_csid_container 1 \"${END_CSID_PSP_FUNC}\")\"\n+\tsetup_rt_consumed_srh 3 \"${sid}\" 4\n+\tcheck_and_log_hs_lo_addr_connectivity 2 1 \"${END_CSID_PSP_FUNC}\"\n+\tcleanup_rt_consumed_srh 3 \"${sid}\"\n+\n+\tset_hs_seg6_enabled 0\n+}\n+\n test_iproute2_supp_or_ksft_skip()\n {\n \tlocal flavor=\"$1\"\n@@ -836,6 +1195,8 @@ test_command_or_ksft_skip sort\n test_command_or_ksft_skip xargs\n \n test_dummy_dev_or_ksft_skip\n+# NEXT-C-SID is not checked: every kernel and iproute2 version that\n+# supports PSP also supports NEXT-C-SID.\n test_iproute2_supp_or_ksft_skip psp\n test_kernel_supp_or_ksft_skip psp\n \n@@ -848,5 +1209,7 @@ set +e\n router_tests\n host2gateway_tests\n host_srv6_end_flv_psp_tests\n+host_srv6_end_flv_next_csid_psp_tests\n+host_srv6_end_flv_consumed_srh_tests\n \n print_log_test_results\n"
} |
| 2/1 | 2026/10/11 19:54 | agent | patch-evaluator |
3mModel:core Args: null Results: {
"EnableConfigs": [
"IPV6",
"IPV6_SEG6_LWTUNNEL"
],
"FocusSymbols": [
"input_action_end",
"end_flv8986_core",
"seg6_pop_srh",
"seg6_use_next_csid",
"seg6_flv8986_get_srh",
"seg6_local_input"
],
"Reasoning": "The patch modifies the SRv6 (Segment Routing over IPv6) local behavior handling in net/ipv6/seg6_local.c, specifically altering how the NEXT-C-SID flavor interacts with RFC8986 flavors (such as PSP) and how SRH headers are parsed and popped (seg6_pop_srh and seg6_flv8986_get_srh) when dealing with preceding or consumed routing headers. This touches reachable core networking packet-processing and header-mangling logic that can be tested in virtualized environments via standard IPv6 sockets, netlink route configuration, and virtual interfaces.",
"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 b4212b90c23edcde19abd37fec5edc03ee10dfb8
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Oct 11 19:54:37 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 0c3d1be7f1299..427d12fedfc3e 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -551,6 +551,47 @@ static bool seg6_next_csid_enabled(__u32 fops)
return fops & SEG6_F_LOCAL_FLV_NEXT_CSID;
}
+static bool seg6_flv8986_enabled(__u32 fops)
+{
+ return fops & SEG6_LOCAL_FLV8986_SUPP_OPS;
+}
+
+/* check whether the NEXT-C-SID processing has to be used for the packet,
+ * instead of the RFC8986 flavors set for the given SRv6 End* behavior
+ * instance.
+ *
+ * This function returns:
+ * - true, when the packet has to go through the NEXT-C-SID processing;
+ * - false, when NEXT-C-SID is not configured or the packet has to be
+ * processed on the basis of the RFC8986 flavors.
+ */
+static bool seg6_use_next_csid(struct sk_buff *skb,
+ const struct seg6_flavors_info *finfo)
+{
+ const struct in6_addr *addr;
+ __u32 fops = finfo->flv_ops;
+
+ if (!seg6_next_csid_enabled(fops))
+ return false;
+
+ addr = &ipv6_hdr(skb)->daddr;
+
+ /* NEXT-C-SID and the RFC8986 flavors combine according to the
+ * DA.Argument (see RFC9800, sections 4.1.1 and 4.1.7):
+ *
+ * DA.Argument RFC8986 flavors processing
+ * (1) != 0 any NEXT-C-SID only, SL unchanged
+ * (2) == 0 none the behavior, e.g. End
+ * (3) == 0 one or more the behavior with its flavors,
+ * e.g. End with PSP
+ *
+ * In (2), the packet still goes through the NEXT-C-SID processing,
+ * which runs the behavior (e.g. End) when the DA.Argument is zero.
+ */
+ return !seg6_flv8986_enabled(fops) ||
+ !seg6_next_csid_is_arg_zero(addr, finfo);
+}
+
/* Processing of SRv6 End, End.X, and End.T behaviors can be extended through
* the flavors framework. These behaviors must report the subset of (flavor)
* operations they currently implement. In this way, if a user specifies a
@@ -775,11 +816,14 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
skb_set_transport_header(skb, thoff);
iph = ipv6_hdr(skb);
- if (iph->nexthdr == NEXTHDR_ROUTING) {
+ if (srhoff == sizeof(*iph)) {
iph->nexthdr = srh_nexthdr;
} else {
/* we must look for the extension header (EXTH, for short) that
- * immediately precedes the SRH we have just removed.
+ * immediately precedes the SRH we have just removed, i.e. the
+ * EXTH that ends at srhoff. We find it by its position and not
+ * by its nexthdr, since another routing header (e.g. an SRH
+ * with SL = 0) may come before the removed SRH.
* Then, we update the value of the EXTH nexthdr with the one
* contained in the SRH nexthdr.
*/
@@ -796,11 +840,6 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
if (unlikely(!hp))
return false;
- if (hp->nexthdr == NEXTHDR_ROUTING) {
- hp->nexthdr = srh_nexthdr;
- break;
- }
-
switch (nexthdr) {
case NEXTHDR_FRAGMENT:
fallthrough;
@@ -812,6 +851,11 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
break;
}
+ if (off == srhoff) {
+ hp->nexthdr = srh_nexthdr;
+ break;
+ }
+
nexthdr = hp->nexthdr;
}
}
@@ -823,6 +867,24 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
return true;
}
+/* look up the SRH to be processed by the RFC8986 flavors. As End does, a
+ * routing header with SL = 0 is skipped (e.g. an SRH already consumed).
+ * This function returns NULL when no valid SRH is found.
+ */
+static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)
+{
+ struct ipv6_sr_hdr *srh;
+
+ srh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);
+ if (srh)
+ return srh;
+
+ /* we take the first routing header without skipping it. In this way,
+ * seg6_get_srh_pktinfo() reports SL = 0 and not a missing SRH.
+ */
+ return seg6_get_srh(skb, 0);
+}
+
/* process the packet on the basis of the RFC8986 flavors set for the given
* SRv6 End behavior instance.
*/
@@ -837,14 +899,17 @@ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
__u32 flvmask;
int srhoff;
- srh = seg6_get_srh(skb, 0);
+ srh = seg6_flv8986_get_srh(skb);
srhoff = srh ? ((unsigned char *)srh - skb->data) : 0;
pinfo = seg6_get_srh_pktinfo(srh);
#ifdef CONFIG_IPV6_SEG6_HMAC
if (srh && !seg6_hmac_validate_skb(skb, srh))
goto drop;
#endif
- flvmask = finfo->flv_ops;
+ /* NEXT-C-SID, when configured, has already been evaluated by the
+ * caller. Only the RFC8986 flavors are left here.
+ */
+ flvmask = finfo->flv_ops & ~SEG6_F_LOCAL_FLV_NEXT_CSID;
if (unlikely(flvmask & ~SEG6_LOCAL_FLV8986_SUPP_OPS)) {
pr_warn_once("seg6local: invalid RFC8986 flavors\n");
goto drop;
@@ -898,8 +963,8 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
if (!fops)
return input_action_end_core(skb, slwt);
- /* check for the presence of NEXT-C-SID since it applies first */
- if (seg6_next_csid_enabled(fops))
+ /* NEXT-C-SID is evaluated first, when configured */
+ if (seg6_use_next_csid(skb, finfo))
return end_next_csid_core(skb, slwt);
/* the specific processing function to be performed on the packet
diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 30a939392eea4..b5dbf53a7f238 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -16,13 +16,13 @@
#
# The End, End.X, and End.T behaviors can support these flavors either
# individually or in combinations.
-# Currently in this selftest we consider only the PSP flavor for the SRv6 End
-# behavior. However, it is possible to extend the script as soon as other
+# Currently in this selftest we consider the PSP flavor for the SRv6 End
+# behavior, both alone and combined with the NEXT-C-SID flavor defined in
+# RFC9800 [2]. However, it is possible to extend the script as soon as other
# flavors will be supported in the kernel.
#
# The purpose of the PSP flavor consists in instructing the penultimate node
-# listed in the SRv6 policy to remove (i.e. pop) the outermost SRH from the IPv6
-# header.
+# listed in the SRv6 policy to remove (i.e. pop) the SRH from the IPv6 header.
# A PSP enabled SRv6 End behavior instance processes the SRH by:
# - decrementing the Segment Left (SL) value from 1 to 0;
# - copying the last SID from the SID List into the IPv6 Destination Address
@@ -47,7 +47,20 @@
# "standard" End packet processing, ignoring the configured PSP flavor at
# all.
#
+# The NEXT-C-SID flavor (referred to as NEXT-CSID in RFC9800 [2]) and the
+# C-SID containers are described in srv6_end_next_csid_l3vpn_test.sh, which
+# also tests this flavor for the SRv6 End behavior.
+#
+# When the NEXT-C-SID flavor is combined with the PSP, USP or USD flavors, these
+# flavors are left unchanged [2]. The NEXT-C-SID processing comes first: with a
+# non-zero Argument, the IPv6 DA is updated with the next C-SID and the packet
+# is forwarded without changing the SRH, if any. The packet goes through the End
+# behavior with the other flavors only when the Argument is zero, i.e. when the
+# IPv6 DA carries no further C-SID. For example, the PSP operation takes place
+# only for a C-SID container with a zero Argument and SL=1.
+#
# [1] RFC8986: https://datatracker.ietf.org/doc/html/rfc8986
+# [2] RFC9800: https://datatracker.ietf.org/doc/html/rfc9800
#
# Network topology
# ================
@@ -115,12 +128,30 @@
# +---------------------------------------------------------------------+
# |fcff:x::e is associated with the SRv6 End behavior |
# |fcff:x::ef1 is associated with the SRv6 End behavior with PSP flavor |
+# |fcbb:0:0xyy::/48 is associated with the SRv6 behavior and the |
+# | flavors of the Function yy |
# +---------------------------------------------------------------------+
#
# The fcff::/16 prefix is reserved by the operator for the SIDs. Reachability of
# SIDs is ensured by proper configuration of the IPv6 operator's network and
# SRv6 routers.
#
+# Similarly, the fcbb:0::/32 prefix is reserved by the operator for the C-SID
+# containers and it is used as their Locator-Block.
+# A C-SID (16 bits) is made of the Locator-Node (8 bits), i.e. the ID of the
+# router, followed by the Function (8 bits). The first digit of the Function
+# selects the SRv6 behavior and the second one the flavors combined with
+# NEXT-C-SID:
+#
+# +----------+----------+--------------------+
+# | Function | behavior | flavors |
+# +----------+----------+--------------------+
+# | a1 | End | NEXT-C-SID and PSP |
+# +----------+----------+--------------------+
+#
+# For example, fcbb:0:04a1:02a1:: is a C-SID container carrying the C-SID of
+# rt-4 followed by the C-SID of rt-2, both with the NEXT-C-SID and PSP flavors.
+#
#
# SRv6 Policies
# =============
@@ -193,6 +224,93 @@
# set with the last SID; iii) the SRH is removed from the extension headers
# after the IPv6 header. At this point, the packet with IPv6 DA=cafe::1 is sent
# to the destination, i.e. hs-1.
+#
+# Traffic to the loopback addresses of the hosts
+# ----------------------------------------------
+#
+# Each host has an address on its loopback, cafe::x:a1. The traffic from the
+# other host towards this address is steered with C-SID containers: after the
+# ingress router, every router crossed applies the SRv6 End behavior with the
+# NEXT-C-SID and PSP flavors. The following SRv6 Policies are applied by rt-1
+# to the traffic towards cafe::2:a1 (i.c) and by rt-2 to the traffic towards
+# cafe::1:a1 (i.d):
+#
+# i.c) IPv6 traffic, SID List=fcbb:0:03a1::,fcbb:0:04a1:02a1::,cafe::2:a1
+# i.d) IPv6 traffic, SID List=fcbb:0:04a1:03a1:01a1::,cafe::1:a1
+#
+# In the Policy (i.c), rt-3 receives a zero Argument with SL=2 and applies the
+# "standard" End processing. rt-4 receives a non-zero Argument with SL=1: it
+# advances to the next C-SID and does *NOT* apply the PSP operation. rt-2
+# receives a zero Argument with SL=1 and applies the PSP operation.
+#
+# In the Policy (i.d), a single C-SID container carries three C-SIDs. rt-4 and
+# rt-3 receive a non-zero Argument with SL=1: they advance to the next C-SID and
+# do *NOT* apply the PSP operation. rt-1 receives a zero Argument with SL=1
+# and applies the PSP operation.
+#
+# The hosts use cafe::x as the source address, not the loopback address. The
+# replies are sent to cafe::x and follow the Policies (i.a) and (i.b), which
+# are tested first. This way, each ping checks a single Policy with the
+# NEXT-C-SID flavor, and a failure points directly to that Policy.
+#
+# The hosts drop the packets that carry an SRH (seg6_enabled is set to 0 on
+# the hosts). The loopback address of a host is reached only through the
+# router connected to that host: the ping succeeds only if the SRH is removed
+# by that router.
+#
+# Traffic with a consumed SRH
+# ---------------------------
+#
+# A packet can carry more than one SRH. The SRv6 End behavior skips an SRH with
+# SL=0 and processes the next header [1].
+#
+# The traffic of this section reuses the Policies (i.a), (i.b), (i.c) and (i.d).
+# A router on the path inserts an extra SRH in front of the Policy's SRH, and
+# another router then consumes the extra SRH.
+#
+# The Policy (i.a) has SID List=fcff:3::e,fcff:4::ef1,fcff:2::ef1,cafe::2. A
+# packet from hs-1 to hs-2 goes as follows:
+#
+# - rt-1 applies the Policy and sends the packet to rt-3:
+# IPv6 DA=fcff:3::e | Policy's SRH, SL=3 | Payload
+#
+# - rt-3 (End) processes the Policy's SRH and sends the packet to rt-4:
+# IPv6 DA=fcff:4::ef1 | Policy's SRH, SL=2 | Payload
+#
+# - rt-4 (End with PSP and SL>1, acting as End) processes the Policy's SRH.
+# The new DA is fcff:2::ef1:
+# IPv6 DA=fcff:2::ef1 | Policy's SRH, SL=1 | Payload
+# On rt-4, the route added by the test for fcff:2::ef1 then inserts the
+# extra SRH, with SID List=fcff:3::e,fcff:2::ef1, and the packet goes back to
+# rt-3:
+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload
+#
+# - rt-3 (End) consumes the extra SRH and sets the DA back to fcff:2::ef1:
+# IPv6 DA=fcff:2::ef1 | extra SRH, SL=0 | Policy's SRH, SL=1 | Payload
+#
+# - rt-2 (End with PSP) skips the extra SRH, processes the Policy's SRH and
+# removes it:
+# IPv6 DA=cafe::2 | extra SRH, SL=0 | Payload
+#
+# The extra SRH reaches hs-2, which skips it as its SL is 0. The other
+# Policies work in the same way:
+#
+# (i.b) hs-2 -> hs-1: on the packets with DA=fcff:1::ef1, rt-2 inserts the
+# extra SRH with SID List=fcff:3::e,fcff:1::ef1, and rt-3 consumes it.
+# (i.c) hs-1 -> hs-2: on the packets with DA=fcbb:0:02a1::, rt-4 inserts the
+# extra SRH with SID List=fcff:3::e,fcbb:0:02a1::, and rt-3 consumes it.
+# (i.d) hs-2 -> hs-1: on the packets with DA=fcbb:0:01a1::, rt-3 inserts the
+# extra SRH with SID List=fcff:4::e,fcbb:0:01a1::, and rt-4 consumes it.
+#
+# The Policy (i.b) has no router between rt-2 and rt-1. For this reason, rt-2
+# applies the Policy, inserts the extra SRH and sends the packet to rt-3:
+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload
+# rt-3 consumes the extra SRH, and rt-1 removes the Policy's SRH.
+#
+# The hosts need seg6_enabled set to 1 to accept the extra SRH, and it is set
+# back to 0 at the end. These tests only check that the ping succeeds: PSP
+# itself is checked by the PSP flavor and NEXT-C-SID,PSP tests, which run with
+# seg6_enabled set to 0.
# shellcheck source=lib.sh
source lib.sh
@@ -207,6 +325,17 @@ readonly IPv6_TESTS_ADDR=2001:db8::1
readonly LOCATOR_SERVICE=fcff
readonly END_FUNC=000e
readonly END_PSP_FUNC=0ef1
+readonly END_CSID_PSP_FUNC=a1
+
+readonly LCBLOCK_ADDR=fcbb:0
+readonly LCBLOCK_BLEN=32
+# do not add ':' as separator
+readonly LCNODE_FMT="0%d"
+readonly LCNODE_BLEN=8
+readonly LCNODEFUNC_BLEN=16
+
+readonly LCBLOCK_NODE_BLEN=$((LCBLOCK_BLEN + LCNODE_BLEN))
+readonly LCBLOCK_NODEFUNC_BLEN=$((LCBLOCK_BLEN + LCNODEFUNC_BLEN))
PING_TIMEOUT_SEC=4
PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
@@ -397,6 +526,40 @@ __get_srv6_rtcfg_op()
xargs | sed 's/ /,/g'
}
+# Given the ID of a router and a Function, the function returns the C-SID made
+# of the Locator-Node (8 bits), i.e. the ID of the router, followed by the
+# Function (8 bits).
+# e.g. input: "4" "a1"
+# output: "04a1"
+build_csid()
+{
+ local nodeid="$1"
+ local func="$2"
+
+ printf "${LCNODE_FMT}%s" "${nodeid}" "${func}"
+}
+
+# Given the <nodeid> token of a "next-csid,<flavors>" element, i.e. a
+# comma-separated list of node IDs, and a Function, the function returns the
+# C-SID container carrying the C-SIDs of these nodes.
+# e.g. input: "4,2" "a1"
+# output: "fcbb:0:04a1:02a1::"
+build_csid_container()
+{
+ local nodeids="$1"
+ local func="$2"
+ local csids=''
+ local nodes
+ local node
+
+ nodes="$(echo "${nodeids}" | sed 's/,/ /g')"
+ for node in ${nodes}; do
+ csids="${csids}:$(build_csid "${node}" "${func}")"
+ done
+
+ echo "${LCBLOCK_ADDR}${csids}::"
+}
+
# Setup the basic networking for the routers
setup_rt_networking()
{
@@ -439,6 +602,7 @@ setup_rt_local_sids()
local devname
local nsname
local neigh
+ local csid
nsname="$(get_rtname "${rt}")"
@@ -452,6 +616,14 @@ setup_rt_local_sids()
add "${LOCATOR_SERVICE}:${neigh}::/32" \
table "${LOCALSID_TABLE_ID}" \
via "${net_prefix}::${neigh}" dev "${devname}"
+
+ # set underlay network routes to reach the C-SID containers
+ # that start with a C-SID of the neighbor, for any Function.
+ csid="$(build_csid "${neigh}" 00)"
+ ip -netns "${nsname}" -6 route \
+ add "${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODE_BLEN}" \
+ table "${LOCALSID_TABLE_ID}" \
+ via "${net_prefix}::${neigh}" dev "${devname}"
done
# Local End behavior (note that "dev" is a dummy interface chosen for
@@ -461,6 +633,17 @@ setup_rt_local_sids()
table "${LOCALSID_TABLE_ID}" \
encap seg6local action End dev "${DUMMY_DEVNAME}"
+ # Local End behavior with the NEXT-C-SID and PSP flavors, bound to the
+ # C-SID of the router (e.g. fcbb:0:04a1::/48 on rt-4). The /48 prefix
+ # covers every C-SID container whose first C-SID is this one, whatever
+ # the Argument that follows.
+ csid="$(build_csid "${rt}" "${END_CSID_PSP_FUNC}")"
+ ip -netns "${nsname}" -6 route \
+ add "${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODEFUNC_BLEN}" \
+ table "${LOCALSID_TABLE_ID}" \
+ encap seg6local action End flavors next-csid,psp \
+ lblen "${LCBLOCK_BLEN}" nflen "${LCNODEFUNC_BLEN}" \
+ dev "${DUMMY_DEVNAME}"
# all SIDs start with a common locator. Routes and SRv6 Endpoint
# behavior instances are grouped together in the 'localsid' table.
@@ -468,6 +651,12 @@ setup_rt_local_sids()
add to "${LOCATOR_SERVICE}::/16" \
lookup "${LOCALSID_TABLE_ID}" prio 999
+ # the C-SID containers use their own Locator-Block. Their routes and
+ # SRv6 Endpoint behavior instances are in the 'localsid' table too.
+ ip -netns "${nsname}" -6 rule \
+ add to "${LCBLOCK_ADDR}::/${LCBLOCK_BLEN}" \
+ lookup "${LOCALSID_TABLE_ID}" prio 999
+
# set default routes to unreachable
ip -netns "${nsname}" -6 route \
add unreachable default metric 4278198272 \
@@ -479,12 +668,16 @@ setup_rt_local_sids()
# configures the SRv6 nodes specified in the SID List to process the traffic
# according to the operations required by the Policy itself.
# args:
-# $1 - destination host (i.e. cafe::x host)
+# $1 - destination host (i.e. cafe::x host), or x:a1 for the address
+# cafe::x:a1 on the loopback of the host
# $2 - SRv6 router configured for enforcing the SRv6 Policy
# $3 - compact way to represent a list of SRv6 routers with their operations
# (i.e. behaviors) that each of them needs to perform. Every <nodeid:op>
# element constructs a SID that is associated with the behavior <op> on
# the <nodeid> node. The list of such elements forms an SRv6 Policy.
+# For "next-csid,psp", <nodeid> is a comma-separated list of node IDs.
+# The element constructs a C-SID container with the C-SIDs of these
+# nodes, e.g. "4,2:next-csid,psp" gives fcbb:0:04a1:02a1::.
__setup_rt_policy()
{
local dst="$1"
@@ -494,6 +687,7 @@ __setup_rt_policy()
local in_nsname
local rt_nsname
local policy=''
+ local container
local function
local fullsid
local op_type
@@ -520,6 +714,15 @@ __setup_rt_policy()
behavior_cfg="End flavors psp"
;;
+ "next-csid,psp")
+ # the behavior is already set up on every router by
+ # setup_rt_local_sids.
+ container="$(build_csid_container "${node}" \
+ "${END_CSID_PSP_FUNC}")"
+ policy="${policy}${container},"
+ continue
+ ;;
+
*)
break
;;
@@ -571,6 +774,7 @@ setup_hs()
ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.all.accept_dad=0
ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.default.accept_dad=0
+ ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.all.seg6_enabled=0
ip -netns "${hsname}" link add veth0 type veth \
peer name "${RT2HS_DEVNAME}" netns "${rtname}"
@@ -590,6 +794,33 @@ setup_hs()
sysctl -wq net.ipv6.conf."${RT2HS_DEVNAME}".proxy_ndp=1
}
+# Set up an address on the loopback of a host, and the route towards it on the
+# router connected to the host.
+# args:
+# $1 - host
+# $2 - router connected to the host
+# $3 - suffix of the address (i.e. cafe::<host>:<suffix>)
+setup_hs_lo_addr()
+{
+ local hs="$1"
+ local rt="$2"
+ local suffix="$3"
+ local hsname
+ local rtname
+ local addr
+
+ hsname="$(get_hsname "${hs}")"
+ rtname="$(get_rtname "${rt}")"
+ addr="${IPv6_HS_NETWORK}::${hs}:${suffix}"
+
+ ip -netns "${hsname}" addr \
+ add "${addr}/128" dev lo nodad
+
+ ip -netns "${rtname}" -6 route \
+ add "${addr}" \
+ via "${IPv6_HS_NETWORK}::${hs}" dev "${RT2HS_DEVNAME}"
+}
+
setup()
{
local i
@@ -622,6 +853,11 @@ setup()
setup_hs 1 1
setup_hs 2 2
+ # set up the loopback addresses of the hosts used by the Policies (i.c)
+ # and (i.d).
+ setup_hs_lo_addr 1 1 "${END_CSID_PSP_FUNC}"
+ setup_hs_lo_addr 2 2 "${END_CSID_PSP_FUNC}"
+
# set up default SRv6 Endpoints (i.e. SRv6 End behavior)
setup_rt_local_sids 1 "2 3 4"
setup_rt_local_sids 2 "1 3 4"
@@ -645,6 +881,21 @@ setup()
setup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp"
setup_rt_policy_ipv6 1 2 "1:psp"
+ # Direction hs-1 -> hs-2 (cafe::2:a1, NEXT-C-SID and PSP flavors)
+ # - rt-1 (SRv6 H.Insert policy)
+ # - rt-3 (Argument=0 and SL>1, acting as an End behavior)
+ # - rt-4 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-2 (Argument=0 and SL=1, PSP)
+ #
+ # Direction hs-2 -> hs-1 (cafe::1:a1, NEXT-C-SID and PSP flavors)
+ # - rt-2 (SRv6 H.Insert policy)
+ # - rt-4 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-3 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-1 (Argument=0 and SL=1, PSP)
+ setup_rt_policy_ipv6 "2:${END_CSID_PSP_FUNC}" 1 \
+ "3:next-csid,psp 4,2:next-csid,psp"
+ setup_rt_policy_ipv6 "1:${END_CSID_PSP_FUNC}" 2 "4,3,1:next-csid,psp"
+
# testing environment was set up successfully
SETUP_ERR=0
}
@@ -710,6 +961,20 @@ check_and_log_hs_connectivity()
check_and_log_hs_ipv6_connectivity "${hssrc}" "${hsdst}"
}
+check_and_log_hs_lo_addr_connectivity()
+{
+ local hssrc="$1"
+ local hsdst="$2"
+ local suffix="$3"
+ local dst
+
+ dst="${IPv6_HS_NETWORK}::${hsdst}:${suffix}"
+
+ check_hs_ipv6_connectivity "${hssrc}" "${hsdst}:${suffix}"
+ log_test $? 0 \
+ "IPv6 Hosts connectivity: hs-${hssrc} -> hs-${hsdst} (${dst})"
+}
+
router_tests()
{
local i
@@ -747,6 +1012,100 @@ host_srv6_end_flv_psp_tests()
check_and_log_hs_connectivity 2 1
}
+host_srv6_end_flv_next_csid_psp_tests()
+{
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, NEXT-C-SID,PSP)"
+
+ check_and_log_hs_lo_addr_connectivity 1 2 "${END_CSID_PSP_FUNC}"
+ check_and_log_hs_lo_addr_connectivity 2 1 "${END_CSID_PSP_FUNC}"
+}
+
+# On a router, add a route for a SID with seg6 encap in inline mode. The packets
+# that the router forwards to that SID get an extra SRH with the End SID of the
+# router that consumes it.
+# args:
+# $1 - router on which the route is added
+# $2 - SID of the route
+# $3 - router with the SRv6 End behavior that consumes the extra SRH
+setup_rt_consumed_srh()
+{
+ local rt="$1"
+ local sid="$2"
+ local end_rt="$3"
+ local nsname
+
+ nsname="$(get_rtname "${rt}")"
+
+ ip -netns "${nsname}" -6 route \
+ add "${sid}" table "${LOCALSID_TABLE_ID}" \
+ encap seg6 mode inline \
+ segs "${LOCATOR_SERVICE}:${end_rt}::${END_FUNC}" \
+ dev "${DUMMY_DEVNAME}"
+}
+
+cleanup_rt_consumed_srh()
+{
+ local rt="$1"
+ local sid="$2"
+ local nsname
+
+ nsname="$(get_rtname "${rt}")"
+
+ ip -netns "${nsname}" -6 route \
+ del "${sid}" table "${LOCALSID_TABLE_ID}"
+}
+
+set_hs_seg6_enabled()
+{
+ local val="$1"
+ local hsname
+ local hs
+
+ for hs in ${HOSTS}; do
+ hsname="$(get_hsname "${hs}")"
+
+ ip netns exec "${hsname}" \
+ sysctl -wq net.ipv6.conf.all.seg6_enabled="${val}"
+ ip netns exec "${hsname}" \
+ sysctl -wq net.ipv6.conf.veth0.seg6_enabled="${val}"
+ done
+}
+
+host_srv6_end_flv_consumed_srh_tests()
+{
+ local sid
+
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, consumed SRH)"
+
+ set_hs_seg6_enabled 1
+
+ # Policy (i.a): rt-4 inserts the extra SRH consumed by rt-3
+ sid="${LOCATOR_SERVICE}:2::${END_PSP_FUNC}"
+ setup_rt_consumed_srh 4 "${sid}" 3
+ check_and_log_hs_connectivity 1 2
+ cleanup_rt_consumed_srh 4 "${sid}"
+
+ # Policy (i.b): rt-2 inserts the extra SRH consumed by rt-3
+ sid="${LOCATOR_SERVICE}:1::${END_PSP_FUNC}"
+ setup_rt_consumed_srh 2 "${sid}" 3
+ check_and_log_hs_connectivity 2 1
+ cleanup_rt_consumed_srh 2 "${sid}"
+
+ # Policy (i.c): rt-4 inserts the extra SRH consumed by rt-3
+ sid="$(build_csid_container 2 "${END_CSID_PSP_FUNC}")"
+ setup_rt_consumed_srh 4 "${sid}" 3
+ check_and_log_hs_lo_addr_connectivity 1 2 "${END_CSID_PSP_FUNC}"
+ cleanup_rt_consumed_srh 4 "${sid}"
+
+ # Policy (i.d): rt-3 inserts the extra SRH consumed by rt-4
+ sid="$(build_csid_container 1 "${END_CSID_PSP_FUNC}")"
+ setup_rt_consumed_srh 3 "${sid}" 4
+ check_and_log_hs_lo_addr_connectivity 2 1 "${END_CSID_PSP_FUNC}"
+ cleanup_rt_consumed_srh 3 "${sid}"
+
+ set_hs_seg6_enabled 0
+}
+
test_iproute2_supp_or_ksft_skip()
{
local flavor="$1"
@@ -836,6 +1195,8 @@ test_command_or_ksft_skip sort
test_command_or_ksft_skip xargs
test_dummy_dev_or_ksft_skip
+# NEXT-C-SID is not checked: every kernel and iproute2 version that
+# supports PSP also supports NEXT-C-SID.
test_iproute2_supp_or_ksft_skip psp
test_kernel_supp_or_ksft_skip psp
@@ -848,5 +1209,7 @@ set +e
router_tests
host2gateway_tests
host_srv6_end_flv_psp_tests
+host_srv6_end_flv_next_csid_psp_tests
+host_srv6_end_flv_consumed_srh_tests
print_log_test_results
|
| 3/2 | 2026/10/11 19:54 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 12358 output: 31 thoughts: 909 Thoughts: **SRv6 Patch Series Evaluation for Syzkaller Fuzzing** Okay, I need to evaluate this patch series for its fuzzing potential within syzkaller. My initial impression is that this is potentially very interesting because it modifies the SRv6 (Segment Routing over IPv6) local segment behavior. The patch touches `net/ipv6/seg6_local.c` and `tools/testing/selftests/net/srv6_end_flavors_test.sh`. The file changes are: `seg6_flv8986_enabled()` and `seg6_use_next_csid()` helpers were added; `seg6_pop_srh()` has been modified. There are changes to the `seg6_flv8986_get_srh()` and `end_flv8986_core()` helpers. Lastly, the check in `input_action_end()` has changed to use the `seg6_use_next_csid()` helper. My initial reaction is this is a core networking change. The changes look like they're related to how the SRv6 stack handles specific flavors, specifically dealing with NEXT-C-SID combined with PSP and consumed SRH handling. This makes it a target worth fuzzing because it's handling corner cases in SRv6 which is known to be a complex area! Now, how about reachability? Can syzkaller actually *trigger* these changes? Well, SRv6 is a standard IPv6 feature, and can be configured with `iproute2` (`ip route add ... encap seg6local action End ...`). I can use a virtual environment via tun/tap, veth, loopback, or even raw sockets to inject packets. That means these changes in `net/ipv6/seg6_local.c` are definitely reachable within a standard syzkaller configuration. So, let's go through the WorthFuzzing criteria: * Structurally unreachable hardware? No, it's pure virtual networking, so that's good. * Non-kernel / non-executable? Nope, this modifies core kernel code in `net/ipv6/seg6_local.c`. * Driver teardown? No, this isn't about driver teardown. * Core subsystem? YES, this is networking (`net/ipv6/`) which is very valuable. * Refactoring/Cleanups/Behavior change? YES, this is handling NEXT-C-SID combined with PSP and consumed SRH handling, which is a significant behavioral change and bug fix within the SRv6 stack. Given that, this easily passes the WorthFuzzing test. I need to make sure to check the Kconfig requirements and FocusSymbols to make sure this is properly enabled in my syzkaller configuration. Let me start by digging into the Kconfig to confirm if there are any specific options needed to enable SRv6 or its specific flavors. |
| 4/2 | 2026/10/11 19:55 | tool | grepper |
0mArgs:{
"Expression": "seg6_local\\.o",
"PathPrefixes": [
"net/ipv6"
]
}Results: {
"Output": "net/ipv6/Makefile=24=ipv6-$(CONFIG_NETLABEL) += calipso.o\nnet/ipv6/Makefile:25:ipv6-$(CONFIG_IPV6_SEG6_LWTUNNEL) += seg6_iptunnel.o seg6_local.o\nnet/ipv6/Makefile-26-ipv6-$(CONFIG_IPV6_SEG6_HMAC) += seg6_hmac.o\n"
} |
| 5/2 | 2026/10/11 19:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14045 output: 37 thoughts: 22 Thoughts: Here's my thought process, summarized as you requested: **Examining the IPv6 Segment Routing Definition** Okay, let's dive into this. First things first, I need to get a clear picture of how this `CONFIG_IPV6_SEG6_LWTUNNEL` is defined in the Kconfig file. I need to understand its dependencies, its default setting (if any), and how it relates to other related IPv6 and networking features. Knowing the exact Kconfig definition will be crucial for understanding the finer implications of this functionality. It'll reveal how the kernel is configured and provide a concise statement of purpose, which will greatly facilitate this investigation. Let's start digging. |
| 6/2 | 2026/10/11 19:56 | tool | grepper |
0mArgs:{
"Expression": "config IPV6_SEG6_LWTUNNEL",
"PathPrefixes": [
"net/ipv6"
]
}Results: {
"Output": "net/ipv6/Kconfig=279=config IPV6_PIMSM_V2\n--\nnet/ipv6/Kconfig-285-\nnet/ipv6/Kconfig:286:config IPV6_SEG6_LWTUNNEL\nnet/ipv6/Kconfig-287-\tbool \"IPv6: Segment Routing Header encapsulation support\"\n"
} |
| 7/2 | 2026/10/11 19:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14350 output: 35 thoughts: 20 Thoughts: Here's a summary of my thought process, assuming I'm an expert: **Diving into IPv6 Configuration** Okay, so I need to understand a specific aspect of the IPv6 configuration within the kernel. Let's see... the `net/ipv6/Kconfig` file is the logical place to start for the configuration options. I'm going to jump straight to around line 286. I'm hoping that particular section contains the relevant details for what I'm looking into. From the file name, and my knowledge of the kernel, I'm expecting to find a conditional setup for that section. |
| 8/2 | 2026/10/11 19:56 | tool | read-file |
0mArgs:{
"File": "net/ipv6/Kconfig",
"FirstLine": 285,
"LineCount": 25
}Results: {
"Contents": " 285:\t\n 286:\tconfig IPV6_SEG6_LWTUNNEL\n 287:\t\tbool \"IPv6: Segment Routing Header encapsulation support\"\n 288:\t\tdepends on IPV6\n 289:\t\tselect LWTUNNEL\n 290:\t\tselect DST_CACHE\n 291:\t\tselect IPV6_MULTIPLE_TABLES\n 292:\t\thelp\n 293:\t\t Support for encapsulation of packets within an outer IPv6\n 294:\t\t header and a Segment Routing Header using the lightweight\n 295:\t\t tunnels mechanism. Also enable support for advanced local\n 296:\t\t processing of SRv6 packets based on their active segment.\n 297:\t\n 298:\t\t If unsure, say N.\n 299:\t\n 300:\tconfig IPV6_SEG6_HMAC\n 301:\t\tbool \"IPv6: Segment Routing HMAC support\"\n 302:\t\tdepends on IPV6\n 303:\t\tselect CRYPTO_LIB_SHA1\n 304:\t\tselect CRYPTO_LIB_SHA256\n 305:\t\tselect CRYPTO_LIB_UTILS\n 306:\t\thelp\n 307:\t\t Support for HMAC signature generation and verification\n 308:\t\t of SR-enabled packets.\n 309:\t\n"
} |
| 9/2 | 2026/10/11 19:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14892 output: 34 thoughts: 49 Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue: **Investigating IPv6 Segment Routing Dependencies** Alright, `CONFIG_IPV6_SEG6_LWTUNNEL` is flagged as depending on `IPV6`, which is expected. But I need to dive deeper. Specifically, I want to confirm if there are any subtle configurations or flavor-specific setups that further constrain its behavior, or require additional supporting settings. I'm thinking about the nitty-gritty of the `seg6` configurations, what could be the nuances there. Let me immediately check the code itself. The canonical place for that information would be, of course, `net/ipv6/seg6_local.c`. That should contain all the relevant ifdefs and conditional logic I need to parse. I'm going to look for any hidden dependencies or configuration options that are controlled by the preprocessor that are coupled to `IPV6` beyond the obvious. This is where the real answers will be. |
| 10/2 | 2026/10/11 19:56 | tool | grepper |
0mArgs:{
"Expression": "CONFIG_",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c-27-#include \u003cnet/ip_tunnels.h\u003e\nnet/ipv6/seg6_local.c:28:#ifdef CONFIG_IPV6_SEG6_HMAC\nnet/ipv6/seg6_local.c-29-#include \u003cnet/seg6_hmac.h\u003e\n--\nnet/ipv6/seg6_local.c=187=struct seg6_local_lwt {\n--\nnet/ipv6/seg6_local.c-195-\tstruct bpf_lwt_prog bpf;\nnet/ipv6/seg6_local.c:196:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-197-\tstruct seg6_end_dt_info dt_info;\n--\nnet/ipv6/seg6_local.c=216=static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)\n--\nnet/ipv6/seg6_local.c-223-\nnet/ipv6/seg6_local.c:224:#ifdef CONFIG_IPV6_SEG6_HMAC\nnet/ipv6/seg6_local.c-225-\tif (!seg6_hmac_validate_skb(skb, srh))\n--\nnet/ipv6/seg6_local.c=232=static bool decap_and_validate(struct sk_buff *skb, int proto)\n--\nnet/ipv6/seg6_local.c-240-\nnet/ipv6/seg6_local.c:241:#ifdef CONFIG_IPV6_SEG6_HMAC\nnet/ipv6/seg6_local.c-242-\tif (srh \u0026\u0026 !seg6_hmac_validate_skb(skb, srh))\n--\nnet/ipv6/seg6_local.c=891=static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-904-\tpinfo = seg6_get_srh_pktinfo(srh);\nnet/ipv6/seg6_local.c:905:#ifdef CONFIG_IPV6_SEG6_HMAC\nnet/ipv6/seg6_local.c-906-\tif (srh \u0026\u0026 !seg6_hmac_validate_skb(skb, srh))\n--\nnet/ipv6/seg6_local.c=1150=static int input_action_end_dx4(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-1173-\nnet/ipv6/seg6_local.c:1174:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1175-static struct net *fib6_config_get_net(const struct fib6_config *fib6_cfg)\n--\nnet/ipv6/seg6_local.c=1426=static int input_action_end_dt6(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-1434-\nnet/ipv6/seg6_local.c:1435:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1436-\tif (seg6_end_dt6_get_mode(slwt) == DT_LEGACY_MODE)\n--\nnet/ipv6/seg6_local.c-1467-\nnet/ipv6/seg6_local.c:1468:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1469-static int seg6_end_dt46_build(struct seg6_local_lwt *slwt, const void *cfg,\n--\nnet/ipv6/seg6_local.c=1649=static struct seg6_action_desc seg6_action_table[] = {\n--\nnet/ipv6/seg6_local.c-1692-\t\t.optattrs\t= SEG6_F_LOCAL_COUNTERS,\nnet/ipv6/seg6_local.c:1693:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1694-\t\t.input\t\t= input_action_end_dt4,\n--\nnet/ipv6/seg6_local.c-1701-\t\t.action\t\t= SEG6_LOCAL_ACTION_END_DT6,\nnet/ipv6/seg6_local.c:1702:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1703-\t\t.attrs\t\t= 0,\n--\nnet/ipv6/seg6_local.c-1719-\t\t.optattrs\t= SEG6_F_LOCAL_COUNTERS,\nnet/ipv6/seg6_local.c:1720:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1721-\t\t.input\t\t= input_action_end_dt46,\n--\nnet/ipv6/seg6_local.c=1921=seg6_end_dt_info *seg6_possible_end_dt_info(struct seg6_local_lwt *slwt)\nnet/ipv6/seg6_local.c-1922-{\nnet/ipv6/seg6_local.c:1923:#ifdef CONFIG_NET_L3_MASTER_DEV\nnet/ipv6/seg6_local.c-1924-\treturn \u0026slwt-\u003edt_info;\n"
} |
| 11/2 | 2026/10/11 19:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16624 output: 39 thoughts: 228 Thoughts: **Analyzing the SRv6 Configuration Options and Code** Alright, let's break this down. My focus here is clearly on Secure Routing IPv6 (SRv6) and its configuration options. The core of this seems to be the `IPV6_SEG6_LWTUNNEL` option, which, of course, relies on the broader `IPV6` support. That's the baseline. I need to make sure both of those are set. The question now is about `IPV6_SEG6_HMAC`. This is interesting; HMAC provides an optional security layer for SRv6, but it's not absolutely essential for basic functionality. Good to know it's there. Now, let's dig into the meat of the code. I need to understand what changed, so I'm looking at the modified or newly added functions. These are the ones I've flagged: 1. `seg6_use_next_csid` (it's static) 2. `seg6_pop_srh` (also static) 3. `seg6_flv8986_get_srh` (also static) 4. `end_flv8986_core` (static) 5. `input_action_end` (static - this one piques my interest, I want to confirm if there are any non-static callers to this function) I'm making a mental note that all of those functions are static, but I need to understand the dependencies and external influences. I'm going to focus on `seg6_local.c` specifically, and zero in on the vicinity of `input_action_end` and `seg6_action_table`. These are likely to give me the context I need to understand how the new functionality integrates and the impact it might have on the overall SRv6 architecture. |
| 12/2 | 2026/10/11 19:56 | tool | grepper |
0mArgs:{
"Expression": "input_action_end\\b",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=891=static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-957-/* regular endpoint function */\nnet/ipv6/seg6_local.c:958:static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)\nnet/ipv6/seg6_local.c-959-{\n--\nnet/ipv6/seg6_local.c=1649=static struct seg6_action_desc seg6_action_table[] = {\n--\nnet/ipv6/seg6_local.c-1654-\t\t\t\t SEG6_F_LOCAL_FLAVORS,\nnet/ipv6/seg6_local.c:1655:\t\t.input\t\t= input_action_end,\nnet/ipv6/seg6_local.c-1656-\t},\n"
} |
| 13/2 | 2026/10/11 19:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17563 output: 38 thoughts: 48 Thoughts: Here's my analysis of the provided information, as if these were my internal thoughts: **Dissecting the `seg6_action_table` and `input_action_end`** Alright, so `input_action_end` is a function pointer, and it's located within the `seg6_action_table`. My immediate instinct is to figure out the control flow here. How is `input_action_end` actually *called*? Where are we seeing the `seg6_action_table` referenced? I need to trace the usage of this table to understand the context and purpose of `input_action_end`. Is it called directly, indirectly, or within a larger data structure? The goal is to determine the conditions under which this function is invoked and what exactly it's designed to do at the end of some input action, within the context of Segment Routing over IPv6 (SRv6). I'll need to look for calls, assignments, or any interaction with `seg6_action_table` to get the full picture. |
| 14/2 | 2026/10/11 19:56 | tool | grepper |
0mArgs:{
"Expression": "seg6_action_table",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=1587=static int input_action_end_bpf(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-1648-\nnet/ipv6/seg6_local.c:1649:static struct seg6_action_desc seg6_action_table[] = {\nnet/ipv6/seg6_local.c-1650-\t{\n--\nnet/ipv6/seg6_local.c=1749=static struct seg6_action_desc *__get_action_desc(int action)\n--\nnet/ipv6/seg6_local.c-1753-\nnet/ipv6/seg6_local.c:1754:\tcount = ARRAY_SIZE(seg6_action_table);\nnet/ipv6/seg6_local.c-1755-\tfor (i = 0; i \u003c count; i++) {\nnet/ipv6/seg6_local.c:1756:\t\tdesc = \u0026seg6_action_table[i];\nnet/ipv6/seg6_local.c-1757-\t\tif (desc-\u003eaction == action)\n--\nnet/ipv6/seg6_local.c=2612=static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt,\n--\nnet/ipv6/seg6_local.c-2638-\t * optional, it means that the user has messed something up in the\nnet/ipv6/seg6_local.c:2639:\t * seg6_action_table. Therefore, this check is required for SRv6\nnet/ipv6/seg6_local.c-2640-\t * behaviors to work properly.\n"
} |
| 15/2 | 2026/10/11 19:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18323 output: 34 thoughts: 36 Thoughts: Okay, let's break this down. **Investigating the Data Input Path for SEG6 Local Processing** Alright, I need to understand how data is actually fed into this `desc->input(skb, slwt)` function. That "desc" is likely a descriptor, and "skb" is definitely the socket buffer. "slwt" could be a "Segment Local Worker Task" or something similar. But I need to see what's calling it, how it's being used. The function name `input` is pretty generic, so I should be looking for it within the `seg6_local.c` source file, as that's where I would expect to find the SEG6 local processing logic. Time to fire up `grep` and see what's going on. |
| 16/2 | 2026/10/11 19:57 | tool | grepper |
0mArgs:{
"Expression": "-\u003einput",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=1787=static int seg6_local_input_core(struct net *net, struct sock *sk,\n--\nnet/ipv6/seg6_local.c-1798-\nnet/ipv6/seg6_local.c:1799:\trc = desc-\u003einput(skb, slwt);\nnet/ipv6/seg6_local.c-1800-\n--\nnet/ipv6/seg6_local.c=2612=static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt,\n--\nnet/ipv6/seg6_local.c-2623-\nnet/ipv6/seg6_local.c:2624:\tif (!desc-\u003einput)\nnet/ipv6/seg6_local.c-2625-\t\treturn -EOPNOTSUPP;\n"
} |
| 17/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18800 output: 38 thoughts: 40 Thoughts: Here's my analysis of the provided text, rendered in the first person, assuming an expert user: **Deep Dive into seg6_local_input_core** Okay, so `seg6_local_input_core` is the critical function handling incoming seg6local packets. That's good to know; it immediately tells me where the action is. My next step, naturally, is to trace its usage. I need to understand what events trigger this function. I'll need to figure out the calling paths. I need to understand the function’s context. Understanding the calls to `seg6_local_input_core` is vital to understanding the control flow and impact of seg6local processing within the system. Let's see what's calling it; I need to explore its call graph. |
| 18/2 | 2026/10/11 19:57 | tool | grepper |
0mArgs:{
"Expression": "seg6_local_input",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=1769=static void seg6_local_update_counters(struct seg6_local_lwt *slwt,\n--\nnet/ipv6/seg6_local.c-1786-\nnet/ipv6/seg6_local.c:1787:static int seg6_local_input_core(struct net *net, struct sock *sk,\nnet/ipv6/seg6_local.c-1788-\t\t\t\t struct sk_buff *skb)\n--\nnet/ipv6/seg6_local.c-1808-\nnet/ipv6/seg6_local.c:1809:static int seg6_local_input(struct sk_buff *skb)\nnet/ipv6/seg6_local.c-1810-{\n--\nnet/ipv6/seg6_local.c-1818-\t\t\t dev_net(skb-\u003edev), NULL, skb, skb-\u003edev, NULL,\nnet/ipv6/seg6_local.c:1819:\t\t\t seg6_local_input_core);\nnet/ipv6/seg6_local.c-1820-\nnet/ipv6/seg6_local.c:1821:\treturn seg6_local_input_core(dev_net(skb-\u003edev), NULL, skb);\nnet/ipv6/seg6_local.c-1822-}\n--\nnet/ipv6/seg6_local.c=2849=static const struct lwtunnel_encap_ops seg6_local_ops = {\n--\nnet/ipv6/seg6_local.c-2851-\t.destroy_state\t= seg6_local_destroy_state,\nnet/ipv6/seg6_local.c:2852:\t.input\t\t= seg6_local_input,\nnet/ipv6/seg6_local.c-2853-\t.fill_encap\t= seg6_local_fill_encap,\n"
} |
| 19/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19552 output: 39 thoughts: 155 Thoughts: **Analyzing the Segment Routing v6 (SRv6) Local Operations** Okay, so `seg6_local_ops` is registered with `lwtunnel_encap_ops` - interesting! Now, I want to drill down into the specific modifications made in `net/ipv6/seg6_local.c`. Let's see, the functions that have been changed are: `seg6_use_next_csid`, `seg6_pop_srh`, `seg6_flv8986_get_srh`, `end_flv8986_core`, and `input_action_end`. I'm particularly curious about `seg6_pop_srh`. I want to know if it's a static function, and if not, where it's called from. So, I need to search the code for instances of `seg6_pop_srh`. Let's get to it. |
| 20/2 | 2026/10/11 19:57 | tool | grepper |
0mArgs:{
"Expression": "seg6_pop_srh",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=740=seg6_local_flv8986_act_lookup(enum seg6_local_pktinfo pinfo, __u32 flvmask)\n--\nnet/ipv6/seg6_local.c-755-/* skb-\u003edata must be aligned with skb-\u003enetwork_header */\nnet/ipv6/seg6_local.c:756:static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\nnet/ipv6/seg6_local.c-757-{\n--\nnet/ipv6/seg6_local.c=891=static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-937-\nnet/ipv6/seg6_local.c:938:\t\tif (unlikely(!seg6_pop_srh(skb, srhoff)))\nnet/ipv6/seg6_local.c-939-\t\t\tgoto drop;\n"
} |
| 21/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20237 output: 42 thoughts: 48 Thoughts: Here's my take on the thought process, as requested: **Tracing the Call Chain: A Deep Dive** Okay, so `seg6_pop_srh` is directly invoked by `end_flv8986_core`. That's the starting point. Now, I need to understand the wider context. Where *is* `end_flv8986_core` itself being called? It's essential to trace this call chain to fully grasp the execution flow and potential dependencies. I need to pinpoint the location of the `end_flv8986_core` calls to build a comprehensive picture and anticipate any edge cases or unexpected behavior. Time to delve into the code and find the call sites. |
| 22/2 | 2026/10/11 19:57 | tool | grepper |
0mArgs:{
"Expression": "end_flv8986_core",
"PathPrefixes": [
"net/ipv6/seg6_local.c"
]
}Results: {
"Output": "net/ipv6/seg6_local.c=874=static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)\n--\nnet/ipv6/seg6_local.c-890- */\nnet/ipv6/seg6_local.c:891:static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\nnet/ipv6/seg6_local.c-892-{\n--\nnet/ipv6/seg6_local.c=958=static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-974-\t */\nnet/ipv6/seg6_local.c:975:\treturn end_flv8986_core(skb, slwt);\nnet/ipv6/seg6_local.c-976-}\n"
} |
| 23/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20753 output: 39 thoughts: 71 Thoughts: Here's my understanding of the situation, presented from my perspective as an expert: **Analyzing the `input_action_end` Call in `seg6_local.c`** Okay, so I'm looking at how the `input_action_end` function in the IPv6 segment routing (seg6) code works. The critical aspect here is how it concludes processing. My initial hypothesis is that it's designed to call one of several core ending routines. Namely, it probably hands off control to `end_next_csid_core` or `end_flv8986_core`, though potentially, it could also go directly to `input_action_end_core`. The specifics are definitely what I need to pinpoint to continue my current assessment. To gain a more granular understanding, I'm going to consult the source code itself, specifically lines 950 to 980 of `net/ipv6/seg6_local.c`. That should clarify which core function is actually called, depending on the current state. I need to see what conditions drive the decision-making process within `input_action_end` and what the implications of each call are. This will help determine the overall flow of how seg6 packets are handled. |
| 24/2 | 2026/10/11 19:57 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 950,
"LineCount": 35
}Results: {
"Contents": " 950:\t\treturn input_action_end_finish(skb, slwt);\n 951:\t\n 952:\tdrop:\n 953:\t\tkfree_skb_reason(skb, reason);\n 954:\t\treturn err;\n 955:\t}\n 956:\t\n 957:\t/* regular endpoint function */\n 958:\tstatic int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 959:\t{\n 960:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 961:\t\t__u32 fops = finfo-\u003eflv_ops;\n 962:\t\n 963:\t\tif (!fops)\n 964:\t\t\treturn input_action_end_core(skb, slwt);\n 965:\t\n 966:\t\t/* NEXT-C-SID is evaluated first, when configured */\n 967:\t\tif (seg6_use_next_csid(skb, finfo))\n 968:\t\t\treturn end_next_csid_core(skb, slwt);\n 969:\t\n 970:\t\t/* the specific processing function to be performed on the packet\n 971:\t\t * depends on the combination of flavors defined in RFC8986 and some\n 972:\t\t * information extracted from the packet, e.g. presence/absence of SRH,\n 973:\t\t * Segment Left = 0, etc.\n 974:\t\t */\n 975:\t\treturn end_flv8986_core(skb, slwt);\n 976:\t}\n 977:\t\n 978:\t/* regular endpoint, and forward to specified nexthop */\n 979:\tstatic int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 980:\t{\n 981:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 982:\t\t__u32 fops = finfo-\u003eflv_ops;\n 983:\t\n 984:\t\t/* check for the presence of NEXT-C-SID since it applies first */\n"
} |
| 25/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21732 output: 39 thoughts: 853 Thoughts: **Analyzing Symbol Presence and Fuzzing Strategy for SEG6 Local Functions** Okay, let's break this down. My immediate concern is whether the key functions within the SEG6 local code are compiled into accessible symbols within `vmlinux`. I need to determine if functions like `seg6_pop_srh`, `seg6_use_next_csid`, `end_flv8986_core`, `input_action_end`, and `seg6_local_input_core` are actually present as symbols or if they've been optimized away via inlining. First, I'll focus on `input_action_end`. Since it's passed as a function pointer in `seg6_action_table[...].input = input_action_end;`, it *must* have a distinct address. This means the compiler *can't* completely inline it, unless something really aggressive is happening with LTO or whole-program optimization which is unlikely with function pointer targets. Now, what about the dependencies? `end_flv8986_core` is static and called by `input_action_end`, and `seg6_pop_srh` is static and called by `end_flv8986_core`. Because these functions are static, the compiler might inline them. And, `seg6_local_input_core`? I see its address is taken too: `.input = seg6_local_input` or passed to `NF_HOOK_COND`. `seg6_local_input` also has its address taken in `lwtunnel_encap_ops seg6_local_ops`. This suggests they're likely symbols as well. Now, let's consult the `FocusSymbols` guidance. I need to remember: don't target ubiquitous functions. I'm focusing on feature-specific logic. The key here is that none of these functions are static inline in header files. They're all in `net/ipv6/seg6_local.c`, which makes things much simpler. Specifically, I'm dealing with these modified/new functions: * `seg6_use_next_csid` (new static helper) * `seg6_pop_srh` (modified static helper) * `seg6_flv8986_get_srh` (new static helper) * `end_flv8986_core` (modified static function) * `input_action_end` (modified static function with address taken in table) * `seg6_local_input_core` / `seg6_local_input` (caller entrypoint) My hunch is that these will all be present as symbols, especially given how modern compilers handle static functions, especially when kallsyms, debug info, or ftrace are enabled (which KCOV uses). However, to be certain, I want to make sure I can use: * `input_action_end` * `end_flv8986_core` * `seg6_pop_srh` * `seg6_local_input` to be included in my `FocusSymbols` list. Finally, I'll make sure there aren't any other call sites of `seg6_pop_srh` in `net/ipv6/seg6_local.c` to make sure my logic is correct. |
| 26/2 | 2026/10/11 19:57 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 750,
"LineCount": 80
}Results: {
"Contents": " 750:\t\t\treturn SEG6_LOCAL_FLV_ACT_UNSPEC;\n 751:\t\n 752:\t\treturn flv8986_act_tbl[index];\n 753:\t}\n 754:\t\n 755:\t/* skb-\u003edata must be aligned with skb-\u003enetwork_header */\n 756:\tstatic bool seg6_pop_srh(struct sk_buff *skb, int srhoff)\n 757:\t{\n 758:\t\tstruct ipv6_sr_hdr *srh;\n 759:\t\tstruct ipv6hdr *iph;\n 760:\t\t__u8 srh_nexthdr;\n 761:\t\tint thoff = -1;\n 762:\t\tint srhlen;\n 763:\t\tint nhlen;\n 764:\t\n 765:\t\tif (unlikely(srhoff \u003c sizeof(*iph) ||\n 766:\t\t\t !pskb_may_pull(skb, srhoff + sizeof(*srh))))\n 767:\t\t\treturn false;\n 768:\t\n 769:\t\tsrh = (struct ipv6_sr_hdr *)(skb-\u003edata + srhoff);\n 770:\t\tsrhlen = ipv6_optlen(srh);\n 771:\t\n 772:\t\t/* we are about to mangle the pkt, let's check if we can write on it */\n 773:\t\tif (unlikely(skb_ensure_writable(skb, srhoff + srhlen)))\n 774:\t\t\treturn false;\n 775:\t\n 776:\t\t/* skb_ensure_writable() may change skb pointers; evaluate srh again */\n 777:\t\tsrh = (struct ipv6_sr_hdr *)(skb-\u003edata + srhoff);\n 778:\t\tsrh_nexthdr = srh-\u003enexthdr;\n 779:\t\n 780:\t\tif (unlikely(!skb_transport_header_was_set(skb)))\n 781:\t\t\tgoto pull;\n 782:\t\n 783:\t\tnhlen = skb_network_header_len(skb);\n 784:\t\t/* we have to deal with the transport header: it could be set before\n 785:\t\t * the SRH, after the SRH, or within it (which is considered wrong,\n 786:\t\t * however).\n 787:\t\t */\n 788:\t\tif (likely(nhlen \u003c= srhoff))\n 789:\t\t\tthoff = nhlen;\n 790:\t\telse if (nhlen \u003e= srhoff + srhlen)\n 791:\t\t\t/* transport_header is set after the SRH */\n 792:\t\t\tthoff = nhlen - srhlen;\n 793:\t\telse\n 794:\t\t\t/* transport_header falls inside the SRH; hence, we can't\n 795:\t\t\t * restore the transport_header pointer properly after\n 796:\t\t\t * SRH removing operation.\n 797:\t\t\t */\n 798:\t\t\treturn false;\n 799:\tpull:\n 800:\t\t/* we need to pop the SRH:\n 801:\t\t * 1) first of all, we pull out everything from IPv6 header up to SRH\n 802:\t\t * (included) evaluating also the rcsum;\n 803:\t\t * 2) we overwrite (and then remove) the SRH by properly moving the\n 804:\t\t * IPv6 along with any extension header that precedes the SRH;\n 805:\t\t * 3) At the end, we push back the pulled headers (except for SRH,\n 806:\t\t * obviously).\n 807:\t\t */\n 808:\t\tskb_pull_rcsum(skb, srhoff + srhlen);\n 809:\t\tmemmove(skb_network_header(skb) + srhlen, skb_network_header(skb),\n 810:\t\t\tsrhoff);\n 811:\t\tskb_push(skb, srhoff);\n 812:\t\n 813:\t\tskb_reset_network_header(skb);\n 814:\t\tskb_mac_header_rebuild(skb);\n 815:\t\tif (likely(thoff \u003e= 0))\n 816:\t\t\tskb_set_transport_header(skb, thoff);\n 817:\t\n 818:\t\tiph = ipv6_hdr(skb);\n 819:\t\tif (srhoff == sizeof(*iph)) {\n 820:\t\t\tiph-\u003enexthdr = srh_nexthdr;\n 821:\t\t} else {\n 822:\t\t\t/* we must look for the extension header (EXTH, for short) that\n 823:\t\t\t * immediately precedes the SRH we have just removed, i.e. the\n 824:\t\t\t * EXTH that ends at srhoff. We find it by its position and not\n 825:\t\t\t * by its nexthdr, since another routing header (e.g. an SRH\n 826:\t\t\t * with SL = 0) may come before the removed SRH.\n 827:\t\t\t * Then, we update the value of the EXTH nexthdr with the one\n 828:\t\t\t * contained in the SRH nexthdr.\n 829:\t\t\t */\n"
} |
| 27/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24759 output: 39 thoughts: 216 Thoughts: **Analyzing the IPv6 Segment Routing Code** Okay, let's break down this `seg6_pop_srh` function. My initial impression is that it seems fairly straightforward in its primary task – popping the Segment Routing Header (SRH). But I need to dive deeper to grasp the nuances. It looks like it handles the traversal of any extension headers preceding the SRH, all the way up to `srhoff`. Now, the crucial part is understanding the evolution of the `nexthdr` update. Previously, the code checked for `NEXTHDR_ROUTING` and updated `hp->nexthdr` then. The latest changes suggest this update now happens at `if (off == srhoff)`. That's a key modification, I need to check the implications of this. Then there's `seg6_flv8986_get_srh`, which utilizes `seg6_get_srh(skb, IP6_FH_F_SKIP_RH)`. I need to review its purpose, and how skipping the RH is important. And now the `seg6_use_next_csid` function is making a key decision. Depending on the `DA.Argument` and whether RFC8986 flavors are enabled, it selects between `end_next_csid_core` and `end_flv8986_core`. Clearly, it's directing the control flow. I should investigate `end_flv8986_core` next to see exactly how it's handling the 8986 flavors. This seems to be where the crucial logic for these extensions is implemented. |
| 28/2 | 2026/10/11 19:57 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 890,
"LineCount": 60
}Results: {
"Contents": " 890:\t */\n 891:\tstatic int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 892:\t{\n 893:\t\tenum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;\n 894:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 895:\t\tenum seg6_local_flv_action action;\n 896:\t\tenum seg6_local_pktinfo pinfo;\n 897:\t\tstruct ipv6_sr_hdr *srh;\n 898:\t\tint err = -EINVAL;\n 899:\t\t__u32 flvmask;\n 900:\t\tint srhoff;\n 901:\t\n 902:\t\tsrh = seg6_flv8986_get_srh(skb);\n 903:\t\tsrhoff = srh ? ((unsigned char *)srh - skb-\u003edata) : 0;\n 904:\t\tpinfo = seg6_get_srh_pktinfo(srh);\n 905:\t#ifdef CONFIG_IPV6_SEG6_HMAC\n 906:\t\tif (srh \u0026\u0026 !seg6_hmac_validate_skb(skb, srh))\n 907:\t\t\tgoto drop;\n 908:\t#endif\n 909:\t\t/* NEXT-C-SID, when configured, has already been evaluated by the\n 910:\t\t * caller. Only the RFC8986 flavors are left here.\n 911:\t\t */\n 912:\t\tflvmask = finfo-\u003eflv_ops \u0026 ~SEG6_F_LOCAL_FLV_NEXT_CSID;\n 913:\t\tif (unlikely(flvmask \u0026 ~SEG6_LOCAL_FLV8986_SUPP_OPS)) {\n 914:\t\t\tpr_warn_once(\"seg6local: invalid RFC8986 flavors\\n\");\n 915:\t\t\tgoto drop;\n 916:\t\t}\n 917:\t\n 918:\t\t/* retrieve the action triggered by the combination of pktinfo data and\n 919:\t\t * the flavors mask.\n 920:\t\t */\n 921:\t\taction = seg6_local_flv8986_act_lookup(pinfo, flvmask);\n 922:\t\tswitch (action) {\n 923:\t\tcase SEG6_LOCAL_FLV_ACT_END:\n 924:\t\t\t/* process the packet as the \"standard\" End behavior */\n 925:\t\t\tsrh = advance_nextseg(skb, srh, \u0026reason);\n 926:\t\t\tif (!srh) {\n 927:\t\t\t\terr = -ENOMEM;\n 928:\t\t\t\tgoto drop;\n 929:\t\t\t}\n 930:\t\t\tbreak;\n 931:\t\tcase SEG6_LOCAL_FLV_ACT_PSP:\n 932:\t\t\tsrh = advance_nextseg(skb, srh, \u0026reason);\n 933:\t\t\tif (!srh) {\n 934:\t\t\t\terr = -ENOMEM;\n 935:\t\t\t\tgoto drop;\n 936:\t\t\t}\n 937:\t\n 938:\t\t\tif (unlikely(!seg6_pop_srh(skb, srhoff)))\n 939:\t\t\t\tgoto drop;\n 940:\t\t\tbreak;\n 941:\t\tcase SEG6_LOCAL_FLV_ACT_UNSPEC:\n 942:\t\t\tfallthrough;\n 943:\t\tdefault:\n 944:\t\t\t/* by default, we drop the packet since we could not find a\n 945:\t\t\t * suitable action.\n 946:\t\t\t */\n 947:\t\t\tgoto drop;\n 948:\t\t}\n 949:\t\n"
} |
| 29/2 | 2026/10/11 19:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26371 output: 248 thoughts: 875 Thoughts: **Analysis of IPv6 Segment Routing with RFC8986 and Fuzzing Strategy** Okay, here's the breakdown. `end_flv8986_core` immediately caught my eye; it's doing packet parsing, calling `advance_nextseg()` and, critically, `seg6_pop_srh()`. Looking closer at `seg6_pop_srh()`, I see it's diving deep into IPv6 extension header parsing and performing header modifications using functions like `skb_pull_rcsum`, `memmove`, and `skb_push`. This is complex packet manipulation – classic fuzzing territory. High potential for memory errors, unexpected control flow, and exploitable conditions. Absolutely worth a closer look with fuzzing. Next, I needed to figure out the context. I checked the configuration symbols and verified that `IPV6_SEG6_LWTUNNEL` is the key. It depends on `IPV6`, and I'll need to enable those. I also noted that `CONFIG_IPV6_SEG6_HMAC` can optionally be included as well. Now, which functions are the key focus points? I identified the core functions that handle this functionality: `input_action_end`, `end_flv8986_core`, `seg6_use_next_csid`, `seg6_pop_srh`, `seg6_flv8986_get_srh`, and `seg6_local_input`. I did a mental check on whether anything might be inlined. `seg6_flv8986_enabled`, `seg6_next_csid_enabled` are very small and might be inlined. `seg6_use_next_csid` might be inlined into `input_action_end` due to the conditionals. But `seg6_pop_srh` is substantial, and `end_flv8986_core` handles substantial logic. `input_action_end` is a function pointer in the `seg6_action_table`. Finally, `seg6_local_input` is the entrypoint from the LWTunnel subsystem. So, here's my list of `FocusSymbols`: `input_action_end`, `end_flv8986_core`, `seg6_pop_srh`, `seg6_use_next_csid`, `seg6_flv8986_get_srh`, and `seg6_local_input`. Therefore, I'm ready to construct the fuzzing strategy. The function `set-results` looks good. * `WorthFuzzing`: true * `Reasoning`: This is worth fuzzing because it reaches IPv6 SRv6 seg6local processing via virtual networking. It also modifies packet parsing, SRH pop logic, extension header traversal, and NEXT-C-SID / RFC8986 flavors interaction. * `FocusSymbols`: [`input_action_end`, `end_flv8986_core`, `seg6_pop_srh`, `seg6_use_next_csid`, `seg6_flv8986_get_srh`, `seg6_local_input`] * `EnableConfigs`: [`IPV6`, `IPV6_SEG6_LWTUNNEL`] This strategy should provide good coverage. Time to execute. |
| 30/2 | 2026/10/11 19:57 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"IPV6",
"IPV6_SEG6_LWTUNNEL"
],
"FocusSymbols": [
"input_action_end",
"end_flv8986_core",
"seg6_pop_srh",
"seg6_use_next_csid",
"seg6_flv8986_get_srh",
"seg6_local_input"
],
"Reasoning": "The patch modifies the SRv6 (Segment Routing over IPv6) local behavior handling in net/ipv6/seg6_local.c, specifically altering how the NEXT-C-SID flavor interacts with RFC8986 flavors (such as PSP) and how SRH headers are parsed and popped (seg6_pop_srh and seg6_flv8986_get_srh) when dealing with preceding or consumed routing headers. This touches reachable core networking packet-processing and header-mangling logic that can be tested in virtualized environments via standard IPv6 sockets, netlink route configuration, and virtual interfaces.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"IPV6",
"IPV6_SEG6_LWTUNNEL"
],
"FocusSymbols": [
"input_action_end",
"end_flv8986_core",
"seg6_pop_srh",
"seg6_use_next_csid",
"seg6_flv8986_get_srh",
"seg6_local_input"
],
"Reasoning": "The patch modifies the SRv6 (Segment Routing over IPv6) local behavior handling in net/ipv6/seg6_local.c, specifically altering how the NEXT-C-SID flavor interacts with RFC8986 flavors (such as PSP) and how SRH headers are parsed and popped (seg6_pop_srh and seg6_flv8986_get_srh) when dealing with preceding or consumed routing headers. This touches reachable core networking packet-processing and header-mangling logic that can be tested in virtualized environments via standard IPv6 sockets, netlink route configuration, and virtual interfaces.",
"WorthFuzzing": true
} |
| 31/1 | 2026/10/11 19:57 | action | If |
9mArgs:{
"WorthFuzzing": true
}Results: null |
| 32/2 | 2026/10/11 19:57 | agent | kmsan-evaluator |
9mModel:core Args: null Results: {
"KMSANReasoning": "The patch modifies the IPv6 SRv6 local behavior implementation in `net/ipv6/seg6_local.c` to properly combine NEXT-C-SID with RFC 8986 flavors (such as PSP) and correctly handle extension header traversal when popping an SRH preceded by another routing header, along with adding self-tests.\n\nReviewing KMSAN vs. KASAN applicability:\n1. No uninitialized memory or info-leak risks: The patch does not introduce or modify any kernel-to-user copies (copy_to_user, netlink attributes, ioctl structures, socket options) or allocate new uninitialized data structures.\n2. Variable and buffer safety: All variables introduced or used (such as `fops`, `addr`, `off`, `nexthdr`) are fully initialized. Packet data accessed during header parsing is checked and validated via `skb_header_pointer()`, `pskb_may_pull()`, and `skb_ensure_writable()`.\n3. Standard sanitizers sufficiency: Any potential issues arising from the changes would be logic errors or out-of-bounds accesses during skb header adjustments, both of which are caught by functional tests and standard KASAN. There is no uninitialized memory reading or branching on uninitialized data that would necessitate dedicated KMSAN fuzzing.",
"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 b4212b90c23edcde19abd37fec5edc03ee10dfb8
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Oct 11 19:54:37 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 0c3d1be7f1299..427d12fedfc3e 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -551,6 +551,47 @@ static bool seg6_next_csid_enabled(__u32 fops)
return fops & SEG6_F_LOCAL_FLV_NEXT_CSID;
}
+static bool seg6_flv8986_enabled(__u32 fops)
+{
+ return fops & SEG6_LOCAL_FLV8986_SUPP_OPS;
+}
+
+/* check whether the NEXT-C-SID processing has to be used for the packet,
+ * instead of the RFC8986 flavors set for the given SRv6 End* behavior
+ * instance.
+ *
+ * This function returns:
+ * - true, when the packet has to go through the NEXT-C-SID processing;
+ * - false, when NEXT-C-SID is not configured or the packet has to be
+ * processed on the basis of the RFC8986 flavors.
+ */
+static bool seg6_use_next_csid(struct sk_buff *skb,
+ const struct seg6_flavors_info *finfo)
+{
+ const struct in6_addr *addr;
+ __u32 fops = finfo->flv_ops;
+
+ if (!seg6_next_csid_enabled(fops))
+ return false;
+
+ addr = &ipv6_hdr(skb)->daddr;
+
+ /* NEXT-C-SID and the RFC8986 flavors combine according to the
+ * DA.Argument (see RFC9800, sections 4.1.1 and 4.1.7):
+ *
+ * DA.Argument RFC8986 flavors processing
+ * (1) != 0 any NEXT-C-SID only, SL unchanged
+ * (2) == 0 none the behavior, e.g. End
+ * (3) == 0 one or more the behavior with its flavors,
+ * e.g. End with PSP
+ *
+ * In (2), the packet still goes through the NEXT-C-SID processing,
+ * which runs the behavior (e.g. End) when the DA.Argument is zero.
+ */
+ return !seg6_flv8986_enabled(fops) ||
+ !seg6_next_csid_is_arg_zero(addr, finfo);
+}
+
/* Processing of SRv6 End, End.X, and End.T behaviors can be extended through
* the flavors framework. These behaviors must report the subset of (flavor)
* operations they currently implement. In this way, if a user specifies a
@@ -775,11 +816,14 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
skb_set_transport_header(skb, thoff);
iph = ipv6_hdr(skb);
- if (iph->nexthdr == NEXTHDR_ROUTING) {
+ if (srhoff == sizeof(*iph)) {
iph->nexthdr = srh_nexthdr;
} else {
/* we must look for the extension header (EXTH, for short) that
- * immediately precedes the SRH we have just removed.
+ * immediately precedes the SRH we have just removed, i.e. the
+ * EXTH that ends at srhoff. We find it by its position and not
+ * by its nexthdr, since another routing header (e.g. an SRH
+ * with SL = 0) may come before the removed SRH.
* Then, we update the value of the EXTH nexthdr with the one
* contained in the SRH nexthdr.
*/
@@ -796,11 +840,6 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
if (unlikely(!hp))
return false;
- if (hp->nexthdr == NEXTHDR_ROUTING) {
- hp->nexthdr = srh_nexthdr;
- break;
- }
-
switch (nexthdr) {
case NEXTHDR_FRAGMENT:
fallthrough;
@@ -812,6 +851,11 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
break;
}
+ if (off == srhoff) {
+ hp->nexthdr = srh_nexthdr;
+ break;
+ }
+
nexthdr = hp->nexthdr;
}
}
@@ -823,6 +867,24 @@ static bool seg6_pop_srh(struct sk_buff *skb, int srhoff)
return true;
}
+/* look up the SRH to be processed by the RFC8986 flavors. As End does, a
+ * routing header with SL = 0 is skipped (e.g. an SRH already consumed).
+ * This function returns NULL when no valid SRH is found.
+ */
+static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)
+{
+ struct ipv6_sr_hdr *srh;
+
+ srh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);
+ if (srh)
+ return srh;
+
+ /* we take the first routing header without skipping it. In this way,
+ * seg6_get_srh_pktinfo() reports SL = 0 and not a missing SRH.
+ */
+ return seg6_get_srh(skb, 0);
+}
+
/* process the packet on the basis of the RFC8986 flavors set for the given
* SRv6 End behavior instance.
*/
@@ -837,14 +899,17 @@ static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)
__u32 flvmask;
int srhoff;
- srh = seg6_get_srh(skb, 0);
+ srh = seg6_flv8986_get_srh(skb);
srhoff = srh ? ((unsigned char *)srh - skb->data) : 0;
pinfo = seg6_get_srh_pktinfo(srh);
#ifdef CONFIG_IPV6_SEG6_HMAC
if (srh && !seg6_hmac_validate_skb(skb, srh))
goto drop;
#endif
- flvmask = finfo->flv_ops;
+ /* NEXT-C-SID, when configured, has already been evaluated by the
+ * caller. Only the RFC8986 flavors are left here.
+ */
+ flvmask = finfo->flv_ops & ~SEG6_F_LOCAL_FLV_NEXT_CSID;
if (unlikely(flvmask & ~SEG6_LOCAL_FLV8986_SUPP_OPS)) {
pr_warn_once("seg6local: invalid RFC8986 flavors\n");
goto drop;
@@ -898,8 +963,8 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
if (!fops)
return input_action_end_core(skb, slwt);
- /* check for the presence of NEXT-C-SID since it applies first */
- if (seg6_next_csid_enabled(fops))
+ /* NEXT-C-SID is evaluated first, when configured */
+ if (seg6_use_next_csid(skb, finfo))
return end_next_csid_core(skb, slwt);
/* the specific processing function to be performed on the packet
diff --git a/tools/testing/selftests/net/srv6_end_flavors_test.sh b/tools/testing/selftests/net/srv6_end_flavors_test.sh
index 30a939392eea4..b5dbf53a7f238 100755
--- a/tools/testing/selftests/net/srv6_end_flavors_test.sh
+++ b/tools/testing/selftests/net/srv6_end_flavors_test.sh
@@ -16,13 +16,13 @@
#
# The End, End.X, and End.T behaviors can support these flavors either
# individually or in combinations.
-# Currently in this selftest we consider only the PSP flavor for the SRv6 End
-# behavior. However, it is possible to extend the script as soon as other
+# Currently in this selftest we consider the PSP flavor for the SRv6 End
+# behavior, both alone and combined with the NEXT-C-SID flavor defined in
+# RFC9800 [2]. However, it is possible to extend the script as soon as other
# flavors will be supported in the kernel.
#
# The purpose of the PSP flavor consists in instructing the penultimate node
-# listed in the SRv6 policy to remove (i.e. pop) the outermost SRH from the IPv6
-# header.
+# listed in the SRv6 policy to remove (i.e. pop) the SRH from the IPv6 header.
# A PSP enabled SRv6 End behavior instance processes the SRH by:
# - decrementing the Segment Left (SL) value from 1 to 0;
# - copying the last SID from the SID List into the IPv6 Destination Address
@@ -47,7 +47,20 @@
# "standard" End packet processing, ignoring the configured PSP flavor at
# all.
#
+# The NEXT-C-SID flavor (referred to as NEXT-CSID in RFC9800 [2]) and the
+# C-SID containers are described in srv6_end_next_csid_l3vpn_test.sh, which
+# also tests this flavor for the SRv6 End behavior.
+#
+# When the NEXT-C-SID flavor is combined with the PSP, USP or USD flavors, these
+# flavors are left unchanged [2]. The NEXT-C-SID processing comes first: with a
+# non-zero Argument, the IPv6 DA is updated with the next C-SID and the packet
+# is forwarded without changing the SRH, if any. The packet goes through the End
+# behavior with the other flavors only when the Argument is zero, i.e. when the
+# IPv6 DA carries no further C-SID. For example, the PSP operation takes place
+# only for a C-SID container with a zero Argument and SL=1.
+#
# [1] RFC8986: https://datatracker.ietf.org/doc/html/rfc8986
+# [2] RFC9800: https://datatracker.ietf.org/doc/html/rfc9800
#
# Network topology
# ================
@@ -115,12 +128,30 @@
# +---------------------------------------------------------------------+
# |fcff:x::e is associated with the SRv6 End behavior |
# |fcff:x::ef1 is associated with the SRv6 End behavior with PSP flavor |
+# |fcbb:0:0xyy::/48 is associated with the SRv6 behavior and the |
+# | flavors of the Function yy |
# +---------------------------------------------------------------------+
#
# The fcff::/16 prefix is reserved by the operator for the SIDs. Reachability of
# SIDs is ensured by proper configuration of the IPv6 operator's network and
# SRv6 routers.
#
+# Similarly, the fcbb:0::/32 prefix is reserved by the operator for the C-SID
+# containers and it is used as their Locator-Block.
+# A C-SID (16 bits) is made of the Locator-Node (8 bits), i.e. the ID of the
+# router, followed by the Function (8 bits). The first digit of the Function
+# selects the SRv6 behavior and the second one the flavors combined with
+# NEXT-C-SID:
+#
+# +----------+----------+--------------------+
+# | Function | behavior | flavors |
+# +----------+----------+--------------------+
+# | a1 | End | NEXT-C-SID and PSP |
+# +----------+----------+--------------------+
+#
+# For example, fcbb:0:04a1:02a1:: is a C-SID container carrying the C-SID of
+# rt-4 followed by the C-SID of rt-2, both with the NEXT-C-SID and PSP flavors.
+#
#
# SRv6 Policies
# =============
@@ -193,6 +224,93 @@
# set with the last SID; iii) the SRH is removed from the extension headers
# after the IPv6 header. At this point, the packet with IPv6 DA=cafe::1 is sent
# to the destination, i.e. hs-1.
+#
+# Traffic to the loopback addresses of the hosts
+# ----------------------------------------------
+#
+# Each host has an address on its loopback, cafe::x:a1. The traffic from the
+# other host towards this address is steered with C-SID containers: after the
+# ingress router, every router crossed applies the SRv6 End behavior with the
+# NEXT-C-SID and PSP flavors. The following SRv6 Policies are applied by rt-1
+# to the traffic towards cafe::2:a1 (i.c) and by rt-2 to the traffic towards
+# cafe::1:a1 (i.d):
+#
+# i.c) IPv6 traffic, SID List=fcbb:0:03a1::,fcbb:0:04a1:02a1::,cafe::2:a1
+# i.d) IPv6 traffic, SID List=fcbb:0:04a1:03a1:01a1::,cafe::1:a1
+#
+# In the Policy (i.c), rt-3 receives a zero Argument with SL=2 and applies the
+# "standard" End processing. rt-4 receives a non-zero Argument with SL=1: it
+# advances to the next C-SID and does *NOT* apply the PSP operation. rt-2
+# receives a zero Argument with SL=1 and applies the PSP operation.
+#
+# In the Policy (i.d), a single C-SID container carries three C-SIDs. rt-4 and
+# rt-3 receive a non-zero Argument with SL=1: they advance to the next C-SID and
+# do *NOT* apply the PSP operation. rt-1 receives a zero Argument with SL=1
+# and applies the PSP operation.
+#
+# The hosts use cafe::x as the source address, not the loopback address. The
+# replies are sent to cafe::x and follow the Policies (i.a) and (i.b), which
+# are tested first. This way, each ping checks a single Policy with the
+# NEXT-C-SID flavor, and a failure points directly to that Policy.
+#
+# The hosts drop the packets that carry an SRH (seg6_enabled is set to 0 on
+# the hosts). The loopback address of a host is reached only through the
+# router connected to that host: the ping succeeds only if the SRH is removed
+# by that router.
+#
+# Traffic with a consumed SRH
+# ---------------------------
+#
+# A packet can carry more than one SRH. The SRv6 End behavior skips an SRH with
+# SL=0 and processes the next header [1].
+#
+# The traffic of this section reuses the Policies (i.a), (i.b), (i.c) and (i.d).
+# A router on the path inserts an extra SRH in front of the Policy's SRH, and
+# another router then consumes the extra SRH.
+#
+# The Policy (i.a) has SID List=fcff:3::e,fcff:4::ef1,fcff:2::ef1,cafe::2. A
+# packet from hs-1 to hs-2 goes as follows:
+#
+# - rt-1 applies the Policy and sends the packet to rt-3:
+# IPv6 DA=fcff:3::e | Policy's SRH, SL=3 | Payload
+#
+# - rt-3 (End) processes the Policy's SRH and sends the packet to rt-4:
+# IPv6 DA=fcff:4::ef1 | Policy's SRH, SL=2 | Payload
+#
+# - rt-4 (End with PSP and SL>1, acting as End) processes the Policy's SRH.
+# The new DA is fcff:2::ef1:
+# IPv6 DA=fcff:2::ef1 | Policy's SRH, SL=1 | Payload
+# On rt-4, the route added by the test for fcff:2::ef1 then inserts the
+# extra SRH, with SID List=fcff:3::e,fcff:2::ef1, and the packet goes back to
+# rt-3:
+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload
+#
+# - rt-3 (End) consumes the extra SRH and sets the DA back to fcff:2::ef1:
+# IPv6 DA=fcff:2::ef1 | extra SRH, SL=0 | Policy's SRH, SL=1 | Payload
+#
+# - rt-2 (End with PSP) skips the extra SRH, processes the Policy's SRH and
+# removes it:
+# IPv6 DA=cafe::2 | extra SRH, SL=0 | Payload
+#
+# The extra SRH reaches hs-2, which skips it as its SL is 0. The other
+# Policies work in the same way:
+#
+# (i.b) hs-2 -> hs-1: on the packets with DA=fcff:1::ef1, rt-2 inserts the
+# extra SRH with SID List=fcff:3::e,fcff:1::ef1, and rt-3 consumes it.
+# (i.c) hs-1 -> hs-2: on the packets with DA=fcbb:0:02a1::, rt-4 inserts the
+# extra SRH with SID List=fcff:3::e,fcbb:0:02a1::, and rt-3 consumes it.
+# (i.d) hs-2 -> hs-1: on the packets with DA=fcbb:0:01a1::, rt-3 inserts the
+# extra SRH with SID List=fcff:4::e,fcbb:0:01a1::, and rt-4 consumes it.
+#
+# The Policy (i.b) has no router between rt-2 and rt-1. For this reason, rt-2
+# applies the Policy, inserts the extra SRH and sends the packet to rt-3:
+# IPv6 DA=fcff:3::e | extra SRH, SL=1 | Policy's SRH, SL=1 | Payload
+# rt-3 consumes the extra SRH, and rt-1 removes the Policy's SRH.
+#
+# The hosts need seg6_enabled set to 1 to accept the extra SRH, and it is set
+# back to 0 at the end. These tests only check that the ping succeeds: PSP
+# itself is checked by the PSP flavor and NEXT-C-SID,PSP tests, which run with
+# seg6_enabled set to 0.
# shellcheck source=lib.sh
source lib.sh
@@ -207,6 +325,17 @@ readonly IPv6_TESTS_ADDR=2001:db8::1
readonly LOCATOR_SERVICE=fcff
readonly END_FUNC=000e
readonly END_PSP_FUNC=0ef1
+readonly END_CSID_PSP_FUNC=a1
+
+readonly LCBLOCK_ADDR=fcbb:0
+readonly LCBLOCK_BLEN=32
+# do not add ':' as separator
+readonly LCNODE_FMT="0%d"
+readonly LCNODE_BLEN=8
+readonly LCNODEFUNC_BLEN=16
+
+readonly LCBLOCK_NODE_BLEN=$((LCBLOCK_BLEN + LCNODE_BLEN))
+readonly LCBLOCK_NODEFUNC_BLEN=$((LCBLOCK_BLEN + LCNODEFUNC_BLEN))
PING_TIMEOUT_SEC=4
PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
@@ -397,6 +526,40 @@ __get_srv6_rtcfg_op()
xargs | sed 's/ /,/g'
}
+# Given the ID of a router and a Function, the function returns the C-SID made
+# of the Locator-Node (8 bits), i.e. the ID of the router, followed by the
+# Function (8 bits).
+# e.g. input: "4" "a1"
+# output: "04a1"
+build_csid()
+{
+ local nodeid="$1"
+ local func="$2"
+
+ printf "${LCNODE_FMT}%s" "${nodeid}" "${func}"
+}
+
+# Given the <nodeid> token of a "next-csid,<flavors>" element, i.e. a
+# comma-separated list of node IDs, and a Function, the function returns the
+# C-SID container carrying the C-SIDs of these nodes.
+# e.g. input: "4,2" "a1"
+# output: "fcbb:0:04a1:02a1::"
+build_csid_container()
+{
+ local nodeids="$1"
+ local func="$2"
+ local csids=''
+ local nodes
+ local node
+
+ nodes="$(echo "${nodeids}" | sed 's/,/ /g')"
+ for node in ${nodes}; do
+ csids="${csids}:$(build_csid "${node}" "${func}")"
+ done
+
+ echo "${LCBLOCK_ADDR}${csids}::"
+}
+
# Setup the basic networking for the routers
setup_rt_networking()
{
@@ -439,6 +602,7 @@ setup_rt_local_sids()
local devname
local nsname
local neigh
+ local csid
nsname="$(get_rtname "${rt}")"
@@ -452,6 +616,14 @@ setup_rt_local_sids()
add "${LOCATOR_SERVICE}:${neigh}::/32" \
table "${LOCALSID_TABLE_ID}" \
via "${net_prefix}::${neigh}" dev "${devname}"
+
+ # set underlay network routes to reach the C-SID containers
+ # that start with a C-SID of the neighbor, for any Function.
+ csid="$(build_csid "${neigh}" 00)"
+ ip -netns "${nsname}" -6 route \
+ add "${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODE_BLEN}" \
+ table "${LOCALSID_TABLE_ID}" \
+ via "${net_prefix}::${neigh}" dev "${devname}"
done
# Local End behavior (note that "dev" is a dummy interface chosen for
@@ -461,6 +633,17 @@ setup_rt_local_sids()
table "${LOCALSID_TABLE_ID}" \
encap seg6local action End dev "${DUMMY_DEVNAME}"
+ # Local End behavior with the NEXT-C-SID and PSP flavors, bound to the
+ # C-SID of the router (e.g. fcbb:0:04a1::/48 on rt-4). The /48 prefix
+ # covers every C-SID container whose first C-SID is this one, whatever
+ # the Argument that follows.
+ csid="$(build_csid "${rt}" "${END_CSID_PSP_FUNC}")"
+ ip -netns "${nsname}" -6 route \
+ add "${LCBLOCK_ADDR}:${csid}::/${LCBLOCK_NODEFUNC_BLEN}" \
+ table "${LOCALSID_TABLE_ID}" \
+ encap seg6local action End flavors next-csid,psp \
+ lblen "${LCBLOCK_BLEN}" nflen "${LCNODEFUNC_BLEN}" \
+ dev "${DUMMY_DEVNAME}"
# all SIDs start with a common locator. Routes and SRv6 Endpoint
# behavior instances are grouped together in the 'localsid' table.
@@ -468,6 +651,12 @@ setup_rt_local_sids()
add to "${LOCATOR_SERVICE}::/16" \
lookup "${LOCALSID_TABLE_ID}" prio 999
+ # the C-SID containers use their own Locator-Block. Their routes and
+ # SRv6 Endpoint behavior instances are in the 'localsid' table too.
+ ip -netns "${nsname}" -6 rule \
+ add to "${LCBLOCK_ADDR}::/${LCBLOCK_BLEN}" \
+ lookup "${LOCALSID_TABLE_ID}" prio 999
+
# set default routes to unreachable
ip -netns "${nsname}" -6 route \
add unreachable default metric 4278198272 \
@@ -479,12 +668,16 @@ setup_rt_local_sids()
# configures the SRv6 nodes specified in the SID List to process the traffic
# according to the operations required by the Policy itself.
# args:
-# $1 - destination host (i.e. cafe::x host)
+# $1 - destination host (i.e. cafe::x host), or x:a1 for the address
+# cafe::x:a1 on the loopback of the host
# $2 - SRv6 router configured for enforcing the SRv6 Policy
# $3 - compact way to represent a list of SRv6 routers with their operations
# (i.e. behaviors) that each of them needs to perform. Every <nodeid:op>
# element constructs a SID that is associated with the behavior <op> on
# the <nodeid> node. The list of such elements forms an SRv6 Policy.
+# For "next-csid,psp", <nodeid> is a comma-separated list of node IDs.
+# The element constructs a C-SID container with the C-SIDs of these
+# nodes, e.g. "4,2:next-csid,psp" gives fcbb:0:04a1:02a1::.
__setup_rt_policy()
{
local dst="$1"
@@ -494,6 +687,7 @@ __setup_rt_policy()
local in_nsname
local rt_nsname
local policy=''
+ local container
local function
local fullsid
local op_type
@@ -520,6 +714,15 @@ __setup_rt_policy()
behavior_cfg="End flavors psp"
;;
+ "next-csid,psp")
+ # the behavior is already set up on every router by
+ # setup_rt_local_sids.
+ container="$(build_csid_container "${node}" \
+ "${END_CSID_PSP_FUNC}")"
+ policy="${policy}${container},"
+ continue
+ ;;
+
*)
break
;;
@@ -571,6 +774,7 @@ setup_hs()
ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.all.accept_dad=0
ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.default.accept_dad=0
+ ip netns exec "${hsname}" sysctl -wq net.ipv6.conf.all.seg6_enabled=0
ip -netns "${hsname}" link add veth0 type veth \
peer name "${RT2HS_DEVNAME}" netns "${rtname}"
@@ -590,6 +794,33 @@ setup_hs()
sysctl -wq net.ipv6.conf."${RT2HS_DEVNAME}".proxy_ndp=1
}
+# Set up an address on the loopback of a host, and the route towards it on the
+# router connected to the host.
+# args:
+# $1 - host
+# $2 - router connected to the host
+# $3 - suffix of the address (i.e. cafe::<host>:<suffix>)
+setup_hs_lo_addr()
+{
+ local hs="$1"
+ local rt="$2"
+ local suffix="$3"
+ local hsname
+ local rtname
+ local addr
+
+ hsname="$(get_hsname "${hs}")"
+ rtname="$(get_rtname "${rt}")"
+ addr="${IPv6_HS_NETWORK}::${hs}:${suffix}"
+
+ ip -netns "${hsname}" addr \
+ add "${addr}/128" dev lo nodad
+
+ ip -netns "${rtname}" -6 route \
+ add "${addr}" \
+ via "${IPv6_HS_NETWORK}::${hs}" dev "${RT2HS_DEVNAME}"
+}
+
setup()
{
local i
@@ -622,6 +853,11 @@ setup()
setup_hs 1 1
setup_hs 2 2
+ # set up the loopback addresses of the hosts used by the Policies (i.c)
+ # and (i.d).
+ setup_hs_lo_addr 1 1 "${END_CSID_PSP_FUNC}"
+ setup_hs_lo_addr 2 2 "${END_CSID_PSP_FUNC}"
+
# set up default SRv6 Endpoints (i.e. SRv6 End behavior)
setup_rt_local_sids 1 "2 3 4"
setup_rt_local_sids 2 "1 3 4"
@@ -645,6 +881,21 @@ setup()
setup_rt_policy_ipv6 2 1 "3:noflv 4:psp 2:psp"
setup_rt_policy_ipv6 1 2 "1:psp"
+ # Direction hs-1 -> hs-2 (cafe::2:a1, NEXT-C-SID and PSP flavors)
+ # - rt-1 (SRv6 H.Insert policy)
+ # - rt-3 (Argument=0 and SL>1, acting as an End behavior)
+ # - rt-4 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-2 (Argument=0 and SL=1, PSP)
+ #
+ # Direction hs-2 -> hs-1 (cafe::1:a1, NEXT-C-SID and PSP flavors)
+ # - rt-2 (SRv6 H.Insert policy)
+ # - rt-4 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-3 (Argument!=0 and SL=1, advancing the C-SID)
+ # - rt-1 (Argument=0 and SL=1, PSP)
+ setup_rt_policy_ipv6 "2:${END_CSID_PSP_FUNC}" 1 \
+ "3:next-csid,psp 4,2:next-csid,psp"
+ setup_rt_policy_ipv6 "1:${END_CSID_PSP_FUNC}" 2 "4,3,1:next-csid,psp"
+
# testing environment was set up successfully
SETUP_ERR=0
}
@@ -710,6 +961,20 @@ check_and_log_hs_connectivity()
check_and_log_hs_ipv6_connectivity "${hssrc}" "${hsdst}"
}
+check_and_log_hs_lo_addr_connectivity()
+{
+ local hssrc="$1"
+ local hsdst="$2"
+ local suffix="$3"
+ local dst
+
+ dst="${IPv6_HS_NETWORK}::${hsdst}:${suffix}"
+
+ check_hs_ipv6_connectivity "${hssrc}" "${hsdst}:${suffix}"
+ log_test $? 0 \
+ "IPv6 Hosts connectivity: hs-${hssrc} -> hs-${hsdst} (${dst})"
+}
+
router_tests()
{
local i
@@ -747,6 +1012,100 @@ host_srv6_end_flv_psp_tests()
check_and_log_hs_connectivity 2 1
}
+host_srv6_end_flv_next_csid_psp_tests()
+{
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, NEXT-C-SID,PSP)"
+
+ check_and_log_hs_lo_addr_connectivity 1 2 "${END_CSID_PSP_FUNC}"
+ check_and_log_hs_lo_addr_connectivity 2 1 "${END_CSID_PSP_FUNC}"
+}
+
+# On a router, add a route for a SID with seg6 encap in inline mode. The packets
+# that the router forwards to that SID get an extra SRH with the End SID of the
+# router that consumes it.
+# args:
+# $1 - router on which the route is added
+# $2 - SID of the route
+# $3 - router with the SRv6 End behavior that consumes the extra SRH
+setup_rt_consumed_srh()
+{
+ local rt="$1"
+ local sid="$2"
+ local end_rt="$3"
+ local nsname
+
+ nsname="$(get_rtname "${rt}")"
+
+ ip -netns "${nsname}" -6 route \
+ add "${sid}" table "${LOCALSID_TABLE_ID}" \
+ encap seg6 mode inline \
+ segs "${LOCATOR_SERVICE}:${end_rt}::${END_FUNC}" \
+ dev "${DUMMY_DEVNAME}"
+}
+
+cleanup_rt_consumed_srh()
+{
+ local rt="$1"
+ local sid="$2"
+ local nsname
+
+ nsname="$(get_rtname "${rt}")"
+
+ ip -netns "${nsname}" -6 route \
+ del "${sid}" table "${LOCALSID_TABLE_ID}"
+}
+
+set_hs_seg6_enabled()
+{
+ local val="$1"
+ local hsname
+ local hs
+
+ for hs in ${HOSTS}; do
+ hsname="$(get_hsname "${hs}")"
+
+ ip netns exec "${hsname}" \
+ sysctl -wq net.ipv6.conf.all.seg6_enabled="${val}"
+ ip netns exec "${hsname}" \
+ sysctl -wq net.ipv6.conf.veth0.seg6_enabled="${val}"
+ done
+}
+
+host_srv6_end_flv_consumed_srh_tests()
+{
+ local sid
+
+ log_section "SRv6 connectivity test hosts (h1 <-> h2, consumed SRH)"
+
+ set_hs_seg6_enabled 1
+
+ # Policy (i.a): rt-4 inserts the extra SRH consumed by rt-3
+ sid="${LOCATOR_SERVICE}:2::${END_PSP_FUNC}"
+ setup_rt_consumed_srh 4 "${sid}" 3
+ check_and_log_hs_connectivity 1 2
+ cleanup_rt_consumed_srh 4 "${sid}"
+
+ # Policy (i.b): rt-2 inserts the extra SRH consumed by rt-3
+ sid="${LOCATOR_SERVICE}:1::${END_PSP_FUNC}"
+ setup_rt_consumed_srh 2 "${sid}" 3
+ check_and_log_hs_connectivity 2 1
+ cleanup_rt_consumed_srh 2 "${sid}"
+
+ # Policy (i.c): rt-4 inserts the extra SRH consumed by rt-3
+ sid="$(build_csid_container 2 "${END_CSID_PSP_FUNC}")"
+ setup_rt_consumed_srh 4 "${sid}" 3
+ check_and_log_hs_lo_addr_connectivity 1 2 "${END_CSID_PSP_FUNC}"
+ cleanup_rt_consumed_srh 4 "${sid}"
+
+ # Policy (i.d): rt-3 inserts the extra SRH consumed by rt-4
+ sid="$(build_csid_container 1 "${END_CSID_PSP_FUNC}")"
+ setup_rt_consumed_srh 3 "${sid}" 4
+ check_and_log_hs_lo_addr_connectivity 2 1 "${END_CSID_PSP_FUNC}"
+ cleanup_rt_consumed_srh 3 "${sid}"
+
+ set_hs_seg6_enabled 0
+}
+
test_iproute2_supp_or_ksft_skip()
{
local flavor="$1"
@@ -836,6 +1195,8 @@ test_command_or_ksft_skip sort
test_command_or_ksft_skip xargs
test_dummy_dev_or_ksft_skip
+# NEXT-C-SID is not checked: every kernel and iproute2 version that
+# supports PSP also supports NEXT-C-SID.
test_iproute2_supp_or_ksft_skip psp
test_kernel_supp_or_ksft_skip psp
@@ -848,5 +1209,7 @@ set +e
router_tests
host2gateway_tests
host_srv6_end_flv_psp_tests
+host_srv6_end_flv_next_csid_psp_tests
+host_srv6_end_flv_consumed_srh_tests
print_log_test_results
|
| 33/3 | 2026/10/11 19:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 11570 output: 79 thoughts: 134 Thoughts: **Analyzing a Patch Series for KMSAN Fuzzing Necessity** Okay, so I've got this patch series in front of me, and my immediate goal is to figure out if it warrants a KMSAN fuzzing session. The first thing I always do is dive into the diff. I need to understand *exactly* what's being modified. Alright, the diff shows changes in `net/ipv6/seg6_local.c` and a selftest, specifically `tools/testing/selftests/net/srv6_end_flavors_test.sh`. That's a decent starting point. Now, let's drill down. I'll focus on `net/ipv6/seg6_local.c` around the affected lines. Time to utilize the tools at my disposal – the trusty `read-file` and `grepper` are going to be my friends here. Let's start by inspecting that C file. I need to understand the context of these changes. |
| 34/3 | 2026/10/11 19:58 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 545,
"LineCount": 70
}Results: {
"Contents": " 545:\t\n 546:\t\treturn input_action_end_x_finish(skb, slwt);\n 547:\t}\n 548:\t\n 549:\tstatic bool seg6_next_csid_enabled(__u32 fops)\n 550:\t{\n 551:\t\treturn fops \u0026 SEG6_F_LOCAL_FLV_NEXT_CSID;\n 552:\t}\n 553:\t\n 554:\tstatic bool seg6_flv8986_enabled(__u32 fops)\n 555:\t{\n 556:\t\treturn fops \u0026 SEG6_LOCAL_FLV8986_SUPP_OPS;\n 557:\t}\n 558:\t\n 559:\t/* check whether the NEXT-C-SID processing has to be used for the packet,\n 560:\t * instead of the RFC8986 flavors set for the given SRv6 End* behavior\n 561:\t * instance.\n 562:\t *\n 563:\t * This function returns:\n 564:\t * - true, when the packet has to go through the NEXT-C-SID processing;\n 565:\t * - false, when NEXT-C-SID is not configured or the packet has to be\n 566:\t * processed on the basis of the RFC8986 flavors.\n 567:\t */\n 568:\tstatic bool seg6_use_next_csid(struct sk_buff *skb,\n 569:\t\t\t\t const struct seg6_flavors_info *finfo)\n 570:\t{\n 571:\t\tconst struct in6_addr *addr;\n 572:\t\t__u32 fops = finfo-\u003eflv_ops;\n 573:\t\n 574:\t\tif (!seg6_next_csid_enabled(fops))\n 575:\t\t\treturn false;\n 576:\t\n 577:\t\taddr = \u0026ipv6_hdr(skb)-\u003edaddr;\n 578:\t\n 579:\t\t/* NEXT-C-SID and the RFC8986 flavors combine according to the\n 580:\t\t * DA.Argument (see RFC9800, sections 4.1.1 and 4.1.7):\n 581:\t\t *\n 582:\t\t * DA.Argument RFC8986 flavors processing\n 583:\t\t * (1) != 0 any NEXT-C-SID only, SL unchanged\n 584:\t\t * (2) == 0 none the behavior, e.g. End\n 585:\t\t * (3) == 0 one or more the behavior with its flavors,\n 586:\t\t * e.g. End with PSP\n 587:\t\t *\n 588:\t\t * In (2), the packet still goes through the NEXT-C-SID processing,\n 589:\t\t * which runs the behavior (e.g. End) when the DA.Argument is zero.\n 590:\t\t */\n 591:\t\treturn !seg6_flv8986_enabled(fops) ||\n 592:\t\t !seg6_next_csid_is_arg_zero(addr, finfo);\n 593:\t}\n 594:\t\n 595:\t/* Processing of SRv6 End, End.X, and End.T behaviors can be extended through\n 596:\t * the flavors framework. These behaviors must report the subset of (flavor)\n 597:\t * operations they currently implement. In this way, if a user specifies a\n 598:\t * flavor combination that is not supported by a given End* behavior, the\n 599:\t * kernel refuses to instantiate the tunnel reporting the error.\n 600:\t */\n 601:\tstatic int seg6_flv_supp_ops_by_action(int action, __u32 *fops)\n 602:\t{\n 603:\t\tswitch (action) {\n 604:\t\tcase SEG6_LOCAL_ACTION_END:\n 605:\t\t\t*fops = SEG6_LOCAL_END_FLV_SUPP_OPS;\n 606:\t\t\tbreak;\n 607:\t\tcase SEG6_LOCAL_ACTION_END_X:\n 608:\t\t\t*fops = SEG6_LOCAL_END_X_FLV_SUPP_OPS;\n 609:\t\t\tbreak;\n 610:\t\tdefault:\n 611:\t\t\treturn -EOPNOTSUPP;\n 612:\t\t}\n 613:\t\n 614:\t\treturn 0;\n"
} |
| 35/3 | 2026/10/11 19:58 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 770,
"LineCount": 100
}Results: {
"Contents": " 770:\t\tsrhlen = ipv6_optlen(srh);\n 771:\t\n 772:\t\t/* we are about to mangle the pkt, let's check if we can write on it */\n 773:\t\tif (unlikely(skb_ensure_writable(skb, srhoff + srhlen)))\n 774:\t\t\treturn false;\n 775:\t\n 776:\t\t/* skb_ensure_writable() may change skb pointers; evaluate srh again */\n 777:\t\tsrh = (struct ipv6_sr_hdr *)(skb-\u003edata + srhoff);\n 778:\t\tsrh_nexthdr = srh-\u003enexthdr;\n 779:\t\n 780:\t\tif (unlikely(!skb_transport_header_was_set(skb)))\n 781:\t\t\tgoto pull;\n 782:\t\n 783:\t\tnhlen = skb_network_header_len(skb);\n 784:\t\t/* we have to deal with the transport header: it could be set before\n 785:\t\t * the SRH, after the SRH, or within it (which is considered wrong,\n 786:\t\t * however).\n 787:\t\t */\n 788:\t\tif (likely(nhlen \u003c= srhoff))\n 789:\t\t\tthoff = nhlen;\n 790:\t\telse if (nhlen \u003e= srhoff + srhlen)\n 791:\t\t\t/* transport_header is set after the SRH */\n 792:\t\t\tthoff = nhlen - srhlen;\n 793:\t\telse\n 794:\t\t\t/* transport_header falls inside the SRH; hence, we can't\n 795:\t\t\t * restore the transport_header pointer properly after\n 796:\t\t\t * SRH removing operation.\n 797:\t\t\t */\n 798:\t\t\treturn false;\n 799:\tpull:\n 800:\t\t/* we need to pop the SRH:\n 801:\t\t * 1) first of all, we pull out everything from IPv6 header up to SRH\n 802:\t\t * (included) evaluating also the rcsum;\n 803:\t\t * 2) we overwrite (and then remove) the SRH by properly moving the\n 804:\t\t * IPv6 along with any extension header that precedes the SRH;\n 805:\t\t * 3) At the end, we push back the pulled headers (except for SRH,\n 806:\t\t * obviously).\n 807:\t\t */\n 808:\t\tskb_pull_rcsum(skb, srhoff + srhlen);\n 809:\t\tmemmove(skb_network_header(skb) + srhlen, skb_network_header(skb),\n 810:\t\t\tsrhoff);\n 811:\t\tskb_push(skb, srhoff);\n 812:\t\n 813:\t\tskb_reset_network_header(skb);\n 814:\t\tskb_mac_header_rebuild(skb);\n 815:\t\tif (likely(thoff \u003e= 0))\n 816:\t\t\tskb_set_transport_header(skb, thoff);\n 817:\t\n 818:\t\tiph = ipv6_hdr(skb);\n 819:\t\tif (srhoff == sizeof(*iph)) {\n 820:\t\t\tiph-\u003enexthdr = srh_nexthdr;\n 821:\t\t} else {\n 822:\t\t\t/* we must look for the extension header (EXTH, for short) that\n 823:\t\t\t * immediately precedes the SRH we have just removed, i.e. the\n 824:\t\t\t * EXTH that ends at srhoff. We find it by its position and not\n 825:\t\t\t * by its nexthdr, since another routing header (e.g. an SRH\n 826:\t\t\t * with SL = 0) may come before the removed SRH.\n 827:\t\t\t * Then, we update the value of the EXTH nexthdr with the one\n 828:\t\t\t * contained in the SRH nexthdr.\n 829:\t\t\t */\n 830:\t\t\tunsigned int off = sizeof(*iph);\n 831:\t\t\tstruct ipv6_opt_hdr *hp, _hdr;\n 832:\t\t\t__u8 nexthdr = iph-\u003enexthdr;\n 833:\t\n 834:\t\t\tfor (;;) {\n 835:\t\t\t\tif (unlikely(!ipv6_ext_hdr(nexthdr) ||\n 836:\t\t\t\t\t nexthdr == NEXTHDR_NONE))\n 837:\t\t\t\t\treturn false;\n 838:\t\n 839:\t\t\t\thp = skb_header_pointer(skb, off, sizeof(_hdr), \u0026_hdr);\n 840:\t\t\t\tif (unlikely(!hp))\n 841:\t\t\t\t\treturn false;\n 842:\t\n 843:\t\t\t\tswitch (nexthdr) {\n 844:\t\t\t\tcase NEXTHDR_FRAGMENT:\n 845:\t\t\t\t\tfallthrough;\n 846:\t\t\t\tcase NEXTHDR_AUTH:\n 847:\t\t\t\t\t/* we expect SRH before FRAG and AUTH */\n 848:\t\t\t\t\treturn false;\n 849:\t\t\t\tdefault:\n 850:\t\t\t\t\toff += ipv6_optlen(hp);\n 851:\t\t\t\t\tbreak;\n 852:\t\t\t\t}\n 853:\t\n 854:\t\t\t\tif (off == srhoff) {\n 855:\t\t\t\t\thp-\u003enexthdr = srh_nexthdr;\n 856:\t\t\t\t\tbreak;\n 857:\t\t\t\t}\n 858:\t\n 859:\t\t\t\tnexthdr = hp-\u003enexthdr;\n 860:\t\t\t}\n 861:\t\t}\n 862:\t\n 863:\t\tiph-\u003epayload_len = htons(skb-\u003elen - sizeof(struct ipv6hdr));\n 864:\t\n 865:\t\tskb_postpush_rcsum(skb, iph, srhoff);\n 866:\t\n 867:\t\treturn true;\n 868:\t}\n 869:\t\n"
} |
| 36/3 | 2026/10/11 19:58 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14776 output: 40 thoughts: 37 Thoughts: Okay, let's dive into this. I need to get a handle on the modifications in `net/ipv6/seg6_local.c`. More specifically, my immediate focus is on the chunk of code from roughly lines 867 to 970. I expect this section likely contains the meat of a particular change or set of related changes within the SEG6 local functionality. This range is a good place to start, as it is a specific region, which helps me maintain focus. |
| 37/3 | 2026/10/11 19:58 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 865,
"LineCount": 100
}Results: {
"Contents": " 865:\t\tskb_postpush_rcsum(skb, iph, srhoff);\n 866:\t\n 867:\t\treturn true;\n 868:\t}\n 869:\t\n 870:\t/* look up the SRH to be processed by the RFC8986 flavors. As End does, a\n 871:\t * routing header with SL = 0 is skipped (e.g. an SRH already consumed).\n 872:\t * This function returns NULL when no valid SRH is found.\n 873:\t */\n 874:\tstatic struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)\n 875:\t{\n 876:\t\tstruct ipv6_sr_hdr *srh;\n 877:\t\n 878:\t\tsrh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);\n 879:\t\tif (srh)\n 880:\t\t\treturn srh;\n 881:\t\n 882:\t\t/* we take the first routing header without skipping it. In this way,\n 883:\t\t * seg6_get_srh_pktinfo() reports SL = 0 and not a missing SRH.\n 884:\t\t */\n 885:\t\treturn seg6_get_srh(skb, 0);\n 886:\t}\n 887:\t\n 888:\t/* process the packet on the basis of the RFC8986 flavors set for the given\n 889:\t * SRv6 End behavior instance.\n 890:\t */\n 891:\tstatic int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 892:\t{\n 893:\t\tenum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;\n 894:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 895:\t\tenum seg6_local_flv_action action;\n 896:\t\tenum seg6_local_pktinfo pinfo;\n 897:\t\tstruct ipv6_sr_hdr *srh;\n 898:\t\tint err = -EINVAL;\n 899:\t\t__u32 flvmask;\n 900:\t\tint srhoff;\n 901:\t\n 902:\t\tsrh = seg6_flv8986_get_srh(skb);\n 903:\t\tsrhoff = srh ? ((unsigned char *)srh - skb-\u003edata) : 0;\n 904:\t\tpinfo = seg6_get_srh_pktinfo(srh);\n 905:\t#ifdef CONFIG_IPV6_SEG6_HMAC\n 906:\t\tif (srh \u0026\u0026 !seg6_hmac_validate_skb(skb, srh))\n 907:\t\t\tgoto drop;\n 908:\t#endif\n 909:\t\t/* NEXT-C-SID, when configured, has already been evaluated by the\n 910:\t\t * caller. Only the RFC8986 flavors are left here.\n 911:\t\t */\n 912:\t\tflvmask = finfo-\u003eflv_ops \u0026 ~SEG6_F_LOCAL_FLV_NEXT_CSID;\n 913:\t\tif (unlikely(flvmask \u0026 ~SEG6_LOCAL_FLV8986_SUPP_OPS)) {\n 914:\t\t\tpr_warn_once(\"seg6local: invalid RFC8986 flavors\\n\");\n 915:\t\t\tgoto drop;\n 916:\t\t}\n 917:\t\n 918:\t\t/* retrieve the action triggered by the combination of pktinfo data and\n 919:\t\t * the flavors mask.\n 920:\t\t */\n 921:\t\taction = seg6_local_flv8986_act_lookup(pinfo, flvmask);\n 922:\t\tswitch (action) {\n 923:\t\tcase SEG6_LOCAL_FLV_ACT_END:\n 924:\t\t\t/* process the packet as the \"standard\" End behavior */\n 925:\t\t\tsrh = advance_nextseg(skb, srh, \u0026reason);\n 926:\t\t\tif (!srh) {\n 927:\t\t\t\terr = -ENOMEM;\n 928:\t\t\t\tgoto drop;\n 929:\t\t\t}\n 930:\t\t\tbreak;\n 931:\t\tcase SEG6_LOCAL_FLV_ACT_PSP:\n 932:\t\t\tsrh = advance_nextseg(skb, srh, \u0026reason);\n 933:\t\t\tif (!srh) {\n 934:\t\t\t\terr = -ENOMEM;\n 935:\t\t\t\tgoto drop;\n 936:\t\t\t}\n 937:\t\n 938:\t\t\tif (unlikely(!seg6_pop_srh(skb, srhoff)))\n 939:\t\t\t\tgoto drop;\n 940:\t\t\tbreak;\n 941:\t\tcase SEG6_LOCAL_FLV_ACT_UNSPEC:\n 942:\t\t\tfallthrough;\n 943:\t\tdefault:\n 944:\t\t\t/* by default, we drop the packet since we could not find a\n 945:\t\t\t * suitable action.\n 946:\t\t\t */\n 947:\t\t\tgoto drop;\n 948:\t\t}\n 949:\t\n 950:\t\treturn input_action_end_finish(skb, slwt);\n 951:\t\n 952:\tdrop:\n 953:\t\tkfree_skb_reason(skb, reason);\n 954:\t\treturn err;\n 955:\t}\n 956:\t\n 957:\t/* regular endpoint function */\n 958:\tstatic int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 959:\t{\n 960:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 961:\t\t__u32 fops = finfo-\u003eflv_ops;\n 962:\t\n 963:\t\tif (!fops)\n 964:\t\t\treturn input_action_end_core(skb, slwt);\n"
} |
| 38/3 | 2026/10/11 19:58 | llm | kmsan-evaluator |
6mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16607 output: 39 thoughts: 30 Thoughts: Okay, here's my attempt at summarizing those lines as if they were my thought process, keeping in mind I'm dealing with `net/ipv6/seg6_local.c` and assuming I'm an expert in this area: **Analyzing `net/ipv6/seg6_local.c` - Lines 965-985** Right, let me pull up lines 965-985 of `net/ipv6/seg6_local.c`. I need to get a clear picture of what's going on in this section of the code. This likely pertains to some crucial aspect of Segment Routing v6 (SRv6) local function processing, maybe related to route lookups, encapsulations, or decapsulations. Given the file and the general structure of these kernel modules, I'm anticipating some handling of SRH (Segment Routing Header) operations. Could be related to an endpoint function. Let me see... I'll be looking for clues about the data structures and control flow. I'll need to pay close attention to the variables and function calls in this section to identify the critical logic that's being implemented here. Specifically, I'll be looking for any hints on how the segment list is handled or what the error handling looks like in this section. I'll also be trying to infer the impact of any changes to this part of the code. |
| 39/3 | 2026/10/11 20:05 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 960,
"LineCount": 30
}Results: {
"Contents": " 960:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 961:\t\t__u32 fops = finfo-\u003eflv_ops;\n 962:\t\n 963:\t\tif (!fops)\n 964:\t\t\treturn input_action_end_core(skb, slwt);\n 965:\t\n 966:\t\t/* NEXT-C-SID is evaluated first, when configured */\n 967:\t\tif (seg6_use_next_csid(skb, finfo))\n 968:\t\t\treturn end_next_csid_core(skb, slwt);\n 969:\t\n 970:\t\t/* the specific processing function to be performed on the packet\n 971:\t\t * depends on the combination of flavors defined in RFC8986 and some\n 972:\t\t * information extracted from the packet, e.g. presence/absence of SRH,\n 973:\t\t * Segment Left = 0, etc.\n 974:\t\t */\n 975:\t\treturn end_flv8986_core(skb, slwt);\n 976:\t}\n 977:\t\n 978:\t/* regular endpoint, and forward to specified nexthop */\n 979:\tstatic int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n 980:\t{\n 981:\t\tconst struct seg6_flavors_info *finfo = \u0026slwt-\u003eflv_info;\n 982:\t\t__u32 fops = finfo-\u003eflv_ops;\n 983:\t\n 984:\t\t/* check for the presence of NEXT-C-SID since it applies first */\n 985:\t\tif (seg6_next_csid_enabled(fops))\n 986:\t\t\treturn end_x_next_csid_core(skb, slwt);\n 987:\t\n 988:\t\treturn input_action_end_x_core(skb, slwt);\n 989:\t}\n"
} |
| 40/3 | 2026/10/11 20:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17522 output: 27 thoughts: 29 Thoughts: Okay, let's dive into this. Here's my thought process laid out: **Examining the Function `seg6_next_csid_is_arg_zero`** Alright, I need to understand what this function, `seg6_next_csid_is_arg_zero`, is actually doing. My immediate approach is to locate its definition within the codebase. I need to understand its purpose within the context of the larger architecture. Let's start with a thorough search. I'll need to figure out the best way to search so I can understand the bigger picture. |
| 41/3 | 2026/10/11 20:06 | tool | grepper |
0mArgs:{
"Expression": "seg6_next_csid_is_arg_zero"
}Results: {
"Output": "net/ipv6/seg6_local.c=393=static __u8 seg6_flv_lcnode_func_octects(const struct seg6_flavors_info *finfo)\n--\nnet/ipv6/seg6_local.c-397-\nnet/ipv6/seg6_local.c:398:static bool seg6_next_csid_is_arg_zero(const struct in6_addr *addr,\nnet/ipv6/seg6_local.c-399-\t\t\t\t const struct seg6_flavors_info *finfo)\n--\nnet/ipv6/seg6_local.c=478=static int end_next_csid_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-483-\nnet/ipv6/seg6_local.c:484:\tif (seg6_next_csid_is_arg_zero(daddr, finfo))\nnet/ipv6/seg6_local.c-485-\t\treturn input_action_end_core(skb, slwt);\n--\nnet/ipv6/seg6_local.c=529=static int end_x_next_csid_core(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-535-\nnet/ipv6/seg6_local.c:536:\tif (seg6_next_csid_is_arg_zero(daddr, finfo))\nnet/ipv6/seg6_local.c-537-\t\treturn input_action_end_x_core(skb, slwt);\n--\nnet/ipv6/seg6_local.c=568=static bool seg6_use_next_csid(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-591-\treturn !seg6_flv8986_enabled(fops) ||\nnet/ipv6/seg6_local.c:592:\t !seg6_next_csid_is_arg_zero(addr, finfo);\nnet/ipv6/seg6_local.c-593-}\n"
} |
| 42/3 | 2026/10/11 20:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18266 output: 39 thoughts: 36 Thoughts: Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts: **Analyzing `seg6_next_csid_is_arg_zero` and Related Functions** Alright, time to get into the nitty-gritty. I need to understand how the system determines the next CSID value, particularly the scenario where the argument is zero. My immediate focus is the `seg6_next_csid_is_arg_zero` function, and I'll need to explore its context, checking the surrounding functions within `net/ipv6/seg6_local.c`. What influences its behavior? What inputs does it take, and what outputs does it provide? I need to build a comprehensive picture to understand the logic behind the CSID selection process, especially when a zero argument is involved. I'll be looking for any potential optimization opportunities or potential areas for bugs that might exist within this code. My expertise demands I approach this as a deep dive, ensuring I understand every facet of this section of code. |
| 43/3 | 2026/10/11 20:06 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 395,
"LineCount": 40
}Results: {
"Contents": " 395:\t\treturn finfo-\u003elcnode_func_bits \u003e\u003e 3;\n 396:\t}\n 397:\t\n 398:\tstatic bool seg6_next_csid_is_arg_zero(const struct in6_addr *addr,\n 399:\t\t\t\t\t const struct seg6_flavors_info *finfo)\n 400:\t{\n 401:\t\t__u8 fnc_octects = seg6_flv_lcnode_func_octects(finfo);\n 402:\t\t__u8 blk_octects = seg6_flv_lcblock_octects(finfo);\n 403:\t\t__u8 arg_octects;\n 404:\t\tint i;\n 405:\t\n 406:\t\targ_octects = 16 - blk_octects - fnc_octects;\n 407:\t\tfor (i = 0; i \u003c arg_octects; ++i) {\n 408:\t\t\tif (addr-\u003es6_addr[blk_octects + fnc_octects + i] != 0x00)\n 409:\t\t\t\treturn false;\n 410:\t\t}\n 411:\t\n 412:\t\treturn true;\n 413:\t}\n 414:\t\n 415:\t/* assume that DA.Argument length \u003e 0.\n 416:\t * skb pointers may change: after this call, the caller must evaluate again\n 417:\t * any pointer into the packet data.\n 418:\t *\n 419:\t * This function returns:\n 420:\t * - SKB_NOT_DROPPED_YET on success;\n 421:\t * - SKB_DROP_REASON_NOMEM when the skb cannot be made writable.\n 422:\t */\n 423:\tstatic enum skb_drop_reason\n 424:\tseg6_next_csid_advance_arg(struct sk_buff *skb,\n 425:\t\t\t\t const struct seg6_flavors_info *finfo)\n 426:\t{\n 427:\t\t__u8 fnc_octects = seg6_flv_lcnode_func_octects(finfo);\n 428:\t\t__u8 blk_octects = seg6_flv_lcblock_octects(finfo);\n 429:\t\tstruct in6_addr *addr;\n 430:\t\n 431:\t\tif (unlikely(skb_ensure_writable(skb, sizeof(struct ipv6hdr))))\n 432:\t\t\treturn SKB_DROP_REASON_NOMEM;\n 433:\t\n 434:\t\taddr = \u0026ipv6_hdr(skb)-\u003edaddr;\n"
} |
| 44/3 | 2026/10/11 20:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19282 output: 21 thoughts: 2655 Thoughts: **Analyzing the SRv6 Patch for Potential KMSAN Needs**
Okay, let's break down these changes and see if they necessitate KMSAN. It looks like we're refining the SRv6 End behavior, specifically how it interacts with NEXT-C-SID and RFC8986 flavors like PSP. The patch corrects how we identify the relevant extension header in `seg6_pop_srh`. Previously, we were using a simple `nexthdr` check, but this could misidentify the *first* routing header instead of the one immediately *before* the SRH we're targeting. The change now correctly identifies that header. The changes to `seg6_flv8986_get_srh` and `input_action_end` are simply to use this new function/behavior consistently.
Now, let's shift gears and think about potential bugs. I need to determine if this patch *introduces* or *exposes* uninitialized memory risks. I know KMSAN is for detecting those sorts of issues, so I need to go through the guidelines.
First, is data being sent to user space? I *think* not directly. These modifications are within the networking stack, processing packets. However, I need to be more careful. Can we inadvertently leak uninitialized data *through* the skb (socket buffer)? The changes center on manipulating network headers within `seg6_pop_srh`. We're shifting data around within the `skb` using `memmove`, `skb_push`, and then accessing header fields using `skb_header_pointer`. In the code, `skb_ensure_writable(skb, srhoff + srhlen)` and `skb_pull_rcsum(skb, srhoff + srhlen)` suggests that the head of the skb is being modified to ensure it is linear so it can be overwritten.
Now, looking at the loop in `seg6_pop_srh`, I'm looking for where we might read uninitialized memory. Previously, the code checked if `hp->nexthdr == NEXTHDR_ROUTING`, but this has been changed to `if (off == srhoff) { hp->nexthdr = srh_nexthdr; break; }`. We *are* overwriting `hp->nexthdr`, which is okay. The important thing is how we are getting `hp`. `hp = skb_header_pointer(skb, off, sizeof(_hdr), &_hdr)`: the `_hdr` is only used if `skb` is not contiguous, meaning, if the buffer is non-linear then `_hdr` is used to hold the data, otherwise `hp` points to the `skb->data` buffer. Because of `skb_ensure_writable`, we should be fine here since the memory pointed to by `hp` is overwritten.
What about `seg6_flv8986_get_srh`? This function seems safe since the `seg6_get_srh` should return an SRH or NULL, and it's simply a wrapper.
Given that `skb_ensure_writable` is used, and that the code does not modify any kernel structures that are sent to userspace, I am going to say this change does not introduce any risks of uninitialized memory usage or info-leaks, and thus, does *not* need KMSAN. While we *are* manipulating header fields, the code makes sure that those fields are writable. The original memory is populated by a network packet, and then the patch only writes to the memory.
|
| 45/3 | 2026/10/11 20:06 | tool | grepper |
0mArgs:{
"Expression": "seg6_get_srh"
}Results: {
"Output": "include/net/seg6.h=67=extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced);\ninclude/net/seg6.h:68:extern struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags);\ninclude/net/seg6.h-69-extern void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt);\n--\nnet/ipv6/seg6.c=26=bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced)\n--\nnet/ipv6/seg6.c-78-\nnet/ipv6/seg6.c:79:struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags)\nnet/ipv6/seg6.c-80-{\n--\nnet/ipv6/seg6.c=112=void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt)\n--\nnet/ipv6/seg6.c-117-\t/* Update network header to point to the invoking packet\nnet/ipv6/seg6.c:118:\t * inside the ICMP packet, so we can use the seg6_get_srh()\nnet/ipv6/seg6.c-119-\t * helper.\n--\nnet/ipv6/seg6.c-122-\nnet/ipv6/seg6.c:123:\tsrh = seg6_get_srh(skb, 0);\nnet/ipv6/seg6.c-124-\tif (!srh)\n--\nnet/ipv6/seg6_local.c=216=static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)\n--\nnet/ipv6/seg6_local.c-219-\nnet/ipv6/seg6_local.c:220:\tsrh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);\nnet/ipv6/seg6_local.c-221-\tif (!srh)\n--\nnet/ipv6/seg6_local.c=232=static bool decap_and_validate(struct sk_buff *skb, int proto)\n--\nnet/ipv6/seg6_local.c-236-\nnet/ipv6/seg6_local.c:237:\tsrh = seg6_get_srh(skb, 0);\nnet/ipv6/seg6_local.c-238-\tif (srh \u0026\u0026 srh-\u003esegments_left \u003e 0)\n--\nnet/ipv6/seg6_local.c=290=static struct ipv6_sr_hdr *advance_nextseg(struct sk_buff *skb,\n--\nnet/ipv6/seg6_local.c-299-\t/* we write only the Segment Left field and the IPv6 DA. The segment\nnet/ipv6/seg6_local.c:300:\t * list is only read, and seg6_get_srh() already pulled it into the\nnet/ipv6/seg6_local.c-301-\t * linear area.\n--\nnet/ipv6/seg6_local.c=622=enum seg6_local_pktinfo {\n--\nnet/ipv6/seg6_local.c-632-\nnet/ipv6/seg6_local.c:633:static enum seg6_local_pktinfo seg6_get_srh_pktinfo(struct ipv6_sr_hdr *srh)\nnet/ipv6/seg6_local.c-634-{\n--\nnet/ipv6/seg6_local.c=874=static struct ipv6_sr_hdr *seg6_flv8986_get_srh(struct sk_buff *skb)\n--\nnet/ipv6/seg6_local.c-877-\nnet/ipv6/seg6_local.c:878:\tsrh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH);\nnet/ipv6/seg6_local.c-879-\tif (srh)\n--\nnet/ipv6/seg6_local.c-882-\t/* we take the first routing header without skipping it. In this way,\nnet/ipv6/seg6_local.c:883:\t * seg6_get_srh_pktinfo() reports SL = 0 and not a missing SRH.\nnet/ipv6/seg6_local.c-884-\t */\nnet/ipv6/seg6_local.c:885:\treturn seg6_get_srh(skb, 0);\nnet/ipv6/seg6_local.c-886-}\n--\nnet/ipv6/seg6_local.c=891=static int end_flv8986_core(struct sk_buff *skb, struct seg6_local_lwt *slwt)\n--\nnet/ipv6/seg6_local.c-903-\tsrhoff = srh ? ((unsigned char *)srh - skb-\u003edata) : 0;\nnet/ipv6/seg6_local.c:904:\tpinfo = seg6_get_srh_pktinfo(srh);\nnet/ipv6/seg6_local.c-905-#ifdef CONFIG_IPV6_SEG6_HMAC\n"
} |
| 46/3 | 2026/10/11 20:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 24133 output: 36 thoughts: 25 Thoughts: Okay, let's dive into this. Here's my thought process as I approach inspecting `seg6_get_srh` in `net/ipv6/seg6.c`: **Initial Examination of `seg6_get_srh`** Alright, I need to get my bearings. The task is to examine the function `seg6_get_srh` within the `net/ipv6/seg6.c` file. Right away, my expert intuition tells me this likely deals with the retrieval or extraction of a Segment Routing Header (SRH) from an IPv6 packet. The name is pretty explicit, so it's a good starting point. I'll need to understand how this function fits into the larger picture of IPv6 Segment Routing in the kernel. I need to understand what this does. How does it handle memory? What error conditions does it check for? How does it interact with other kernel functions? I'll be looking for things like buffer overflows, resource leaks, or any potential race conditions. I'm going to pay close attention to the parameter list, return values, and any use of kernel data structures. This function is critical, because getting it wrong could have consequences. I need to figure out what data is being provided to this function and how it is being used to make a good determination. Given that I am a highly skilled engineer, I can quickly scan the code. I will pay very close attention to any pointers or memory allocations. Also, I will be looking for any external dependencies or assumptions the function makes about the packet or the network configuration. |
| 47/3 | 2026/10/11 20:06 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6.c",
"FirstLine": 75,
"LineCount": 40
}Results: {
"Contents": " 75:\t\n 76:\t\treturn true;\n 77:\t}\n 78:\t\n 79:\tstruct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags)\n 80:\t{\n 81:\t\tstruct ipv6_sr_hdr *srh;\n 82:\t\tint len, srhoff = 0;\n 83:\t\n 84:\t\tif (ipv6_find_hdr(skb, \u0026srhoff, IPPROTO_ROUTING, NULL, \u0026flags) \u003c 0)\n 85:\t\t\treturn NULL;\n 86:\t\n 87:\t\tif (!pskb_may_pull(skb, srhoff + sizeof(*srh)))\n 88:\t\t\treturn NULL;\n 89:\t\n 90:\t\tsrh = (struct ipv6_sr_hdr *)(skb-\u003edata + srhoff);\n 91:\t\n 92:\t\tlen = (srh-\u003ehdrlen + 1) \u003c\u003c 3;\n 93:\t\n 94:\t\tif (!pskb_may_pull(skb, srhoff + len))\n 95:\t\t\treturn NULL;\n 96:\t\n 97:\t\t/* note that pskb_may_pull may change pointers in header;\n 98:\t\t * for this reason it is necessary to reload them when needed.\n 99:\t\t */\n 100:\t\tsrh = (struct ipv6_sr_hdr *)(skb-\u003edata + srhoff);\n 101:\t\n 102:\t\tif (!seg6_validate_srh(srh, len, true))\n 103:\t\t\treturn NULL;\n 104:\t\n 105:\t\treturn srh;\n 106:\t}\n 107:\t\n 108:\t/* Determine if an ICMP invoking packet contains a segment routing\n 109:\t * header. If it does, extract the offset to the true destination\n 110:\t * address, which is in the first segment address.\n 111:\t */\n 112:\tvoid seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt)\n 113:\t{\n 114:\t\t__u16 network_header = skb-\u003enetwork_header;\n"
} |
| 48/3 | 2026/10/11 20:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25127 output: 39 thoughts: 20 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, presented in the first person: **Investigating `seg6_get_srh_pktinfo`** Alright, let's dive into this `seg6_get_srh_pktinfo` function. My initial thought is to figure out exactly what it's contributing to the overall picture. I'm assuming, given the naming, that it's dealing with packet information related to Segment Routing Header (SRH) configurations, likely within the context of a network data plane. I need to understand its role. Is it just extracting data from the SRH, or is it also validating the header, possibly updating internal state, or maybe even interacting with the forwarding engine in some way? The name is descriptive, but it doesn't tell the whole story. I'll need to look at the implementation to fully grasp its function. Perhaps there are critical dependencies or side effects I need to be aware of? Are there potential performance bottlenecks, or race conditions I should be on the lookout for, based on the specific usage patterns it might encounter? I’m thinking about its role in the data path, and how it is optimized. |
| 49/3 | 2026/10/11 20:06 | tool | read-file |
0mArgs:{
"File": "net/ipv6/seg6_local.c",
"FirstLine": 630,
"LineCount": 40
}Results: {
"Contents": " 630:\t\n 631:\t#define SEG6_LOCAL_PKTINFO_MAX (__SEG6_LOCAL_PKTINFO_MAX - 1)\n 632:\t\n 633:\tstatic enum seg6_local_pktinfo seg6_get_srh_pktinfo(struct ipv6_sr_hdr *srh)\n 634:\t{\n 635:\t\t__u8 sgl;\n 636:\t\n 637:\t\tif (!srh)\n 638:\t\t\treturn SEG6_LOCAL_PKTINFO_NOHDR;\n 639:\t\n 640:\t\tsgl = srh-\u003esegments_left;\n 641:\t\tif (sgl \u003c 2)\n 642:\t\t\treturn SEG6_LOCAL_PKTINFO_SL_ZERO + sgl;\n 643:\t\n 644:\t\treturn SEG6_LOCAL_PKTINFO_SL_MORE;\n 645:\t}\n 646:\t\n 647:\tenum seg6_local_flv_action {\n 648:\t\tSEG6_LOCAL_FLV_ACT_UNSPEC\t= 0,\n 649:\t\tSEG6_LOCAL_FLV_ACT_END,\n 650:\t\tSEG6_LOCAL_FLV_ACT_PSP,\n 651:\t\tSEG6_LOCAL_FLV_ACT_USP,\n 652:\t\tSEG6_LOCAL_FLV_ACT_USD,\n 653:\t\t__SEG6_LOCAL_FLV_ACT_MAX\n 654:\t};\n 655:\t\n 656:\t#define SEG6_LOCAL_FLV_ACT_MAX (__SEG6_LOCAL_FLV_ACT_MAX - 1)\n 657:\t\n 658:\t/* The action table for RFC8986 flavors (see the flv8986_act_tbl below)\n 659:\t * contains the actions (i.e. processing operations) to be applied on packets\n 660:\t * when flavors are configured for an End* behavior.\n 661:\t * By combining the pkinfo data and from the flavors mask, the macro\n 662:\t * computes the index used to access the elements (actions) stored in the\n 663:\t * action table. The index is structured as follows:\n 664:\t *\n 665:\t * index\n 666:\t * _______________/\\________________\n 667:\t * / \\\n 668:\t * +----------------+----------------+\n 669:\t * | pf | afm |\n"
} |
| 50/3 | 2026/10/11 20:06 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26113 output: 304 thoughts: 1672 Thoughts: **Analysis of Segment Routing over IPv6 (SRv6) Local Behavior Updates** Okay, let's break down this patch. I'm looking at updates to the IPv6 Segment Routing implementation in `net/ipv6/seg6_local.c`, specifically focusing on how it handles NEXT-C-SID and RFC 8986 flavors like PSP (Policy-Based Segment Routing). My initial thought is to scrutinize the code for any potential uninitialized memory reads or leaks, the primary domain where KMSAN shines. First, I examine the `input_action_end` function and `seg6_use_next_csid`. I confirm that all the variables, such as `fops` and `addr`, are properly initialized before use. The logic in `seg6_next_csid_is_arg_zero` iterates over the bytes in the destination address, but the address itself is directly extracted from the packet header, so it doesn't pose an uninitialized memory risk. Next, I move on to `seg6_pop_srh`. Here, the focus is on how extension headers are traversed when popping the Segment Routing Header (SRH). I verify that `off` is initialized correctly, and that `nexthdr` is also properly initialized from the IPv6 header. The `skb_header_pointer` function is used safely, ensuring that header pointers are within the bounds of the SKB, protected by checks. The `ipv6_optlen` function is called after bounds checks and reads the length field of the option header. The code carefully checks that the header is a valid extension header, and is handled correctly. No uninitialized memory is accessed or read in this loop. I also confirm that `srh` is obtained through `seg6_get_srh` in `seg6_flv8986_get_srh`. Then, I check `end_flv8986_core`, making sure that `flvmask` is properly initialized with `finfo->flv_ops` before the bitwise operations. A key concern is whether any new kernel structures are copied to user space, which could lead to information leaks. However, I see no `copy_to_user`, `put_user`, netlink skb attributes, or ioctl calls. This significantly reduces the risk. My next step is to methodically investigate whether there are any memory initialization gaps, particularly within the bounds checks or logic, which might inadvertently allow access to uninitialized bytes of existing buffers. In `seg6_pop_srh`, I confirm that the `off` variable is initialized to the size of the IPv6 header and is incremented correctly and safely with `ipv6_optlen(hp)`. The code includes bounds checks using `skb_header_pointer` and ensures the headers are valid extension headers. This effectively prevents reading uninitialized memory. Finally, I address memory allocation and potential dependencies on uninitialized variables. The patch doesn't introduce any new memory allocations, and I've already established that the code doesn't rely on uninitialized variables. I've also confirmed that there are no kernel-to-user memory info-leaks, based on the previous check for any user-space copies. Given that no uninitialized memory risks are present, and the code primarily involves bounds checks on existing skb data with safe access routines, this code change is safe. Bugs would be logic errors in routing or network processing that are caught by normal testing, or memory safety issues detected by KASAN. Therefore, KMSAN is not necessary, as the code changes would be 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), there is no risk of uninitialized memory usage or info-leaks. I can confidently conclude that `NeedsKMSAN=false` for this patch. |
| 51/3 | 2026/10/11 20:07 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch modifies the IPv6 SRv6 local behavior implementation in `net/ipv6/seg6_local.c` to properly combine NEXT-C-SID with RFC 8986 flavors (such as PSP) and correctly handle extension header traversal when popping an SRH preceded by another routing header, along with adding self-tests.\n\nReviewing KMSAN vs. KASAN applicability:\n1. No uninitialized memory or info-leak risks: The patch does not introduce or modify any kernel-to-user copies (copy_to_user, netlink attributes, ioctl structures, socket options) or allocate new uninitialized data structures.\n2. Variable and buffer safety: All variables introduced or used (such as `fops`, `addr`, `off`, `nexthdr`) are fully initialized. Packet data accessed during header parsing is checked and validated via `skb_header_pointer()`, `pskb_may_pull()`, and `skb_ensure_writable()`.\n3. Standard sanitizers sufficiency: Any potential issues arising from the changes would be logic errors or out-of-bounds accesses during skb header adjustments, both of which are caught by functional tests and standard KASAN. There is no uninitialized memory reading or branching on uninitialized data that would necessitate dedicated KMSAN fuzzing.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch modifies the IPv6 SRv6 local behavior implementation in `net/ipv6/seg6_local.c` to properly combine NEXT-C-SID with RFC 8986 flavors (such as PSP) and correctly handle extension header traversal when popping an SRH preceded by another routing header, along with adding self-tests.\n\nReviewing KMSAN vs. KASAN applicability:\n1. No uninitialized memory or info-leak risks: The patch does not introduce or modify any kernel-to-user copies (copy_to_user, netlink attributes, ioctl structures, socket options) or allocate new uninitialized data structures.\n2. Variable and buffer safety: All variables introduced or used (such as `fops`, `addr`, `off`, `nexthdr`) are fully initialized. Packet data accessed during header parsing is checked and validated via `skb_header_pointer()`, `pskb_may_pull()`, and `skb_ensure_writable()`.\n3. Standard sanitizers sufficiency: Any potential issues arising from the changes would be logic errors or out-of-bounds accesses during skb header adjustments, both of which are caught by functional tests and standard KASAN. There is no uninitialized memory reading or branching on uninitialized data that would necessitate dedicated KMSAN fuzzing.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|