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=1795042391; b=WfN4pH3r2eI4vYgLg50CxwfkM4JfIxvkp2fz0juyrSMpVmeO+zPDnaBCv+CNBiBWRHcw GuPMd9+tolMuvGE3NZzbAnSQjQgZaKHVvNQFY68/cIh0E4jgpjQVBcKy6LINhUyeOHLyp /Dk9RBqDX88w1WiacwWN6hPg9lL8spB3us/6ZqH55IwEWwHJP1ZzeBx+Aub+CvOXyqaMV wMIPyyJ0yX6T1R+udJM+XGJ/7h1d3A/1p9c0oKoEYk1a74ptF+5DNqTO5qsfZYZzoknEY fLPWAHyv4jRaSl2S64SIbPnzeeR2oMgqv8J7KbM/bC/oZsL+t072rrQ0Y/gfOcjCVDg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795042391; 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=OmCtdH4G66mWYmXfruDS5nIi3uyw444WDqdLseC02qc=; b=V3AarEXJaA/5acgGI9/QpgbbywXSs/grqsjf6EcCDm1McLCEUDuRVk9LgaLFZm82ee8N rCrIaYus68mKnjc7WlS2+8AR6KUytJCqno46dqf1yffmqq8Sp8+vM27TyeeTUiAlgkAD3 0DyWNv9nK+I+GSCZFwaTk0PTMp+1Pk136UPcBbZUn4bE4WUcam5x5g9c0rf3Hq4Pb0gJZ 8/zwRHTIXR7ezyANxNAGc1KEqAX8MG4Vq5wEMof95rGG9uO5xrceZHJ9vE5dJlgVJCNci sXwkKNqimH8XiV4wNO0d9MPFYWTgw7JSLefn6LpNmdqr4baz7UGMmhjiDKu6lLdGtow== 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=NsS9jwsZ; 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 26169606A325; Wed, 18 Nov 2026 22:53:10 +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=NsS9jwsZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26A401F000C5; Wed, 18 Nov 2026 22:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795042390; bh=OmCtdH4G66mWYmXfruDS5nIi3uyw444WDqdLseC02qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NsS9jwsZvunQZKvGFJMJkjd91yoMICsmfdCccPLt3icwPwM2T5V/LduB+cQqNsk0h IAVChDLcl4lLeIa84JyDBcbMdblmMfGAGrHHiv4xGSQuJqonFNteHIg5u4XBvPsUeo 3Rsenb0zfYqdN1XZxz2ibcUofBf0RLN/Xw6n8plk= 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.6 3152/3318] net/sched: etf: initialise the sock_exterr_skb before filling it Date: Wed, 18 Nov 2026 16:02:54 +0100 Message-ID: <20261118150454.420839160@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@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.6-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