From patchwork Thu Dec 3 00:24:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasanth R X-Patchwork-Id: 107048 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.3169.1796257491879069870 for ; Wed, 02 Dec 2026 16:24:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=CLUHqs4d; spf=pass (domain: gmail.com, ip: 74.125.82.179, mailfrom: ragaprasanth@gmail.com) Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-33bf40b0c8bso10454616eec.0 for ; Wed, 02 Dec 2026 16:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796257491; x=1796862291; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=lt9tN/2prpKLLh5qbbYFcq0rN1Z9jJx0D0gA8K5rUzU=; b=CLUHqs4dUbfLIrwSDq2loH+SgNTTagUx1CZGIkzVnizXEYz19xPkkGH8ApLDdCdydB MdNEQXRw2di2r2XU1mdWM3EDJp61rK9iBv+dfrK9lM+UMyS12OOufpD1svxmY+X0kr1Y mFGBps5pOLE7ov/RNSa5aImdvqICV1EyyS5iaHy6B8TrEGT5ywNwrMdFYL/7WEBBKDVq LvyTwHTFjoJGr4xtuzu/J1MsYdXD2gitDHwm8AWKFuA7XoIVuSwZnajbFNQ1W3TBtvOa 7LABi1OtGZ3caQxcDvGkjWl1rTSbPO+DFDDi6hRLTD1kHnUcMJSWSCt4jP7YKk35qVEy h7/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796257491; x=1796862291; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=lt9tN/2prpKLLh5qbbYFcq0rN1Z9jJx0D0gA8K5rUzU=; b=jFnfzo3Izm4C6Bsmnrc3AxZas+DgFls6iA+6sOtG+BfGe9WuPQQ5jsAI1RzH/04e4u BZEkdm+D1HTI9RxqMWvYPp7/tYXhdUFQCo/CaZ5JcdXgxLV2R34QqIYPZFzv+D0paYtl 00jWJIPvUkS4FY2pV3tNfodg7sP5TNg0KQlvuaAvrIG9EcOdRirigSoNWwTw1u7uvTbr oHtdP/jq6DTBCVSNQbltAYKvC7U79K2cdy42qmRoGFDh8oh+E5Pc+jJFOkayS9ACLJoC tOR1A5s+g91R2Gy6T+20y0UGGMfRYEeKYf0vzmR5RhEIAnCpuRuHZSdzx0aqjq4v17iT wVQA== X-Gm-Message-State: APuU4Z8nDX44iTtbZYZ4UHUsx2CO4vymMoy9XTTwOR293N1vbyIvMU39 0eI707zsc68QZAuEVArwO10cJ0j70/4l9lrpQsZ+ZvsENe0NOdY/U15K6sR729jo X-Gm-Gg: AZFdTZftq0m+MHnr/t/QNMGfGqYuPhjnXLEPSPT9nQxSyl9TIZspYhgtmb0YNvd2jVy vnsaEtG5uY5HlA0WY/FHTSKT9wtL1rh6hwpSIo6yvvzt71E9tY1/MGLIT0fjEJ2shulUcEuAK7D 6gLtv5e18vGkmjYjnElrEgX07TEevo/45h7Co6HCUabjF4GkhRyVL2e2sRRYNzEg0ce7qm867pW GjffdfJvZ4oi7LyuG04aYHATrkQuhPKgDnLQ3TcgV3HB7zPvu7LWdw83Y7E3JO9gnTSMRNjkjFN 0OMlEoNalkJHK/qCXttPcuCiXi5p42mTyFrYUUWHSNp4RZFT5bokU20i/1PLiAEU3pY4ieLH589 CXAy4qhy7LygQXDeVatlzCj3p+tgOBV+dHOQynoxLUqi98+tOsKdRXlEp6UinyjQTo0GLWO027/ DRDDiwmVTFkRPtktDIEdOD78kZjGN/2r8VDnfK3qZL04jZOXO0IGbITV+v67u6r0TM5zsnkcZZl 9XB/YiRbQsb/GeN1jvISFCgYluYkxq0kI/jTJucpxkDZ+ctn6YO56j+J6dYNkQpJgw+JSV9ltac p0Sbi4kCbqR4QbvwvXZXyvRTUBRgc/QViA9oDK4yqaW5/kkGoW70DVSnfcW3O+kf X-Received: by 2002:a05:7300:f68e:b0:369:f291:49da with SMTP id 5a478bee46e88-38571814b1dmr41365551eec.40.1796257491068; Wed, 02 Dec 2026 16:24:51 -0800 (PST) Return-Path: Received: from prasanth.alps.lineo.co.jp (vpn1.lineo.co.jp. [203.141.200.204]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-385677c0c1dsm136920951eec.21.2026.12.02.16.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 16:24:50 -0800 (PST) From: Prasanth R To: openembedded-core@lists.openembedded.org Cc: Paul Barker , Fabio Estevam , Prasanth R Subject: [PATCH v2] u-boot: fix CVE-2026-29007 and CVE-2026-29008 Date: Thu, 3 Dec 2026 09:24:38 +0900 Message-Id: <20261203002438.3785425-1-ragaprasanth@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 03 Dec 2026 00:24:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251865 Backport my fixes for the legacy TCP stack from U-Boot main. Apply them in u-boot-common.inc, so u-boot and u-boot-tools build the same source. AI-Generated: Uses Claude Signed-off-by: Prasanth R --- v2: apply the patches in u-boot-common.inc and drop the u-boot-tools CVE_STATUS patch, as Paul suggested. .../u-boot/files/CVE-2026-29007.patch | 94 +++++++++++++++++++ .../u-boot/files/CVE-2026-29007_29008.patch | 66 +++++++++++++ meta/recipes-bsp/u-boot/u-boot-common.inc | 2 + 3 files changed, 162 insertions(+) create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2026-29007.patch create mode 100644 meta/recipes-bsp/u-boot/files/CVE-2026-29007_29008.patch diff --git a/meta/recipes-bsp/u-boot/files/CVE-2026-29007.patch b/meta/recipes-bsp/u-boot/files/CVE-2026-29007.patch new file mode 100644 index 0000000000..b58c300dd8 --- /dev/null +++ b/meta/recipes-bsp/u-boot/files/CVE-2026-29007.patch @@ -0,0 +1,94 @@ +From cf248526dbd1da6622b58483c307cb837fb76165 Mon Sep 17 00:00:00 2001 +From: Prasanth R +Date: Tue, 17 Nov 2026 17:56:45 +0900 +Subject: [PATCH] net: tcp: check option lengths in tcp_parse_options() + +tcp_parse_options() reads the length byte of an option without checking +that it is inside the option area, and reads the window scale and +timestamp values without checking the option length. A truncated or +malformed option makes it read past the end of the options. + +Check that each option and its length byte fit in the remaining +options, and only use the window scale and timestamp when the option +has the expected size. Limit the window scale to 14 as RFC 7323 says, +so the window shift in tcp_rx_state_machine() stays defined. + +Fixes: a3bf193bf4ea ("net: Add TCP protocol") + +CVE: CVE-2026-29007 +Upstream-Status: Backport [https://git.u-boot-project.org/u-boot/u-boot/-/commit/cf248526dbd1da6622b58483c307cb837fb76165] + +Signed-off-by: Prasanth R +--- + net/tcp.c | 42 +++++++++++++++++++++++------------------- + 1 file changed, 23 insertions(+), 19 deletions(-) + +diff --git a/net/tcp.c b/net/tcp.c +index 737a079ec5..cde3319bc4 100644 +--- a/net/tcp.c ++++ b/net/tcp.c +@@ -776,38 +776,42 @@ void tcp_parse_options(struct tcp_stream *tcp, uchar *o, int o_len) + { + struct tcp_t_opt *tsopt; + struct tcp_scale *wsopt; ++ uchar *end = o + o_len; + uchar *p = o; ++ u8 len; + +- /* +- * NOPs are options with a zero length, and thus are special. +- * All other options have length fields. +- */ +- for (p = o; p < (o + o_len); ) { +- if (!p[1]) +- return; /* Finished processing options */ ++ while (p < end) { ++ if (p[0] == TCP_O_END) ++ return; ++ if (p[0] == TCP_1_NOP) { ++ p++; ++ continue; ++ } + +- switch (p[0]) { +- case TCP_O_END: ++ /* All other options have a length byte covering kind and len */ ++ if (end - p < TCP_OPT_LEN_2) + return; +- case TCP_O_MSS: +- case TCP_P_SACK: +- case TCP_V_SACK: +- break; ++ len = p[1]; ++ if (len < TCP_OPT_LEN_2 || len > end - p) ++ return; ++ ++ switch (p[0]) { + case TCP_O_SCL: ++ if (len != TCP_OPT_LEN_3) ++ break; + wsopt = (struct tcp_scale *)p; +- tcp->rmt_win_scale = wsopt->scale; ++ /* RFC 7323: a shift count above 14 is treated as 14 */ ++ tcp->rmt_win_scale = wsopt->scale > 14 ? 14 : wsopt->scale; + break; + case TCP_O_TS: ++ if (len != TCP_OPT_LEN_A) ++ break; + tsopt = (struct tcp_t_opt *)p; + tcp->rmt_timestamp = tsopt->t_snd; + break; + } + +- /* Process optional NOPs */ +- if (p[0] == TCP_1_NOP) +- p++; +- else +- p += p[1]; ++ p += len; + } + } + +-- +2.43.0 + diff --git a/meta/recipes-bsp/u-boot/files/CVE-2026-29007_29008.patch b/meta/recipes-bsp/u-boot/files/CVE-2026-29007_29008.patch new file mode 100644 index 0000000000..90ad049c27 --- /dev/null +++ b/meta/recipes-bsp/u-boot/files/CVE-2026-29007_29008.patch @@ -0,0 +1,66 @@ +From a0e2935a4bdeb982e48a8f13fa257bbfc6d8e657 Mon Sep 17 00:00:00 2001 +From: Prasanth R +Date: Tue, 17 Nov 2026 17:56:44 +0900 +Subject: [PATCH] net: tcp: drop segments with an invalid data offset + +rxhand_tcp_f() trusts the data offset of a received segment. +tcp_rx_state_machine() then passes tcp_hdr_len - TCP_HDR_SIZE bytes of +options to tcp_parse_options() and computes payload_len as +tcp_len - tcp_hdr_len, without checking that the header fits in the +segment. + +A data offset larger than the segment makes tcp_parse_options() read +past the end of the packet (CVE-2026-29007) and makes payload_len +negative. In TCP_SYN_SENT the negative length reaches +tcp_rx_user_data() and the receive handler, where it wraps to a huge +memcpy() size (CVE-2026-29008). + +Drop segments that are shorter than a TCP header, or whose data offset +is below the header size or beyond the segment. Also ignore the +reserved bits when reading the data offset. + +Fixes: a3bf193bf4ea ("net: Add TCP protocol") + +CVE: CVE-2026-29007 CVE-2026-29008 +Upstream-Status: Backport [https://git.u-boot-project.org/u-boot/u-boot/-/commit/a0e2935a4bdeb982e48a8f13fa257bbfc6d8e657] + +Signed-off-by: Prasanth R +--- + net/tcp.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/net/tcp.c b/net/tcp.c +index 8740150365..737a079ec5 100644 +--- a/net/tcp.c ++++ b/net/tcp.c +@@ -58,7 +58,7 @@ static int (*tcp_stream_on_create)(struct tcp_stream *tcp); + #define ROUND_TCPHDR_LEN(x) (LEN_B_TO_DW((x) + 3)) + #define ROUND_TCPHDR_BYTES(x) (((x) + 3) & ~3) + #define SHIFT_TO_TCPHDRLEN_FIELD(x) ((x) << 4) +-#define GET_TCP_HDR_LEN_IN_BYTES(x) ((x) >> 2) ++#define GET_TCP_HDR_LEN_IN_BYTES(x) (((x) & 0xf0) >> 2) + + #define RANDOM_PORT_START 1024 + #define RANDOM_PORT_RANGE 0x4000 +@@ -1162,6 +1162,18 @@ void rxhand_tcp_f(union tcp_build_pkt *b, unsigned int pkt_len) + u16 tcp_rx_xsum = b->ip.hdr.ip_sum; + struct tcp_stream *tcp; + struct in_addr src; ++ int tcp_hdr_len; ++ ++ /* ++ * The data offset must cover the fixed TCP header and must not point ++ * past the end of the segment. Otherwise the options parser reads ++ * beyond the packet and the payload length becomes negative. ++ */ ++ if (tcp_len < (int)TCP_HDR_SIZE) ++ return; ++ tcp_hdr_len = GET_TCP_HDR_LEN_IN_BYTES(b->ip.hdr.tcp_hlen); ++ if (tcp_hdr_len < (int)TCP_HDR_SIZE || tcp_hdr_len > tcp_len) ++ return; + + /* Verify IP header */ + debug_cond(DEBUG_DEV_PKT, +-- +2.43.0 + diff --git a/meta/recipes-bsp/u-boot/u-boot-common.inc b/meta/recipes-bsp/u-boot/u-boot-common.inc index 74aa612508..ddc715f536 100644 --- a/meta/recipes-bsp/u-boot/u-boot-common.inc +++ b/meta/recipes-bsp/u-boot/u-boot-common.inc @@ -18,6 +18,8 @@ SRCREV = "5508406582f6f7120dce0c4b3059819a41788db2" SRC_URI = "git://git.u-boot-project.org/u-boot/u-boot.git;protocol=https;branch=main;tag=v${PV} \ file://0001-Add-support-for-OpenSSL-Provider-API.patch \ + file://CVE-2026-29007_29008.patch \ + file://CVE-2026-29007.patch \ " B = "${WORKDIR}/build"