🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26135

Re: [PATCH bpf] bpf: Check and set TCP congestion control from the same name

#26135
From: "Alexei Starovoitov"
Date: Thu, 03 Dec 2026 03:58
30 lines
11688 bytes
On Sun, Nov 29, 2026 at 10:57 PM Paul Moses <p@1g4.org> wrote:
> BUG: KASAN: invalid-free in tcp_cdg_release+0x38/0xac

A route with "congctl cdg" gives the same splat without a race.
tcp_ca_dst_init() replaces icsk_ca_ops and keeps the state of the old cc:

		bpf_module_put(icsk->icsk_ca_ops, icsk->icsk_ca_ops->owner);
		icsk->icsk_ca_dst_locked = tcp_ca_dst_locked(dst);
		WRITE_ONCE(icsk->icsk_ca_ops, ca);

icsk_ca_priv[2] is ca->gradients in cdg.
With TCP_FASTOPEN_CONNECT and TCP_FASTOPEN_NO_COOKIE:

  connect()              TCP_SYN_SENT, tcp_connect() is deferred
  setsockopt("bpf_cc")   ->init() sets icsk_ca_priv[2] = X
                         icsk_ca_initialized = 1
  write()                tcp_ca_dst_init() sets icsk_ca_ops = cdg
  SYN-ACK                tcp_init_transfer() skips tcp_cdg_init()
  close()                tcp_cdg_release() does kfree(X)

tcp_ca_openreq_child() doesn't clear icsk_ca_priv either.
bpf_cc->set_state() can write it in tcp_disconnect() before listen().
The child gets a copy and tcp_cdg_init() doesn't reset ca->tail.
With tail == 255 tcp_cdg_grad() writes past the end of ca->gradients.

Both should reset icsk_ca_priv and icsk_ca_initialized like
tcp_reinit_congestion_control() does.

