🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #129

Re: [PATCH net v4] vsock: treat TCP_CLOSING as once-established

#129
From: Michal Luczaj
Date: Wed, 07 Oct 2026 09:24
44 lines
8142 bytes
On 10/7/26 02:27, netdev-bot+sashiko@kernel.org wrote:
> [Severity: High]
> Can vsock_connect() still reset a socket that is already linked in
> vsock_connected_table? This check only covers TCP_ESTABLISHED and
> TCP_CLOSING. At least two transports move an established socket that is
> already in the table straight to TCP_CLOSE, and neither one unlinks it.
> 
> net/vmw_vsock/virtio_transport.c:virtio_vsock_reset_sock() {
> 	sk->sk_state = TCP_CLOSE;
> 	sk->sk_err = ECONNRESET;
> 	sk_error_report(sk);
> }
> 
> virtio_vsock_event_handle() calls this for every connected socket on
> VIRTIO_VSOCK_EVENT_TRANSPORT_RESET. It does not take lock_sock().
> 
> net/vmw_vsock/vmci_transport.c:vmci_transport_handle_detach() {
> 	...
> 			sk->sk_state = TCP_CLOSE;
> 		}
> 		sk->sk_state_change(sk);
> 	...
> }

Right, that's a known issue[1], to be handled separately.

> [ ... ]
> sk_state does not seem to track table membership reliably. Would it be
> more robust to check sock->state == SS_CONNECTED instead (the transports
> set it together with vsock_insert_connected()),

vsock_shutdown() complicates this. It can flip SS_CONNECTED to
SS_DISCONNECTING.

> or to check membership in
> connected_table directly? That check would have to guard both the
> signal/timeout reset inside the loop and the sock_error() reset after the
> loop.

Lack of membership check for connected_table is not the root cause of the
issue. But, sure, we can discuss adding it as a sanity check.

[1]: https://lore.kernel.org/netdev/arpBYXWb9pohx-8v@sgarzare-redhat/
Technical Details
Message-ID: <011a9085-0bb4-433b-afc5-9c787cde0e12@rbox.co>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342278-linux-kernel-netdev=dewy.ru
References: <20261005-vsock-connect-reset-closing-v4-1-15d41cfda3ed@rbox.co> <179133282699.434549.6239722975007408103@kernel.org>

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-342278-linux-kernel-netdev=dewy.ru
From: mhal@rbox.co (Michal Luczaj)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4] vsock: treat TCP_CLOSING as once-established
Date: Wed, 7 Oct 2026 11:24:32 +0200
Organization: Usenet Network
Message-ID: <011a9085-0bb4-433b-afc5-9c787cde0e12@rbox.co>
References: <20261005-vsock-connect-reset-closing-v4-1-15d41cfda3ed@rbox.co>
 <179133282699.434549.6239722975007408103@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="617092"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2X+0SIK1M8s2C+3ZxwHy/dNMGws= sha256:1zQv73f0O+XhndjFOmBE4ooWolDN4HxaHkqM5bWWJvQ=
	sha1:xYDJToY0N10okKYDYJkb0V84RBE= sha256:bUm3GYPZnHISSAPX+S8u3AODrNSLrX0BYKmPguJMdYA=
Content-Language: pl-PL, en-GB
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 85E6610F126; Wed,  7 Oct 2026 12:36:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=rbox.co
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 2oILhEsc2jlY;
	Wed,  7 Oct 2026 12:36:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342278-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=rbox.co
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 6EAA310F123; Wed,  7 Oct 2026 12:36:29 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id A0AB13E0FF; Wed,  7 Oct 2026 09:29:58 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A638D47FB13;
	Wed,  7 Oct 2026 09:25:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="ghiKbUID"
X-Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5789045D90B;
	Wed,  7 Oct 2026 09:25:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791365144; cv=none; b=XnG95yszCXeOOiH+OJMVGD4pmLzgKByWltJ4S7F7vwEXutiLAAWi+BWUAtwkTgd8FMNqdKIi/NkFoRpCyp12qE3GEFeXeJA5ofE0AvBHB8EuaiOOEIH2qzQ77tdfdk8JuTAO4Qbi7il5D4UUxf88gLSzGacJD/re2HVHN/uZdec=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791365144; c=relaxed/simple;
	bh=X1iQiZAoBlGzZUp8UHo6VqQTPEenXfO56TjfxrcDB+w=;
	h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References:
	 In-Reply-To:Content-Type; b=Uaz7w5W6FcYpHDaaVXt18wrrriXgVE7EyPEqVXbtqnEyzz4h0wRKagSRhEbkwf32NN6ndX/9jNhUtUzkits8fqhJ+/PxA4GilsTilO5G7iD2AgGndm1kCFUFyeC0NdQg1s47tQZh2Pl2QKPUpIO6KzVHGg3gFkIEHwzJrUoeeQ4=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=ghiKbUID; arc=none smtp.client-ip=185.226.149.37
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co
X-Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com)
	by mailtransmit04.runbox.com with esmtps  (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
	(Exim 4.93)
	(envelope-from <mhal@rbox.co>)
	id 1xENtW-000pSp-GI; Wed, 07 Oct 2026 11:25:02 +0200
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co;
	s=selector1; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:
	Cc:To:Subject:From:MIME-Version:Date:Message-ID;
	bh=XVG330B7pnghrp1aXOfIvxamKNeiNYv7XmyKw+Y1T/o=; b=ghiKbUIDhVEpwH9HlKToSn+s7v
	bQ+RslnEJbUiBRNk30S3ItncCWxSiWk7Ne5qrw0RWdHbMRB8u0NB5RfWA2QLVRWnCgGej89EjKvZa
	ekXr4Ir55im2JKzO+yQWSNkflICWZl4/UkHMJkuADa47NRmlfLcBNR6pDSeTFE8IjiyvbKxHW08Hp
	MQpwdslAJ7mBpwUwrZDodqcxGBfzhKndf/hJ4eXdwNCgpCUrdYh44UfEbSC22snD/Ov7x/RnD8+RV
	uKevxzj2ddcwYuEv7Tf9Kaa+cU/XwtMjGweK3k3BfBK92Cupse31F5jObPRUv52suGwOvr01/mwyP
	wiq5xu3A==;
X-Received: from [10.9.9.74] (helo=submission03.runbox)
	by mailtransmit03.runbox with esmtp (Exim 4.86_2)
	(envelope-from <mhal@rbox.co>)
	id 1xENtK-0005HW-Fz; Wed, 07 Oct 2026 11:24:50 +0200
X-Received: by submission03.runbox with esmtpsa  [Authenticated ID (604044)]  (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
	(Exim 4.95)
	id 1xENt7-002JEu-C3;
	Wed, 07 Oct 2026 11:24:37 +0200
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-User-Agent: Mozilla Thunderbird
X-Cc: stefanha@redhat.com, sgarzare@redhat.com, mst@redhat.com,
 jasowangio@gmail.com, eperezma@redhat.com, davem@davemloft.net,
 xuanzhuo@linux.alibaba.com, kuba@kernel.org, pabeni@redhat.com,
 horms@kernel.org, edumazet@kernel.org, kvm@vger.kernel.org,
 virtualization@lists.linux.dev, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org, imv4bel@gmail.com
X-In-Reply-To: <179133282699.434549.6239722975007408103@kernel.org>