From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795874918; b=sD4w56n2WbkcTnfEVqO/8guQc2uvQaj5JSiGDuKK3WUkumtB763kRj/DvSAQaqbMI/Ho Y78/AJhM4ujiLXt0FgxtG+I1AqmuENHF36kHOn2Hzm8KLo3JDu4grneeace8edVuBfWEU eFB+Q5si9BXGIjw6iFT3f3Xizq+o1YbfNqhkXE9yRvAnmhzgj+cj9227jnRrBoGtvVZ/N AaUQNvr6EXaQwqZy/t4IsJXGGNXP6IWRbiDWBYL3ku3IrZ0QytRA9P6rv/IzyyATraUHQ 2buErJPuom++NuFbQhx9ujhcGGUEAdd4Y4gZAY84NzqfOyuraQTX6PfQb925X1rWFdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795874918; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=y9d0KlkYkMPn1OGlex1T3FTiLNTnvIiCGzz3NKFSL5Q=; b=vRG5ryhkSe3UBs5UgLJPNnYAe/fvlc8EY6SGz8zmgSq+mtVc+MXKZUesl8avMSa1aChr Knqq+/mNsVSfx2KaxsN901X6ePUIlLa/7+gGX+3ZQcjo+NL5fWfy7htAT88LD1bzLodhq 7fX662W1BmPbJt3jlMGKaBLefX++9dTQhvCZ1QO2Shby7R3VnJ0eCvefnbw8RiAGk21Up JwqLmFX/qSuoji34uzgdSHMlGu8JEgSHtbReezxmBYYmDhCQ9cglYjqGYuztH89WWnu+T SlMnYaX0iEQ3FMh6xC7dpTvGBovH7mI8obZ7iGLp6VRbTu6wHA/lbwy0Ceo4mplnZeg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=stellman-greene.com; spf=none smtp.mailfrom=stellman-greene.com; dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=R2epY8c7; arc=none smtp.remote-ip=209.85.128.171 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4815606A31F for ; Sat, 28 Nov 2026 14:08:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4815606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=R2epY8c7 Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-8b4cd576f2aso64661757b3.0 for ; Sat, 28 Nov 2026 06:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stellman-greene-com.20260707.gappssmtp.com; s=20260707; t=1795874917; x=1796479717; darn=vger.kernel.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=y9d0KlkYkMPn1OGlex1T3FTiLNTnvIiCGzz3NKFSL5Q=; b=R2epY8c7zatZG/RtMQ7ExJRvH9+vyyA2Z0aczkdjCHPzOeymu4tbOi+XPZOUhBAsbf c1w3Pi29cXSWGFk0WlBMVw2OAyrtsGfIwQ2CjHCyRekc827nzxluaeXObjSBaYdP4Jx8 JhR3ixGFYw/8HUR/wVrYM/IjEgDHQrXSyvbsT+QCGgPoHJ8phpY5uGPxDvv8wzW5CUeA WEUSqfXv/1MteZTIKHC68tPLkeOcBR/60PA/OwFusgXNIEwQj+ZvGHx6Sob0o4b9EDIH 8V7yYnVL125LpR0aSzazpGOp3gO/9FRTmdc9V8w3sNPwLq7V319kUsKhTcLfNvMs0ZTQ DNDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795874917; x=1796479717; 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=y9d0KlkYkMPn1OGlex1T3FTiLNTnvIiCGzz3NKFSL5Q=; b=LQZKI+SqQrAf3kDjDNlr73UVlUJwvt9ba0DGIFrcmpQ7vabqSQoRh0kR9LlGz7IJV/ WBL2R6sIHBQ8rvfHoUCz/aqlMB/QeEDglCjZiicRNkTmXCaharP8B1tq3wNQ4n0TZiUL uZrdkTM6AiVtl0eqoccOxrAXmVgcwscBBM4/7DsMc5uLWGEAIppMY1HpOX8oBRSwZbs0 oWLvdJtUZezmqqF3abO2dUJjM8TX5aehSifRjfyuYmeZyykiiDzLbhCMuIj3I3EWoWLI 8yZ9plZM2P2llQn19BuqaJIu4icYm263Iiw+JLZY311Ce0kG+9ng2HfrvDBRrgEP8gTH vSGA== X-Forwarded-Encrypted: i=1; AL+hErGO3tqAy2I05eH3SS1lhpE6t4eGLNtvx5GmCI9CAYcNDLjKqVxGCVt2H0iEwekGb/rVsrG/kPI=@vger.kernel.org X-Gm-Message-State: APuU4Z+ImsExDg+LbD0wwSp07MMwB+mSBz7PNaO9WKimLY0lIDutuaST QpSgBbDGpyo+G0aIG9Jgjp2vVWnQvoBsbyFQX+x8w/p0EnugPvfcGEPUpatxBIyN2iY= X-Gm-Gg: AZFdTZfJ06oyxJ0tuC33XMgwcqd26NJmfa1puDQbjpe3MZ3KlAeQCVIMntfdNJTW/5D 2dBKvHS/YNtBvi52bGNc3Uxug0F5SQ65ojkwU7Li6KfivcvPX7kuL8gKft9Ve25JeOmg25Xj3cS 8JvYT2NQOf5yiYO/ik9GckPBLJHCTlkYY5HNyMNgdT/hfkQ552MinwtKCLEQZf/UfWnkGLxwB+h SFmslm2NB/RtwgjzkUBEPgCu1ZU+I3BKQRD0A5rom7FN8axXSvodckcXS2gisbx1O6tT6YHh3gl njw1DSvRMfraZwES5YQaORk1ngiaUqbzsnE4jj5M4z0xMGY6gIc2R+xvIEaRXHeB0Wt5pfxNzYO zadSGRMID7IXVre/agUmlYOmTvcP9OOKCfY4TW+sPIyf54+A11C5XCfNLDaGAtZibMQZPSJ5oYQ XvPpEO0pUOapSr3eUCCjmSSUsnJ9U4nE8fcKzfcsfINHU5IuZyoG0Djt1bdWpVCT4WU/desEqU4 UguvSyApi1V4Dv/jyMnyscfo2OdptVc1uMBxIaDmCNp6GedusMcYbSEOcJqyECHyq9JIR1I8sKY Pj4rC2DBl2U8CP3R2NdY/DWzsvc6Efxzuso14TdwkllL08oDUoCvRMxr3vTsNAILtr/RDSFCOW7 H852AB7Y3jLYSVivHaUQ81zU= X-Received: by 2002:a05:690c:e3d2:b0:873:5c0f:27c with SMTP id 00721157ae682-8b5204ad248mr121148297b3.38.1795874916722; Sat, 28 Nov 2026 06:08:36 -0800 (PST) Received: from Mac.mynetworksettings.com ([2600:4041:5c28:200:a4e3:fb15:aef5:60c7]) by smtp.gmail.com with ESMTPSA id af79cd13be357-949bb418241sm2050564885a.38.2026.11.28.06.08.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 28 Nov 2026 06:08:36 -0800 (PST) From: Andrew Stellman To: Jon Maloy , Tung Quang Nguyen Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH net] tipc: reject bundles too short for an inner header Date: Sat, 28 Nov 2026 09:08:30 -0500 Message-ID: <20261128140830.58925-1-bugs@stellman-greene.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andrew Stellman tipc_msg_extract() checks *pos against msg_data_sz(hdr) - MIN_H_SIZE. msg_data_sz() is unsigned, so for a header-only MSG_BUNDLER, which tipc_msg_validate() accepts, the subtraction wraps and the check passes. The following msg_size(ihdr) then reads four bytes past the end of the bundle. Check that the data can hold an inner header before subtracting. Tested on mainline (7cd8495c0f16) in arm64 QEMU with KASAN. A test-only debugfs hook, not part of this patch, built a header-only bundle in the kernel, passed it to tipc_msg_validate() and tipc_msg_extract(), and poisoned 8 bytes of tailroom after it as a redzone so KASAN would flag the read. No live TIPC link was used, and the bundle didn't come from a peer. Without this patch KASAN reported a 4 byte read in tipc_msg_extract() in both of two runs; with it, none in one run. A bundle holding one valid 24 byte message was extracted the same way in all three runs. No selftests were run. Fixes: ef9be755697f ("tipc: eliminate buffer cloning in function tipc_msg_extract()") Signed-off-by: Andrew Stellman --- The issue was found by Claude Opus 5.5 running Quality Playbook, an LLM-driven code review tool: https://github.com/andrewstellman/quality-playbook The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with Claude Opus 5.5, and both were reviewed by me. A reproducer is available on request. net/tipc/msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 39dfd33c8eecc8..657c0709a0f7a1 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -600,7 +600,8 @@ bool tipc_msg_extract(struct sk_buff *skb, struct sk_buff **iskb, int *pos) goto none; hdr = buf_msg(skb); - if (unlikely(*pos > (msg_data_sz(hdr) - MIN_H_SIZE))) + if (unlikely(msg_data_sz(hdr) < MIN_H_SIZE || + *pos > (msg_data_sz(hdr) - MIN_H_SIZE))) goto none; ihdr = (struct tipc_msg *)(msg_data(hdr) + *pos);