From nobody Fri Sep 25 20:02:43 2026 Received: from mail-qk2-f12.google.com (mail-qk2-f12.google.com [74.125.230.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5A25367B7B for ; Tue, 8 Sep 2026 23:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.230.204 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911122; cv=none; b=dBWd91Zl7HGwzXj+vjFmgInIQrf9ZuFSfGkfL6zdzHinUZcJd0/nYMvQIOWds9tkLO3TwQJu81Lug/wOS2IU6+ORqyIGNnxF58YTAub39G5pr4sw4ELHYwGFj65qXGyeM3v7UB2DfdwkQeJgUer9ka7Ubil8kGRU+4otXnXr38U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911122; c=relaxed/simple; bh=NAqErJbYzbVMfkAK0K42VgnPFlRX5e95U/2VfdKXRNc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m0XAnxn5d7zNPVoRlokuMFE8b+mOSEZ+RBVETAp5UVSb4QZU67BGsPC8Y47CI7ZyqjI11ioorqHylnyHFxA9uyPPsaF4Ef+mEJ9vqjEmmdOazNOjgMjl0HDzgbUWKz02hC5AbDd0IrmfAE85uju76FRA+656TZelThXaTXNeyoo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hLVQX34F; arc=none smtp.client-ip=74.125.230.204 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hLVQX34F" Received: by mail-qk2-f12.google.com with SMTP id af79cd13be357-939a6fb86cdso67557885a.1 for ; Tue, 08 Sep 2026 16:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788911120; x=1789515920; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6L6L3ARb9Cg3F9zGE6ufoGiq2DWwbPsHri/Jf9J8RbY=; b=hLVQX34F5carL36Ld+o1NkbUhtZ62fUgJIpfUV8T5q+Ve940ZfXUxxXfNUePvTMvWe x7Q6MT2IiJuNKTtpqOprQjmkKjRJVVq1SWGGLciOejNVVZGHuO9xjbkqSiPFifoWNann K/5X5hVgtxDEs8Gyhv3Wac71GplDkT7P1bOxyDawF0D8p42cTgFJc1pKQ9hvc165GyJL YOVx/gpYEKK95T8zvG0OZkZgBcXAyPBfWShc0fr9Q01cwu236WlrTRI4dLkeDJuvMZ2Z ghNitJpLuEtwswr4dDCb38Ir7onk07bt8MKoHVOKaY74CLHKAhWYHGfyveH+ty2zrNc4 W46g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788911120; x=1789515920; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6L6L3ARb9Cg3F9zGE6ufoGiq2DWwbPsHri/Jf9J8RbY=; b=hX7C9U2ILLqwWbhoS32bNQQF95tNmCQ2Cxl7sCS4IfAOVNqNrbpwzBKL6/3oWrHPtL M5K1j81Ooj529hm/8O4NGJhaa7Yjm7FKUcEgIMtcpMrZ3Qbeanmv7HdQFwjLRVDYPAZM Ss/F0At/7z4Wf4IpXs8cVOn5kNUJQOv00bZ3c5k7WYP+STPfd343ic8dnXIzZKU0Rx+p vPAfdYIrAddS+WTY7NXTNEJo1pNuggf3D2s0uVu+iT72IcTB8xQN3bL2y3ZjncIREzPz ww+yQGJPg25Ygq/Wgr4lnxSUiONGdOPjAlYrPXuZZh7q56GTwPvqInRaEXjKrgNpzNSa f78w== X-Forwarded-Encrypted: i=1; AKwUvBxbg8f0fCb1G1BWpr84QPsN4+fvsxia2S4oC6qLbqqwnZPuoeo2o5Nrdzo77TDsp/BrCBtmLxoAM0GgqE0=@vger.kernel.org X-Gm-Message-State: AFuF++m6ABacpWr7eew3OdDnHboC25i9ln6BNWiRkU3uA2QpciX22xie VftiprUnxQe9eQIJIFEmviDCJZBJ+Hh4Zo466gUIgAlF7J89Lwn9XOUL X-Gm-Gg: AYBFou1/5V4ZmLb2EG8tgR7B1FxTWJUTHXU2yljRld+1B4ysXnoKe3e0XjsYh4xCfmm +Yq3AMuO93Xx3MlZf+ROMmuJzL1SdnajzWIZzSa6ivh6u3KQNmTQtvulozOqaxYmQL5RIYiBwk6 s2L7diZUJSSHv8mvBAX2Ezw0VjZliOT1EzkVSv0xyJ0JzVaEfJ+vbZ2B7xHKgcjI0KC7y2THwok 7HJVk21ISS8IH/R8PScc5KCTKCKRaucGbNz/McupPKGf6jrK8hXswlG+15G1HNpsfAjvWxKjfoF qGzFpu+D9fJKhLR0JU4eiEDBvxlKYmDU5Sos/7kTQzVzYUHBmAK6ITmQpe0c91t0em2bQnhpzmz yRpAW92/z7g7Szd5ykKMwqr6Tuw0LLujydBpBs65B3v7pR7F22QNbATG/bdSejl49yggIbH7+ZK SQbxFUgvz7FBCybrqvlkpy2Tj3pz2DokgAkeFcHGfT6gHttK+VqJCzLK80rCsepSep59GpLRgCg 0ATRuLg6g== X-Received: by 2002:a05:620a:90d1:20b0:939:bb9c:e43a with SMTP id af79cd13be357-939bb9ce46cmr549260885a.3.1788911119531; Tue, 08 Sep 2026 16:45:19 -0700 (PDT) Received: from elster.cvl.swallow.glass ([2606:8e80:692f:3320:980c:c29f:b4b9:c06a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-939aff54ae0sm551872585a.8.2026.09.08.16.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 16:45:19 -0700 (PDT) From: Taylor Bates Date: Tue, 08 Sep 2026 19:45:07 -0400 Subject: [PATCH net-next 1/4] netlink: specs: fix duplicate if/then keys in netlink-raw schema Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-ynl-robustness-v1-1-f255214c0f30@gmail.com> References: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> In-Reply-To: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jiri Pirko , Stanislav Fomichev Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Taylor Bates X-Mailer: b4 0.15.2 Currently netlink-raw.yaml contains two if keys and two then keys in a single mapping that enforces a "len" for "pad" members and a "len" or "struct" for binary members. During validation PyYAML resolves duplicate keys last-wins, so only the binary rule survives. Pad has not been validated since January 2024. None of the current specs violate this rule, but this validation should not be parser dependent and unspecified. Strict YAML validators such as Red Hat's VS Code YAML extension and Adrien Verge's yamllint will reject the netlink-raw.yaml schema: Command: $ yamllint Documentation/netlink/netlink-raw.yaml Output: 185:13 error duplication of key "if" in mapping (key-duplicates) 189:13 error duplication of key "then" in mapping (key-duplicates) The following invalid netlink family spec will pass validation in the current ynl tooling: # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) --- name: minimal-raw doc: Minimal netlink-raw family for schema validation testing. protocol: netlink-raw protonum: 0 definitions: - name: test-struct type: struct members: - name: reserved type: pad # len intentionally omitted attribute-sets: [] operations: list: [] Fixes: bf08f32c8ced ("tools/net/ynl: Add support for nested structs") Signed-off-by: Taylor Bates --- Documentation/netlink/netlink-raw.yaml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink= /netlink-raw.yaml index 4c436b59a34b..18ccfe05048a 100644 --- a/Documentation/netlink/netlink-raw.yaml +++ b/Documentation/netlink/netlink-raw.yaml @@ -176,20 +176,23 @@ properties: struct: description: Name of the nested struct type. type: string - if: - properties: - type: - const: pad - then: - required: [ len ] - if: - properties: - type: - const: binary - then: - oneOf: - - required: [ len ] - - required: [ struct ] + allOf: + - + if: + properties: + type: + const: pad + then: + required: [ len ] + - + if: + properties: + type: + const: binary + then: + oneOf: + - required: [ len ] + - required: [ struct ] # End genetlink-legacy =20 attribute-sets: --=20 2.55.0 From nobody Fri Sep 25 20:02:43 2026 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 504AE43CE56 for ; Tue, 8 Sep 2026 23:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911122; cv=none; b=hXFftf/qigWPbd05Xr81F3hjYf9l2cb38YoHXPd3nu+SeN72+Kc3nCIhEY+REVL7B7yvoisFVeLo6Aw3nF7PzpnOvNeheYNGAfvGgPM2+ev658yJCZPRcaDeUSzEnq+u5mSZWuNOEsYcSC9JJsq2JpOigQDlAY3ZVtr8/tbHRGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911122; c=relaxed/simple; bh=hotybtSbsQBNd1PJoAPelq/tgh52ZnwI56VfFV3i3eE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m0yMC8d5tS1KiSXiVfbYwtHdQeCEAp+uLm70oAKAFIk1kwpcC+ahXqrbl9+0KyPqA/02UdtjP4JyyMo3Iak+5P2qHvfu9p2X7GeztfHz7dNvMLlW6S6bV0ye8+auhFI+T+SfnSd4E5HlBlPUkr+hvoiacXJ4LE4KQQH7VkcfdtY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dXMMAaWP; arc=none smtp.client-ip=209.85.222.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dXMMAaWP" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-939c25604d4so89941785a.3 for ; Tue, 08 Sep 2026 16:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788911120; x=1789515920; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cGeRVFj68octQZ8KoKtzEyWU/+FN9IgTUp6CFSRRfvE=; b=dXMMAaWPSxsrB0W4YZWNAsbPKifiGEaTyq6tVadyG7Zr506kB0U+JL8cDRU88EmKzL etY61koEigrtNdh855uKCDlBi98J8fon11oKNfR4GuJn5DrtumuYFf8jrZMS6oiSc9jj gIa2vkC03BPT85AYgpmm7nNzv16CK6MaXARfeJDdNc4bqwjEDQRkbbe9sFp2xW1QC3i4 zHiJXdUJ/02QYideB6KY3dyoDf5wwWBLOxug1cS9a3bkONu+/VnhWEhbEIO+PpzQe5Nl rrAaLw5fmgkQpmDhQCnI3AFqRpK16klJ1u/w557aJSnyZP2NrnKZJrIX0xrguGXB4bQY Tyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788911120; x=1789515920; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=cGeRVFj68octQZ8KoKtzEyWU/+FN9IgTUp6CFSRRfvE=; b=elUXSQW3snee7QDKjcYJkgAS9tpVtTnRXQ4rVuO3TY9vitkpcQLNZHWuVmaQMCGOp6 qGxr+/mENcbIXNKWxcUT4Ij8NGdDp5N0RTTwsMLWRdeLit64BflZKZ4lAbmOC+frmfDj MUqwLns6exMYWIuBP36N4yHWcI8mtP2ptoYrE45Tl8fYP1eL8efY8vO0G6oFucVOiHVC xpykI+g65eRlGz5IJF7wMKT7Dn2ILh15VPzLRsUn1YzuvNm/B6hFAWXh7CA2Lw3MRA1y HeonoF3Zc9p+w7InZWiuyWc3kqQLyL+DZQX2/mH1JheQHHTPPwqiFoM8OLv3ln97bPpx VPtg== X-Forwarded-Encrypted: i=1; AKwUvBzO4Vb5NV5HnSIQqirFB1a+BCGk83Kqhj55Z+f+F0IqtDZXkxnpUlwsDBJ3ZcY0+dnJs2/yuZCkPrRueho=@vger.kernel.org X-Gm-Message-State: AFuF++mXEKX6uQxeb8saOg8ieoyycHdNvz/JwiagSnnLUUDYOfjomGYi 3u9JjgTeugCN7f5NHp4W+GJjq1vp0EDeJVikHfsjSA1Lu/doDItHNRD1 X-Gm-Gg: AYBFou0i8ucFHK40eNE/Fyicp53FBkFWjcB+SevqzVhgwKoDMal2fDl5yjX3SzpOCkm GOUBiBdLORMu0XWFyR8xVXdsleKdhPaiRFj9LMA2VBoYxaND1R8yMFWOoWMTV2MbrPknm9Nw3NL P/H3js8SViMfm6mu0H+UUT0/JR2qXmyBrEHyKA97QLE57ZgqJF8L7WHlZW3+gR2ejAxpTn8hDBN at88CH+waOGMxVg3RUtC8z/jiaVIL50vC/HQoZQ+BmM2sGUMfMEqoNQF1WPOWsdmMV/zt+zSjIl TgcxsygR154ljCtu8ZI9oRFN/jrpW/v2d66fQBlI6FcFS/RwInM8RJdtu6TTR+wDZNVN4ByiJ/X pRwUlM0twYnt/Fv0xsCCqcq2VGIY5jrUUSYuC1D5X9hPMDXUJyrNlOU9dCuGWz6eymqHTywX55w zUS093TCqhyoBP0jj9Bed6g/vI2JE3rD58pWDS/uNaPKDoM9bR+3UIPptb/sk9AuFEMuv+LOkrb Q6hPrRBMALZG4qkWulU X-Received: by 2002:a05:620a:2856:b0:92e:6c15:24cd with SMTP id af79cd13be357-9398037a018mr3290546985a.15.1788911120013; Tue, 08 Sep 2026 16:45:20 -0700 (PDT) Received: from elster.cvl.swallow.glass ([2606:8e80:692f:3320:980c:c29f:b4b9:c06a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-939aff54ae0sm551872585a.8.2026.09.08.16.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 16:45:19 -0700 (PDT) From: Taylor Bates Date: Tue, 08 Sep 2026 19:45:08 -0400 Subject: [PATCH net-next 2/4] tools: ynl: reject zero-length attributes instead of looping forever Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-ynl-robustness-v1-2-f255214c0f30@gmail.com> References: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> In-Reply-To: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jiri Pirko , Stanislav Fomichev Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Taylor Bates X-Mailer: b4 0.15.2 The following bug was found in the ynl tooling while parsing MDBA_ROUTER_PORT entries on a real bridge device with IGMP snooping enabled, not through fuzzing. This occurs if the parser walks into a nested attribute containing a headerless entry (such as MDBA_ROUTER_PORT) and reads the ifindex parameter as a length, rather than data. If the parser reads this now misaligned data and parses a field containing a zero byte, it will run in an infinite loop. It will continuously append empty attribute objects and consume 100% CPU until it exhausts the system's memory. The most straightforward way to trigger this systematically is as follows: 1. Create a bridge device with multicast_vlan_snooping enabled. 2. Add a permanent multicast router port to the bridge that lands on ifindex 8. (The mcast_router 2 state ensures that its timer is zero.) 3. Feed NlAttrs() from pyynl the MDBA_ROUTER_PORT netlink payload. This example creates a bytes object that reproduces the same shape as the payload: msg =3D struct.pack('HH', 8, 1) + struct.pack('I', 0xdeadbeef) msg +=3D struct.pack('HH', 0, 2) NlAttrs(msg) Fixes: e4b48ed460d3 ("tools: ynl: add a completely generic client") Signed-off-by: Taylor Bates --- Full reproducer, run under "unshare -Urn" so the namespace starts with only lo and ifindex allocation restarts from 1: ip link add br0 type bridge vlan_filtering 1 mcast_snooping 1 \ mcast_vlan_snooping 1 ip link set br0 up n=3D0 while :; do n=3D$((n + 1)) ip link add d$n type dummy idx=3D$(ip -o link show d$n | cut -d: -f1 | tr -d ' ') [ $((idx & 0xffff)) =3D 8 ] && break [ $n -gt 200 ] && { echo "gave up"; exit 1; } done ip link set d$n master br0 ip link set d$n up bridge vlan add dev d$n vid 10 bridge vlan set dev d$n vid 10 mcast_router 2 bridge vlan global set dev br0 vid 10 mcast_snooping 1 The BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS payload the kernel then sends: 34 00 02 00 MDBA_ROUTER, len 52 30 00 01 00 MDBA_ROUTER_PORT, len 48 08 00 00 00 bare ifindex 8, written by nla_put_nohdr() 08 00 01 00 MDBA_ROUTER_PATTR_TIMER, len 8 00 00 00 00 timer value, 0 for a permanent router Read as a header, the ifindex claims eight bytes and consumes the MDBA_ROUTER_PATTR_TIMER header along with itself. The walk then lands on the timer value, four zero bytes, and nla_len is 0. full_len is 0 too, so the offset never advances. --- tools/net/ynl/pyynl/lib/ynl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/net/ynl/pyynl/lib/ynl.py b/tools/net/ynl/pyynl/lib/ynl.py index 8682bf588e1f..375a15d83a34 100644 --- a/tools/net/ynl/pyynl/lib/ynl.py +++ b/tools/net/ynl/pyynl/lib/ynl.py @@ -317,6 +317,10 @@ class NlAttrs: =20 while offset < len(msg): attr =3D NlAttr(msg, offset) + if attr.full_len < 4: + raise YnlException( + f'Malformed attribute at offset {offset}: ' + f'length {attr.payload_len} is shorter than the header= ') offset +=3D attr.full_len self.attrs.append(attr) =20 --=20 2.55.0 From nobody Fri Sep 25 20:02:43 2026 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D26EC4B04AE for ; Tue, 8 Sep 2026 23:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911123; cv=none; b=jxqbbHti9emOOb1wxkCF/H9JH0YCeTc8zckjTfxKljDtgmwjSMMGGoZcO3vNDStaj/hglOs6IGlqVshRM/py4C2qD2IOAN82dAudfvhTL0V3/Jm4v6NnO9l7Z0g6Pu77bBSIPirpXQCZHSKuhc9GklZ0k4FIvUcasKCrDSvEaUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911123; c=relaxed/simple; bh=UNHyV5Vp2KGWRl3CC0o5xYWyjuskR4xDHkSn9B/vuNw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MCxYPExb8SGmTXCqxqpeqzt59+qEJ0iJ8uSgKfMWda4qLbFOKwR19TE1rFWf2NXixFtuImczrJNOqEofRagmTWgfYeDV6RVFRlai1CVOtyDdbGD6ZOo82YyCxbGNm68/VrrYsOSCos88A0Y45wu4fW0PeeQOFyjQqa3Fd0vpBdU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H/wSnJDq; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H/wSnJDq" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-936c02e58dfso445663785a.3 for ; Tue, 08 Sep 2026 16:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788911121; x=1789515921; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HOpcOU9vheynx/fQ+9xFXI+Vv0lGzJ7j1NxiFmEU3PU=; b=H/wSnJDqIDu9xA+aumqQ8Fz7nrkXyMM/weEBnGM54W7yWWvKQyJMk39MSDmkqTz7n2 o8aR4+bcjhGjXdCBMYBheAEtUfsM/UTe6VNZjfSBWImT6VIQjql8/IRJIZw3jh3W4n+Y lYJDEBm9ouj5D68MjBlUtgVuA73Em1FUK1b6voRrk+LiAd0sN7Zk0XK2CkFWPCE1eKrb BnFi20hDMowcJi7tjuwnwc66xddt54mHBtQkq65VOPYXA9p7wtce5hgj9EQtdj7gukmW ZVso8Gc7GIHrHX4fRWETmaq+fb7Glo33t5Vkhy0Ld/UgPzXA7UlSESHiNb7hYVo3BU9x ECJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788911121; x=1789515921; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HOpcOU9vheynx/fQ+9xFXI+Vv0lGzJ7j1NxiFmEU3PU=; b=S+OkRephidGZ3YsKihnMoiKc78hp8PHJRHF72XzUf8CQK2p/YxRN/ngb/+mm7FCh63 dY7UDUy8Kn17Tk1Ve1Z907/CW4y9MWHtk74AGDA7dtJSQrgRpD3xh0Bk6KbSuIOpPF/K W2TGM4wKo+S4A79tniK1tBlb7m2HDjtMA9k8EovH8cbEdswGN7fZ3ePxuHc1a6PAJwNL UE/aK9MMglmVxQHbFRjGSwFeCAdATMVzIdLDv/BYWi9oXf2Pvvqeeta9m3OYGBnaL+kd pCN93+Yptr69YYsgqpVg7Ddfzd9otAh8zuoG5VUK/MJyQTBvh6GU/FGSEkGD2YoQVJTk vqGg== X-Forwarded-Encrypted: i=1; AKwUvBxjbHbi831Nz+dPIoDHaG4N33QRXJdE3//KoGzK9g73oxrpmixR75ZOc9bW6U7yp9QRYdDY+s0wHStpdqA=@vger.kernel.org X-Gm-Message-State: AFuF++mSzrd15T6QHUFZX9JhOTPW1T9YDZUpOmWYlMpZiqnCemLWVt7A BfDoXDCUAmW12TXOvkCc3vivdXElbNaf9WxhiPGBo7DsaK8mQP8SWG0I X-Gm-Gg: AYBFou1e/lez4xC152iyAJJh8Trj/zf3/A0XTXo16h08OXfY9ATNLLWs+UGX1YV9LOI Ha695/AaiNh1UuQmYD+LmcpGOtHqoOzrTDoavZgOpOMkiKsnZ2kIYJ4CuVoTwfF2J2BC/yFoOU3 yrKELNWOlszH0QHuJPucrFF9/vC3raIHPv3fwZSmSTGmWpV/wWs+VU5Qd9T99DOFsFkKeqlFgV5 nragsZDzwOazFDas7jYMr7cv5aV84ubbBkrI14kOakG7rrmaHsVPHQfvca0SbqeK05Cr0LfT83h wkJjYHlR+lsyMdq8G0rrs0o3OXGdbY8ZUPp74SKakFX+b/U78d32/jjZrr38T9YR+5+O5lU8UfR U+yFhE5L5dwE9tV4NLd9UKT+v3qUH07MklhsFEmOgyE3AxSrK2NK4pvofH6GtfQmHc4oK3Eakjq 6kvvY8A6P2HEjHaiD5cYFc0ggm8hVczuGDA6JO1QKf1VuVd057PU3dkx+POhpFZeRZOA73JWfrO M3Jc+HiJvI= X-Received: by 2002:a05:620a:c0e:b0:939:1acd:7d9 with SMTP id af79cd13be357-939802f7bbdmr2380037685a.4.1788911120570; Tue, 08 Sep 2026 16:45:20 -0700 (PDT) Received: from elster.cvl.swallow.glass ([2606:8e80:692f:3320:980c:c29f:b4b9:c06a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-939aff54ae0sm551872585a.8.2026.09.08.16.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 16:45:20 -0700 (PDT) From: Taylor Bates Date: Tue, 08 Sep 2026 19:45:09 -0400 Subject: [PATCH net-next 3/4] tools: ynl: stop find_kernel_root() spinning at the filesystem root Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-ynl-robustness-v1-3-f255214c0f30@gmail.com> References: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> In-Reply-To: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jiri Pirko , Stanislav Fomichev Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Taylor Bates X-Mailer: b4 0.15.2 In the current pyynl tooling, the find_kernel_root() function contains a loop that climbs up the directory tree relative to the spec file until it finds a MAINTAINERS file. If ynl_gen_c.py is run in-tree it terminates properly in the root of the kernel tree. The relative directory returned is then used to build the provenance comment. The path of the root directory that it terminates at is thrown away immediately at the call site: _, spec_kernel =3D find_kernel_root(args.spec) However, if it is run out-of-tree and does not find a MAINTAINERS file in any of the directories, find_kernel_root() reaches "/". Since os.path.dirname() is idempotent at "/", the while True: has no exit. This can be reproduced on today's tree if the specs are copied to a directory outside of the kernel tree: mkdir -p /tmp/ynl-oot/specs cp Documentation/netlink/netlink-raw.yaml /tmp/ynl-oot/ cp Documentation/netlink/specs/rt-link.yaml /tmp/ynl-oot/specs/ tools/net/ynl/pyynl/ynl_gen_c.py --spec /tmp/ynl-oot/specs/rt-link.yaml \ --mode uapi --header The fallback implemented in this patch still provides a usable output: /* Do not edit directly, auto-generated from: */ /* tmp/ynl-oot/specs/rt-link.yaml */ Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink") Signed-off-by: Taylor Bates --- tools/net/ynl/pyynl/ynl_gen_c.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 2b3483db1b60..1c422141d2d7 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -3449,7 +3449,12 @@ def find_kernel_root(full_path): sub_path =3D '' while True: sub_path =3D os.path.join(os.path.basename(full_path), sub_path) - full_path =3D os.path.dirname(full_path) + parent =3D os.path.dirname(full_path) + if parent =3D=3D full_path: + # Reached the filesystem root without finding a kernel tree, f= all + # back to the path given. + return None, sub_path[:-1] + full_path =3D parent maintainers =3D os.path.join(full_path, "MAINTAINERS") if os.path.exists(maintainers): return full_path, sub_path[:-1] --=20 2.55.0 From nobody Fri Sep 25 20:02:43 2026 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C3AD511E84 for ; Tue, 8 Sep 2026 23:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911124; cv=none; b=AXC73WhtzrFVrO9RVYJ2sT4/Z+aG7i23nXkl7EklBUvy3zBXa3gmVrYyFXNhRN877sEL4Pnr20h4ls/RkUGK8i4GFCvLGtR60pNTlSmVERZnN6DebUrZMq2qgOJ/7XqUTsRlb9L3Xau0hqOzziownMSajH6aRNJqC1y5QEkRgOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788911124; c=relaxed/simple; bh=Y/hoSKnUCJ+qLSjPn+IHO3Agb8RUz0LOCMZy00mpR/E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hQqv5I6XsjE0KvBjLElm3ac7NxDGEOSnDHll6UZkMbiO1M6I2zlQF+V2xB36+9aT+1aXElz6p2UooPirykDp0jdqFj3XkDXvSo+FVgKkSGeuI4hx540Z7vgkNhjcgJbw2Acp2TEm8x8XvCIXS52pUjj1HucsxLyD+BstA42QITU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=onyDnFDw; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="onyDnFDw" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-9399798ca61so364779785a.1 for ; Tue, 08 Sep 2026 16:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788911121; x=1789515921; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sCcjGI0c3b8hQ4t5uTNFVaCAwxBXVaF0bs8I4YGo9l4=; b=onyDnFDwkjgm0ptg5su7LlKMRiVjxvVNAexwfO7gTW6hIyurDnrArp4ijVsdWad+48 vTP7qYRimsMe9BSgrHLurXjwFfpw6tyrkhPJiNrNWQuvHXu9EN8FK+3q44+yrdczvldk l9QYaH/uxIW1HaJf0WQoXPGGLQ0KC2Im1jzEciIXSl2YNEKuhQ4YQcobZaSKRMXTWphf KuZeNX9YdlEeaX91ou9MVTb5IMB6nLmAyGsi2zRa7Vtq0fU1Enmtz0av4N41nk5hsdgw UnOgwwt92wXY1GotmanRNfV+1nDLeqyrcC30TkLLJNxQszU2fmxGVi3UdoQT2QNPecp+ qKHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788911121; x=1789515921; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=sCcjGI0c3b8hQ4t5uTNFVaCAwxBXVaF0bs8I4YGo9l4=; b=T1XUlB3scJ4iHgEge/m8HHB4pjdGE0ujLIlNNrkVvriT8NudBrcQofto5PYDFZTeHz NuqCE4RY8uAQshkcZ7HYZpmuyXCeO4ou4JYTbHxCthjAeWdzdz5FFY3/4C71gNDgoh/z VLdXFncHetwr2kNsiZWfUCPXj1KzDvJ75faOxQITkjZqmHJzaXZoTFki4FBem9s8vDa1 4hMTAGMBDjKdDzG2/ZESkqruaqP6bIQENQ7SXsnI5CGx3Ibs+dmK56owtu4jrQyDV0Et 9dxpXQdRl7o1bBqONZErdKLgBCcTZX3f2awONXx+VZ7gXMG/MbyuqnH3bl3bm7UONRad zlkw== X-Forwarded-Encrypted: i=1; AKwUvBysCufj4YZ2OrYyifLIOsQ5LzIFOZeqw3ui2hikHoNKN32/ipTXpmXvizeG+kAdJScI1FKaTxNprkc8CPY=@vger.kernel.org X-Gm-Message-State: AFuF++l9tGRgPiZkLrWlNgSevjLtXDGENNdcArF5lPMxuXNfFFGggqtw PYjLIP1XG0K5ksSEOP4KV53N6DkT+1GqxHIVPiclCi3M2RCDpcoCRy/EzyLmW6pgQHo= X-Gm-Gg: AYBFou0IBlDN8GvkssisWJStXvyeE0P+x/x+LxkbdcBOI4OuLn3ika1hZ3N3vyh7KKx am8SF3/LGBL/yGCZCG2yRBrR9L6JtLc6oggL/blrvHVgLyobiCUQAXnJwuLvXBrS4J4+e0DRWLA qP3ORvsDxT3VHU+MLkMuFenKpYW0GHAfQXL5K9AItMPmoPpor0nnGFsV5tAqQDtaurUomgf/0E0 uJTVA6VoIVWh4T5Yf5GqQ2Z75FzfN3jedU61qBEVATonUuFJRYgLOoJp6iteVrL3UungQ31rsNM fZ3oO2q1V6U2h5dNpQ1MhsQkhGFZs4/1UkQBXSoAGQJJADaFFLsD48gPVpITEveWaAN+VScvOYj QSl4f9Nhxf1GOjAx+t1opAhFTklseDBk1I4JVBjCQlNHmIApdZcZJo2OP+0FZhkN2sJ7SakeWRw f9fif2vrkDW/q2wbr07ZWi2L4e9A3IKb1P84kOfWpgI+jtYUyWFmfDIqwgpblCH5T13yLSjRqde /i/0vdt2w== X-Received: by 2002:a05:620a:a48e:b0:939:7144:485d with SMTP id af79cd13be357-9398048a654mr2455504885a.38.1788911121049; Tue, 08 Sep 2026 16:45:21 -0700 (PDT) Received: from elster.cvl.swallow.glass ([2606:8e80:692f:3320:980c:c29f:b4b9:c06a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-939aff54ae0sm551872585a.8.2026.09.08.16.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 16:45:20 -0700 (PDT) From: Taylor Bates Date: Tue, 08 Sep 2026 19:45:10 -0400 Subject: [PATCH net-next 4/4] tools: ynl: fix uapi generation for anonymous enums with documented entries Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-ynl-robustness-v1-4-f255214c0f30@gmail.com> References: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> In-Reply-To: <20260908-ynl-robustness-v1-0-f255214c0f30@gmail.com> To: Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Jiri Pirko , Stanislav Fomichev Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Taylor Bates X-Mailer: b4 0.15.2 In pyynl's current render_uapi() implementation there exists a check that is intended to ensure that definitions of type "enum" or "flags" have a doc entry before calling write_doc_line(). However, this check still passes for anonymous enums since enum.has_doc() still evaluates as true, so they still take the kdoc code path. As a result, this path attempts to hang the entry docs off of enum.enum_name (which is of type None), raising a TypeError. Both the ovs_datapath.yaml and ovs_flow.yaml specs will fail to generate uapi headers in today's tree: $ ynl_gen_c.py --spec Documentation/netlink/specs/ovs_datapath.yaml \ --mode uapi --header Traceback (most recent call last): File "tools/net/ynl/pyynl/ynl_gen_c.py", line 3780, in main() ~~~~^^ File "tools/net/ynl/pyynl/ynl_gen_c.py", line 3511, in main render_uapi(parsed, cw) ~~~~~~~~~~~^^^^^^^^^^^^ File "tools/net/ynl/pyynl/ynl_gen_c.py", line 3255, in render_uapi cw.write_doc_line(enum.enum_name + doc) ~~~~~~~~~~~~~~~^~~~~ TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' The fix implemented by this patch instead generates a plain comment in this scenario as there is no kdoc identifier to hang the documentation off of. Fixes: 690e50dd69ee ("tools: ynl-gen: de-kdocify enums with no doc for entr= ies") Signed-off-by: Taylor Bates --- tools/net/ynl/pyynl/ynl_gen_c.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen= _c.py index 1c422141d2d7..66a6dbe07125 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -3247,15 +3247,17 @@ def render_uapi(family, cw): continue =20 if enum.has_doc(): - if enum.has_entry_doc(): + if enum.has_entry_doc() and enum.enum_name: cw.p('/**') doc =3D '' if 'doc' in enum: doc =3D ' - ' + enum['doc'] cw.write_doc_line(enum.enum_name + doc) else: + # Render a plain comment, no kdoc identifier available cw.p('/*') - cw.write_doc_line(enum['doc'], indent=3DFalse) + if 'doc' in enum: + cw.write_doc_line(enum['doc'], indent=3DFalse) for entry in enum.entries.values(): if entry.has_doc(): doc =3D '@' + entry.c_name + ': ' + entry['doc'] --=20 2.55.0