🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11153

Re: [PATCH bpf v2 08/15] net: Leave sk_stream_wait_memory() once the socket is dead

#11153
From: "Alexei Starovoitov"
Date: Wed, 04 Nov 2026 18:32
42 lines
13025 bytes
On Tue, Nov 03, 2026 at 09:23 PM Eric Dumazet <edumazet@kernel.org> wrote:
> "A signal or SO_SNDTIMEO of the target ends it" does not look enough to
> me. tcp_sendmsg_locked() takes the timeout from sock_sndtimeo() of the
> target, a socket the sender does not own and cannot configure. With the
> default MAX_SCHEDULE_TIMEOUT, a blocking sendmsg() on the sender's own
> socket never returns, and the sender's sock_hold() pins the dead target
> until then.

Right. It's not enough.

> Since this patch makes SOCK_DEAD a reason to leave, one wakeup before
> sock_orphan(), while the socket is still owned by the closer, should be
> enough. The sender can only get the socket lock back after
> sock_orphan(), so it sees SOCK_DEAD. Nothing walks the wait queue after
> sock_orphan(), so skipping remove_wait_queue() stays safe.
>
> Something like this (untested). sk_wq can be NULL here for MPTCP
> subflows, hence skwq_has_sleeper():
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ void __tcp_close(struct sock *sk, long timeout)
>  adjudge_to_death:
>   state = sk->sk_state;
>   sock_hold(sk);
> + /* A sockmap egress redirect can sleep in sk_stream_wait_memory()
> + * without a reference on our file. Let it see SOCK_DEAD.
> + */
> + rcu_read_lock();
> + wq = rcu_dereference(sk->sk_wq);
> + if (skwq_has_sleeper(wq))
> + wake_up_interruptible_all(&wq->wait);
> + rcu_read_unlock();
>   sock_orphan(sk);
>
> This can be a follow-up and does not need to block the series.

Makes sense to me. Thx
It depends on the SOCK_DEAD test, so it goes on top of this series.
Will send it as a follow-up.
Technical Details
Message-ID: <DMMN42GPUESV.YUIKSBF4E297@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356703-linux-kernel-netdev=dewy.ru
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com> <20261102072112.4160195-9-alexei.starovoitov@gmail.com> <CAL4Wiiq+QX8quVBjEZK5qipki6Yt7vx4=tt2L4o+FwO9zD-5=g@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356703-linux-kernel-netdev=dewy.ru
From: alexei.starovoitov@gmail.com ("Alexei Starovoitov")
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH bpf v2 08/15] net: Leave sk_stream_wait_memory() once
 the socket is dead
Date: Wed, 04 Nov 2026 18:32:39 +0000
Organization: Usenet Network
Message-ID: <DMMN42GPUESV.YUIKSBF4E297@gmail.com>
References: <20261102072112.4160195-1-alexei.starovoitov@gmail.com> <20261102072112.4160195-9-alexei.starovoitov@gmail.com> <CAL4Wiiq+QX8quVBjEZK5qipki6Yt7vx4=tt2L4o+FwO9zD-5=g@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3457982"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6LYVIBDOWyHHlg5M0B8eWHjdNsw= sha256:Vi06fhzATXneqjdtoLpPYzoqxzboXjwJOevB3J9u7ZQ=
	sha1:3vlo4nEA7RX+Ais5sYdo7XhGb/Q= sha256:ux6++BTkIR5c8KfeKvACrM/jQMjKKio/DR3kXpXsbpM=
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 4CEE4112CE5; Wed,  4 Nov 2026 21:45:41 +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 B5O_MSS6-D2b;
	Wed,  4 Nov 2026 21:45:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-356703-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 3F4F9112C7A; Wed,  4 Nov 2026 21:45:29 +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 EA9C635D80; Wed,  4 Nov 2026 18:32:44 +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=1793817162;
	b=vnu3mo4PCfDZbnV83TmLvwGI4ZP3vju1lDGQcKcN/tEIRDSgTE2VBXrc6mdpJ5tjpl9n
	 STd+jJrY18Vl9q3ZnovAKoBDxwqEkgAzeUmXC4lOv+CGTRDKdvQnlEYpidZsSBDseCLX8
	 zOOj69XdufD7Yz33hrgo3u1poNwL7X8KWOV9HmeHcrhGcMHtfZJ2cchAvHdwMMP4TXXjm
	 vpCnhjldph51PJbrXJ9axA8LEBPdn/4vSK45h4jtf9HlUdKcGJNanMhmHDHFW+6ikT5vD
	 H9Q0/Sp2wXfEHqMYAB5fhMFUZgiSgBjS8V7UsKUyCLNcn+pD1z2Adbg5s8Lb8vDUZkA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793817162;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted: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=bgGvwwQ0hp1A5Cajh6ZjxfCDvcyK9tWxZx+AIP+8L3A=;
	b=VPxuwf1+N2xZmaqRNYQcgOcmdKgGgxcx05XVFIAKKfUN5bcHZqUccbt36z7+TyCmYZ2b
	 YlBUAChIShW5y/UZruS/fdNIV4OvWrHLNEfRU9u3Gb2rxRWkKAf2KOEkMAikxwsyA3tRA
	 jIgZQ8EJPPb5O1ew6+Fs/3HeocTW8p7wcVUjGW6teKm6xwXmsZ2mrmeZixyc6Ac9wJoAm
	 CndLHi5arlSKvpk8p2hO72PuxDGMb4ycx9x+DAhd2XUMh8HA1G4Mly9xxEFFypRUuMr0K
	 Bvfv2IBUDI2gk8DH86tclz+zqGS2mMUnXJEi6GY2SycQb86zwwSvDzUUr27YFLz8aGQ==
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=WnhNglyv;
	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 B2098606A326;
	Wed,  4 Nov 2026 18:32:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WnhNglyv
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793817161;
	b=kEYyBp0VUqxuUJPU7Riu4dWiSUMstBHOr6O3wciSqjj/2jepEXTJCpEqyyrvT65CU7Jh
	 OZ2JhlA8OsFrK0eBTSM+MA6kBFqTaiBntWhkZ9w8oe8z+ZjqiaKWZLFWrkR7+V4lYzUyG
	 LbMd2gJhc3x+m7Uf/1B3LiWfUPbuUEamUakAzFgt7bKCi9FI7L9h97FhwKUZQO4Q8aJ5F
	 EJHGzuMwfB6YepkTyAGiavHEbdohp3ozU8QS4CoxMMczBayluTmALikeb9sNCIZx9bW6k
	 d2r3dC8czmHa1AXddQ77GYGaE/HeX9q/tSOpr2D+7j1d1zcZjPxMrJCpRXg7Z3KumCw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793817161;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted: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=bgGvwwQ0hp1A5Cajh6ZjxfCDvcyK9tWxZx+AIP+8L3A=;
	b=LUBXRQQwDyO2M8s/TagMJclZev2LaeyrBhQ3RnDDgpaYDQF5NqvndnLWt2kSWRLf9IfN
	 x4nzmhfAj56/tAYn6tlZJpBTZzDBiMJStn6Mvp+YsLqO9sdTDnGwT++Ehru2LJ//7xnSt
	 ywhtTJdmJLH1IsKIz0gCLoDHLGNw+8L0/E4h9SGBOj44tKzWjmQl0Qt+2FtKbfAAFrC83
	 HqCLYeI/MzMnDdq6Pk3BxAO1wZTajA1mNHhzwqjkZgONKpRE2Cts8wU8kb/6Su8SIxJAN
	 T7xbWXUZrjMu+qeKo1NNPAFXDhDvTrK1AJhLiSRuF7z7d2521LmiyH7ano05dHpE+MA==
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=WnhNglyv;
	arc=none smtp.remote-ip=209.85.216.53