pw-bot: cr
Technical Details
Message-ID: <DNASOXUN4KAE.1IJL3LGF4E1DO@gmail.com>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376275-linux-kernel-netdev=dewy.ru
References: <20261130065659.621451-1-p@1g4.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376275-linux-kernel-netdev=dewy.ru
From: alexei.starovoitov@gmail.com ("Alexei Starovoitov")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf] bpf: Check and set TCP congestion control from the same name
Date: Thu, 03 Dec 2026 03:58:59 +0000
Organization: Usenet Network
Message-ID: <DNASOXUN4KAE.1IJL3LGF4E1DO@gmail.com>
References: <20261130065659.621451-1-p@1g4.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="2136360"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mH2UjFUCwPEVdcSTDXhNWWL8adQ= sha256:65CsAV93OrhtalpORGG1LpLCK/HBi3qVoy6ivF2QCOU= sha1:FO1mGqPaS4N5Oknu8NJFB3vUiEY= sha256:IfzjpN1l0QxE6lUl9Z3f52AOjIcwdIVqagTSuDy2Y8A=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 716DA11780F; Thu,  3 Dec 2026 06:59:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bJPS2mMrctat; Thu,  3 Dec 2026 06:59:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376275-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id CFE981174ED; Thu,  3 Dec 2026 06:59:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9DD6F292ED; Thu,  3 Dec 2026 03:59:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796270342; b=qt1XAR/XIZsBtDI/DqRJlP35ggjTmAm3RfLZuE3aJ4NzrNmJH8h3lPx1Wj40bVkMG7cj 86+rDgbpqp+lax2wUuOSBROb+ug72+Jdtk9Eo3ruH0/1NWHf1SQc9JjjoDtjBQTJ4awyY 8VL0ove7QB7l7x/IJn3r1zQUGHmu48IQXzEvchpkl4cBjqXbztu7BThbPYHtZF2GKbRaz 9rmoLIGG5ktKf0X+6kYb/yXSmhK/BY1W5aEibIPa7HTXHgZJShaQg5donWfizuYDWZaJJ b4mLqSvqXwlGwJw6tOAmfEhqu6Xx47U8IKYH3KrdOG38Uh3kJXeSS4Q/nd5rE+FbBkw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796270342; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received: Received:Content-Type:Date:Message-Id:Cc:Subject:From:To:In-Reply-To: References:Content-Transfer-Encoding:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version; bh=Pkg2LdJv7FcWs6MWbGopLBQkXtHcxc+SQ+DbC2K76WM=; b=WcPRzGbDDImcF5MvnBSYjFzHzG8QRPW/6b2D+tYFwUHuzvitArMbqqwwX0Uazo7MNbT4 sXOWUhIFaKkqnpGzXR5G67MAwGku5K1dADpfNNJkk6pseSGgsqZot+9yM38FshGsUT5NA ySBj4dr5K+PBONXsJoMDG6SzgVXKJTd714kCceNzjTMv0bjTAbsXIsvyk14CKdgWn3oio 4LI5+4UHLpQHpwLQFgd129kEjbGv8KeDmKepJ+lEEXVs8P5HwENKOd1h2yfgUYS4fhYLl 9shFQJ2kw+kaHNgOLl2v/i+MD/7h7KOAqCuB/lAddSZnQJ074akEGbKHBarxJdgD7yA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XzZ9uLQa; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7446D606A33B; Thu,  3 Dec 2026 03:59:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XzZ9uLQa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796270341; b=KBVxXtm36SEs6JY3HTZQd7qsL591fHnsg/VccDnogZ6FDqbGmAqBZcEof5UjaJ4q86zC WMf37zyNyGwc82og60q5cJW0NvjLoseyphgFTAGHQ8wmpyVRyp5DebCVd+przMYTjutdH tMsmOoOsNFbWSt1Wh8hyJh/tRVxlDIyqufLd396Ow0+mblDUA61lnENSCAMGKmW7ZuZBp lnVB7vihKGEWL84vPRIG6rUlaw+C4pq/uDucibkwP0EB/3kD0pJohAeVAIwZp4/Dn9iuM sJhIHMS6BFbON+QEOka4H4rwrg7fTU/Kzqqq4G8VuI0stFMO3PmLR21/SLW283r9Hkw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796270341; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Content-Type:Date: Message-Id:Cc:Subject:From:To:In-Reply-To:References: Content-Transfer-Encoding:MIME-Version; bh=Pkg2LdJv7FcWs6MWbGopLBQkXtHcxc+SQ+DbC2K76WM=; b=z2Z/nU3eFHHEuzgtFTz9BzCniGStfkwzKzS6lAssQUK2F0fcWnhR18lC5iihflFp5+xI UWsfRiZdTMwBAHeCDychcxMQlU8ONzF7DsuAKWSOP1hDmkgPoCLmhsLs0cFY0U+Ne/K+B zkAAJ74w2CMiDRE6J+DKrpBnv0LWhNKfAzzOXJRhgW0tsGr29a1t3Iwx6Px4tcLC9Lhn3 pjSUtPJVJ+kIh/qhNLKl/4xqmqf8wd/U95wxj2KQFRwkYi7qcOTO855QwEn3f8w354pyL p66dv71TxQ/WPTv1yn+rP2JI8IzWTh/3fyQeo/3hs36muBVGQfTm2HkfiOIjgnvXNTQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XzZ9uLQa; arc=none smtp.remote-ip=209.85.216.54
X-Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 40130606A330 for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 03:59:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 40130606A330
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-3b40d23e1adso9002574a91.0 for <netdev@vger.kernel.org>; Wed, 02 Dec 2026 19:59:01 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796270340; x=1796875140; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:references:in-reply-to:to :from:subject:cc:message-id:date:content-type:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Pkg2LdJv7FcWs6MWbGopLBQkXtHcxc+SQ+DbC2K76WM=; b=XzZ9uLQaLRfACJFrsU72ZbLyqRAuqEN9F72XZSrhBln0ynrE/dJSBUrJj7+k7vWss9 QWzPH0s3z5zOVat11v7AWG7/aaMacFhs0Oi1SILqrZVUbrbo54iEWgaAE50XmcQSUJlr Gw5FeA9pgxLCkYhlw58NPiwt0iaUFwJHp8Gn/QCEW+40eTwPr/IEC40iwbP0aCgo4RrC AhoyFC7dHAIxF84/O7YBQAEI917BSGlesHq9ETE/AcL9h2XNrkWoH62oC+3YkDkAytcE Kz8xutvuYG5MWuOf0GkLXGJBrlmxf8vULPwKTwHIBjeM5lLRMl4F8IRtBcGwhFus5WzA +Row==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796270340; x=1796875140; h=mime-version:content-transfer-encoding:references:in-reply-to:to :from:subject:cc:message-id:date:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Pkg2LdJv7FcWs6MWbGopLBQkXtHcxc+SQ+DbC2K76WM=; b=yIij4uh6KmGbfrIWwrjbtC+QU19a40XTAtyEIp0iLgAmfS3JbB9uWVmTpDT+qc0amm 65QTHG6G3Jh6sqvEEC3PNhdogN/vG01xvA9QcqrEvzG0kkVq6JaNhpyC4h+IVwZW+N9d 6SfXs8jFilIb5zxzCBbMthKjWGuu/ru8zmuYNPiT6MUfVxDLob03Y/VHUYdlwg76irGs Oh98ydCVs3iGGz+FjMP2ucYIuaJpyo0QWAfonw2/BXBHrFex8FhOnbvkB5j1VvCcenEV C1x2KAg3AMjON9bIH5SOOtBFyaxPPjC/sXXl4RPewX+WTPqILG1gIlkHcS2oNMD2/OpG F7Iw==
X-Gm-Message-State: APuU4Z/91a0Ntc+V7jzvaXh0WFb45gDBNFQLJAIkpZYmywGf2SnExu1o 3SembiiKJpUSi3AHjDeC9kkRfE7c1EBDtWUC8eR5CSWLiQV7gfGfmYIS
X-Gm-Gg: AZFdTZfY9VCJ712MW4TgPsByWvLNfTIV5wiKUdthCi2Mlr/0C8Y9KIFqPSkUkY6ewQw TMFZY5TG9dsGw5NaQrGD65WO4qevzzr8YDH9Cb0s9ZmN/+noNLAXSGBwqKkKMY+tNC/8h5o8vrv ffQpHHSJCpCokE/8ri4AC9Sq7uqKcBVVcrxnYNlW8j3UKQCDwKuG7Ljhwgm/xc/Tj50dMu7PKAC hnm+FYcGvMvktyxWRwuMmT2+Gxh6IulC7oGasLRS5S2wRewMJTa5Ro2sSh4inb40sK5ULhi3mMB KIiwB2ETg9pmGfJs0i7SE2XtmRrsaGrNiLaAKtIpB7LljIxoyuldqxUEog2HbCf3FqGHxq6B8LB P9uTgtiNVgvLzRO6kh4CnsqhCyi4SfqexnrWxEDIedpMO9DH0Z3+20bH2zjxglzaeP3zMDUt6Yk dfvV2+Byk0ejmKcPd9VBLrczOQ2R7/4Rvei6aTn14fNu0zG/K1O23fDzaq0ujpPwY7mE7T+K2BN WURX1JBJEcqAnLlGy/g1vi5rqZ5C7v45P2aThdwKZT2OsFFbQ6fkzyr9J1/SyeKV4VeZ0HX6Wel XS7lV8vHETIqSqgbOQehrQlq9W6svy3cbrNOrU5Rpe9kY9YiinPZ/nkuEBhZvaPXJxNYJcVv5M4 91/cMK3jiDaDB8zWGYo0c9MScLndhPM9Ij66cEKG0u1eCLwKlZjnshCE=
X-Received: by 2002:a17:90b:2f8c:b0:3b4:10c3:c1b6 with SMTP id 98e67ed59e1d1-3b41c9286acmr44076364a91.25.1796270340115; Wed, 02 Dec 2026 19:59:00 -0800 (PST)
X-Received: from localhost ([153.61.198.242]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d32fe5sm2146458a91.7.2026.12.02.19.58.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 19:58:59 -0800 (PST)
X-Cc: <netdev@vger.kernel.org>, <daniel@iogearbox.net>, <martin.lau@linux.dev>, <john.fastabend@gmail.com>, <sdf@fomichev.me>
X-In-Reply-To: <20261130065659.621451-1-p@1g4.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Received-Bytes: 11491