Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795050473; b=yZcaDwzCR8Z7kurj7OUdp9yTDvJZTdDr7LyvLTCHMTqkZGbaoIQcHzW0aofvr4QCuonW QL2NmWBZXfzIj/PhTzGtHo5LmsIV2QGnhnEbWWhHUFEfAjVS+oWui3qQBO4XTH7c3S72L bAKESqUx0MNVy/WMnKjD3t2hoGfOpeGb73BQsTJiJUgCRTrLYSR68ouee5b5KmdtzAe2i jZO9Ztu5/6IGdsDGpnOmQ6HnZQkC8Gulmb4uwfDa8ZOHoSOXZmc1lOQ7F4ZfHWpi+q2us SpWdQYE+o04MHo5LmIO3aIB55LhLSH39rvNmpeqqSFs70hYuKL4jhQPeg23hR1JFs1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795050473; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=hDIJaVhnGgNRPCcTQE/LivsvWKkQxLWdWYyQ19UmRG0=; b=NSwtFz9Ej1J82zb5TBMwnyFZ302SSrwlCdx8LeS4LpJ7UtA3ZiGaErDurN1ZNRa3z30Z jZNvOQcwJg+32v83jJlGFk30/sLVyLp3rG6uT1/h6KZVpeACPzYJnAsULvi/zJAse3PYh FjspBlrwr1C3dvpxhN0i/IwjERPWhH9UE9hawfSQwd9Sv70PoEW238g8lEoVCMFbrqPF8 eXb9vbMl7xDnylyJ9o7HFot1xjBfUt2AX/PlV7wNzok81ve//sbtqOrqoPnierl3ud7fY 2h0/a+PHQu3txM7Y7FYwfYT6LZtAjWctrmiILs42VD8ZTpcMvdP889+RYMrPkFAPhEg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="v/cI7Xdu"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A0B7606A32A; Thu, 19 Nov 2026 01:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=v/cI7Xdu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EF1B1F000C6; Thu, 19 Nov 2026 01:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795050473; bh=hDIJaVhnGgNRPCcTQE/LivsvWKkQxLWdWYyQ19UmRG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v/cI7Xdudp7sCC2BceLX0FPOTv37Dw52jiiNV0a1oLt99aWE1nMBoptEA5bTnfyhg XzJ45kT1L8FzBWIjqWMoYarYPzQxCihPUtFl8p7qQxlXdJplRU4Lt9SXOQ0WA8p3xN /hkbXDJ9SCDhHoMqBLJyL2ibk9G7hBkBb4F1IHsw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dudu Lu , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 2721/2857] net/sched: etf: initialise the sock_exterr_skb before filling it Date: Wed, 18 Nov 2026 16:02:35 +0100 Message-ID: <20261118150339.586468888@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dudu Lu [ Upstream commit 7076f684d5132e6a6145e1da2fa74771ecd052e5 ] report_sock_error() clones the transmitted skb, overlays a struct sock_exterr_skb on its control block and fills in the seven struct sock_extended_err fields, but never clears addr_offset and port. skb_clone() copies cb[] verbatim, so the errqueue entry carries the TX skb's stale control block to the receive side, and the ipv4 error-queue reader trusts those bytes: net/ipv4/ip_sockglue.c:556 sin->sin_addr.s_addr = *(__be32 *)(skb_network_header(skb) + serr->addr_offset); sin->sin_port = serr->port; The gate that is supposed to guard that read only asks whether an address was requested at all: net/ipv4/ip_sockglue.c:484 return serr->ee.ee_origin == SO_EE_ORIGIN_ICMP || serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL || serr->port; SO_EE_ORIGIN_TXTIME is neither ICMP nor LOCAL, so for sch_etf the gate is decided by serr->port alone -- by the stale byte pair. When it is non-zero the reader dereferences skb_network_header() + addr_offset with an arbitrary offset. On the TCP path cb[40..44) is not zero: the transmit path stored delivered_mstamp there (tcp_rate_skb_sent()), which is exactly where addr_offset/port sit in the arm64 struct layout. Reached with an unmodified 7.3-rc4 (arm64, KASAN, in-tree modules): a TCP socket enables TX-timestamp error reporting (SO_TXTIME with SOF_TXTIME_REPORT_ERRORS), a sch_etf qdisc drops the packet, and a recvmsg() reaches ip_recv_error(): BUG: KASAN: slab-out-of-bounds in ip_recv_error+0x970/0xa0c Read of size 4 at addr ffff0000158ffdd5 by task A-227-A227-1_S2/113 ip_recv_error+0x970/0xa0c inet_recv_error+0x94/0xdc tcp_recvmsg+0x378/0x408 ... The buggy address is located 149 bytes to the right of allocated 704-byte region Zero the whole overlay rather than the two fields individually: the errqueue entry is handed to the receive side as a self-contained record, which is what every other producer in the tree already does (sch_etf was the only error-queue producer that cleared neither field). This does not change what the in-tree selftest observes -- so_txtime.c reads only ee_origin/ee_errno/ee_code/ee_data/ee_info, never msg_name or sin_port. Fixes: 4b15c7075352 ("net/sched: Make etf report drops on error_queue") Signed-off-by: Dudu Lu Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261021155401.65997-1-phx0fer@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_etf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sched/sch_etf.c b/net/sched/sch_etf.c index 61d1f0e32cf35..025f15ae89151 100644 --- a/net/sched/sch_etf.c +++ b/net/sched/sch_etf.c @@ -147,6 +147,7 @@ static void report_sock_error(struct sk_buff *skb, u32 err, u8 code) return; serr = SKB_EXT_ERR(clone); + memset(serr, 0, sizeof(*serr)); serr->ee.ee_errno = err; serr->ee.ee_origin = SO_EE_ORIGIN_TXTIME; serr->ee.ee_type = 0; -- 2.53.0