X-Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53])
	(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 7EF37606A328
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 18:32:41 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7EF37606A328
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-f53.google.com with SMTP id 98e67ed59e1d1-3ae6b4c669fso1388323a91.0
        for <netdev@vger.kernel.org>; Wed, 04 Nov 2026 10:32:41 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793817161; x=1794421961; 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=bgGvwwQ0hp1A5Cajh6ZjxfCDvcyK9tWxZx+AIP+8L3A=;
        b=WnhNglyvCBh7ZPhaI+5vGqQkRigBp6TtgG0deUYHZNLf5FfinhmiZlHNByAGYNI4SL
         iSmUomw8vSyjos/KvmTEAGXcIjs5ntqRuFyyj+SDPaP1aolY1XC5rpnAwltboXplmF+H
         npO6z20tFVzn719f2b9XBNGstbEQRzUzgPW46+Dsks0ffp36oCT9dlXJBTg/OBdPsrVi
         GNYZxZ3TbMimbcRV0fLQ8t6EMIgUb0I6KT4dp0PaW8ZUcUSIu2Wb+fcGOlDFOAa4NmGE
         /sOsDZA4Gw4LOrkEAAF/eXmFi8HbwyV59xDcNGJrES/3JiZfwhay4EOl/OoArRih0CKd
         3NWw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793817161; x=1794421961;
        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=bgGvwwQ0hp1A5Cajh6ZjxfCDvcyK9tWxZx+AIP+8L3A=;
        b=CBvg9TDQ5swS818wf1+E0sN9dLNCa5MkatiBCIhmeOtXfOg+iD6aFGCRakK6yp4Pcd
         Z1w/w7Fzw3B6gPZS3HvNnt33tqD/iRhpOsjQUzKdey1foZKx8VLL1X4w324FCKRZNrdx
         XdQzY3/hbdxFGGM01F2jXhFhV7C5lygfsG9dH8yxc7dcSO2l5qX6Qh6SKqtWS5BoO9eA
         6Uqe+ywZbrFcNvSHKwnD4MXxnEFspSAhHkIb6DhDVci0NbuNQceA6kG6KF+yH0meIS1q
         Xy4qIarmuiE7j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:90b:554c:b0:3b0:a1c6:95ae with SMTP id 98e67ed59e1d1-3b0afc77a41mr178745a91.31.1793817160656;
        Wed, 04 Nov 2026 10:32:40 -0800 (PST)
X-Received: from localhost ([153.61.198.252])
        by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b0b313c143sm154357a91.2.2026.11.04.10.32.39
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 04 Nov 2026 10:32:39 -0800 (PST)
X-Cc: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <daniel@iogearbox.net>,
 <andrii@kernel.org>, <eddyz87@gmail.com>, <memxor@gmail.com>,
 <john.fastabend@gmail.com>, <jakub@cloudflare.com>,
 <jiayuan.chen@linux.dev>, <davem@davemloft.net>, <kuba@kernel.org>,
 <pabeni@redhat.com>, <horms@kernel.org>, <kuniyu@google.com>,
 <willemb@google.com>, <matttbe@kernel.org>, <mptcp@lists.linux.dev>,
 <mason@kernel.org>, <josef@toxicpanda.com>
X-In-Reply-To: <CAL4Wiiq+QX8quVBjEZK5qipki6Yt7vx4=tt2L4o+FwO9zD-5=g@mail.gmail.com>
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