From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796055764; b=uHYkGjCiwjUpFjW6UqA8+3sQ92JfA8oX7L4taBm2BygQE1XsVMqZVupiLK5eTWfnnWss vquSDeFEdy14PnZaAWOkfJbj7qODJ+8xc0Esx3sRpYCdrWVznucrsLEp5QartFXq3qqUR IbdiQ8lE7uRfGeN10qvuxXrz/I/HNU7evWXjzhFnuMsADDNpeMVl5R5wNGv+soRFK2zkm Ou0Jq71J/PPmh4O98B7qJPuhmEuQCgLIf0J6pu6SrET7MNdNyM3RjgjXUDsYRm2yfa2Fv TSiikWXN3YcvZDb+Zerp4ZxK3uFUjCl9lgLGVHYsAw4PT0zw9AHusI6/H06VuHLjomg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796055764; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=UOGJeZwqmk6lD0aQQKYVPqm4cZU5j3SWpoPv/C734MQ=; b=qO2IRw7zU+2IuIj3wVdZG9g32Tpu0ewztYcvEDmTLdqCiN5OeXNM2jNkuHZQEQHAqL7v Jo+YYFwNUdjr58ZvR2MSQUvx3NVVDZZ4HVmSYLzDIkk7auZinaE/WmUNiVNvscAVwOlgU 11uy5ejqWX+WdYMjxQ+PvFDijHU1lRdkNu3eID5wwVuqdg/4XGatF9sfNdlHbvCOz62Ib tN+uX6yJgqGAYq3oIH2+SWKnUSFAVaYgvTGtMNM7oE5nJ2uHiNHH/fCSM6avyITsN7or+ 74whQEeQ6SVR8r3PnB1igxiWjPm/VAoIXBTk7xFBxYmJZyTM8CZDI3G1wbetjXg4/Og== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass header.d=queasysnail.net header.i=@queasysnail.net header.a=rsa-sha256 header.s=fm1 header.b=R4aGecmZ; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=2U3t7Lc3; arc=none smtp.remote-ip=202.12.124.158 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2168C606A31C for ; Mon, 30 Nov 2026 16:22:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2168C606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=queasysnail.net header.i=@queasysnail.net header.a=rsa-sha256 header.s=fm1 header.b=R4aGecmZ; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=2U3t7Lc3 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 759297A0070 for ; Mon, 30 Nov 2026 11:22:43 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 30 Nov 2026 11:22:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1796055763; x= 1796142163; bh=UOGJeZwqmk6lD0aQQKYVPqm4cZU5j3SWpoPv/C734MQ=; b=R 4aGecmZ9bC4ZrjUAaTVtjbzihG06ueKKg28fspPkPdyMvH8u/HXCeZUDlK1d/eK2 tPJ3cZtYNj2yZxmCyzUnd/l+BgDYKL6swUupCwFv0wRGpRrTX8cZanxQ+YvxU2kF Zi8LJqwoKyWpIFZ1UU3vKCdh6pbVcKoXvXIysIxG0vo/KAN38SyynT1+6P5jWwIM 9AD8DnBxNw3FHGOYsvLfV/LLP07xfn3C4SNc+7pzeWnUknDTR8j18XgvzqCIucDL T829orueOrivNRwe0NnbZ69uaPRjgSNSfUCVGs51OGgB8t+puOzYBUkGqrS5ap0j O9wn/gZJt+xXFN+I8oAsQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796055763; x=1796142163; bh=UOGJeZwqmk6lD0aQQKYVPqm4cZU5j3SWpoP v/C734MQ=; b=2U3t7Lc3AyZcD5j7idD+PsWRgUPhd3sUPGZqreUyjiy3GZ9UWO9 055XUn5qE7+cPjzMVevrpy9zIeyeYvPHKQcg4MKZyh89/kwe7ORlszMO+kqnyKOX XBdaUhocibEGzDkzbiDFeOuCugovXCCMFFq+2TyP+4B9PfLGL8saHxbEPtNw/VGJ O4V+k21VQnJoS5HIVpO6LYvhH+QgsPNt66EubNQUUW6P1aJDkTbV6DaZiVoWKlFe W2umx7907re5BPEoL8NyjbveZCEn+IVR6Mofi+6vVMJ2wF10GpNfwvRmchenhE3R TVtTm1HfcNvX+hkrRcUBNOJMdLwP9sg1OZw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=queasysnail.net a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796055763; d=queasysnail.net; mf=PHNkQHF1ZWFzeXNuYWlsLm5ldD4=; rt=PG5ldGRldkB2Z2VyLmtlcm5lbC5vcmc+; s=fm1:rsa-sha256:QESwVngzhNoEthkdeaUaeh4D5YANifbyXx+ZFXcblXoP5Ua ZdknWjQgqe24aQi9x468t+1rVEaikk3vv9uVOSQcE4/Ij35BuVB+gPAw3HeOsQg2 Z9RTLANPoOo0uZwnwYaLQPJNofoqsNGXiFZ4bIxNIVCzs+5vJLiVacjgUhH8HGV4 rhl7zf0BGVpaG6iilbzMxgv3GJ+5nb0VM2cDrGPuDOyn8pnkWZivYMS32hShylLX 6/AP3VDJoZWKjKLyR4/5CJOhlJJk0FoqxzewfL9q2c2CMPFe4u67Nf+epRKZuYvp 88fJQNN13sJGjuGfKphuXmAW6znf8bvKu0+Ymgw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:UXX0rZ4pttXTwZMnbk65w+0Q4klYbLz2TRuXuCOggPk=:ssh3o+EYGpvCktSDqmZcgAprAbM9uYXAvSBejodke2c=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGENQC2VVsj+hIBISQNO2FL6wKXLiFkTJKBTO6rul+9WpPVD0kaGNyxKhF6Djfz4+ DryVM7+zm7vZKpSE8jVYbNqvsDh1N5OiCEQcGVry8/LOz4l1/HPY770EITWP34u2IbPC07 LyPym0nV+gQXQoOGwK6d4FCCmwOWbPB0bXRujJ20cyurkTcSpzR+UUlNZf/4/CiD1D41KI k3Wly/4h4489aX0Vdct6G5lSsrZbJlkCTVtb494+V9tO6s0Kf9Fo8l2pf8HzISYn4O0185 Ssb/ozYK2Fv+k97w4YikZVsQvt5gS+BO4v7IuxUckOu9ThyLa40/9KrygvEjLn92ZtkfPP f7/+EnF/P9kA9S5ipmTv3TtH4W6WYkKh0TE/SHUveTzTg0dJzMeZ4bCdKvG1uuata9g+/p L3GyoiD2ZsZ7XUYCvko34jGQTis+gwnDGSid+R/d7l562j9DKQOTM/3iSuNJvvJmI+Jl8I fiuoGymyraWIFLuVEz9pSRrhpyzff+MrOYZZKbe2wrWH8yAgovq4wnkctaMViZuQaZYHP1 ZSKHDeSxm43hsLKjgbSJayOsFtCQXMZhxgpaSl32xyTmFj7oNRDlZlzTRBeLr2gaV65x3f 7P6+faSheW7yL6yfw5zoCoNO66CzXE01vqthtl9WhSjWavP8xqu1RaGJ0x0w X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Nov 2026 11:22:42 -0500 (EST) Date: Mon, 30 Nov 2026 17:22:39 +0100 From: Sabrina Dubroca To: dickson.wu@certik.com Cc: netdev@vger.kernel.org, John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , Simon Horman Subject: Re: [PATCH net] tls: rx: fix skb extension reference leak Message-ID: References: <20261127-ktls-net-v1-1-a047fdb54612@certik.com> 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-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261127-ktls-net-v1-1-a047fdb54612@certik.com> (dropped security@ since this is public) 2026-11-27, 08:47:22 +0000, Dickson Wu via B4 Relay wrote: > From: Dickson Wu > > tls_strp_load_anchor_with_queue() reuses strp->anchor for every record > and calls skb_copy_header() to copy the header of the first queued skb > onto it. skb_copy_header() goes through __copy_skb_header(), which uses > __skb_ext_copy(): it takes a reference on the source skb's extensions > and overwrites the anchor's extension pointer without dropping the > reference the anchor already held. When the received skbs carry > extensions, for example TC_SKB_EXT set by tc or SKB_EXT_BRIDGE_NF set > by br_netfilter, every reload of the anchor leaks one skb_ext. Once we have https://lore.kernel.org/all/bd169df0-f88c-417b-91aa-c9b0f11a28b8@mid.andrii.net/ tls_strp will not receive skbs with any extensions (MPTCP and PSP combined with TLS should not be valid [1]), and it's the only case where we would still have extensions? [1] well, for now at least https://lore.kernel.org/all/cover.1782123118.git.tanggeliang@kylinos.cn/ but keeping the MPTCP extension that late after MPTCP doesn't make sense so MPTCP should also drop them before the skb reaches TLS. > skbuff_ext_cache is not charged to the memory cgroup, so the leaked > objects also escape memcg limits. > > Drop the anchor's extensions with skb_ext_reset() before copying the > new header. If we go with this, I think it would make more sense to do it as soon as we're done with the current record, instead of waiting until we start working on the new one. > diff --git a/net/tls/tls_strp.c b/net/tls/tls_strp.c > index 53d3256d0..8ad7f339d 100644 > --- a/net/tls/tls_strp.c > +++ b/net/tls/tls_strp.c > @@ -475,6 +475,7 @@ static void tls_strp_load_anchor_with_queue(struct tls_strparser *strp, int len) > > skb_shinfo(strp->anchor)->frag_list = first; > > + skb_ext_reset(strp->anchor); > skb_copy_header(strp->anchor, first); And probably a DEBUG_NET_WARN_ON_ONCE(skb->active_extensions) in __copy_skb_header() to help avoid this mistake. -- Sabrina