Article View: linux.kernel.netdev
Article #10406Re: [PATCH v2 net] udp: restore hlist_nulls for primary and secondary hash tables
From: Eric Dumazet
Date: Tue, 03 Nov 2026 13:34
Date: Tue, 03 Nov 2026 13:34
61 lines
11378 bytes
11378 bytes
Le mar. 3 nov. 2026 à 09:40, Paolo Abeni <pabeni@redhat.com> a écrit : > > On 11/2/26 13:22, netdev-bot+sashiko@kernel.org wrote: > > Thank you for your contribution! Sashiko AI review found 1 potential > > issue(s) to consider. > > > > Critical: 0 · High: 1 · Medium: 0 · Low: 0 > > > > If you believe none of the issues are legitimate, please reply to each > > issue of Medium severity or higher and explain why the AI is wrong. > > If any of them are legitimate and you plan to respin, please let patchwork > > know by including "pw-bot: cr" as a separate line at the end of your reply > > (one such reply per series is enough). > > > > - [High] The hlist_nulls restart does not work when an IPv6 SO_REUSEPORT > > socket is tail-inserted back into the bucket it was just removed from. > > This look real to me. On the flip side the most straight forward fix - avoid > tail insertion in udp_lib_get_port() would re-introduce the issue addressed > by commit d894ba18d4e449b3a7f6eb491f16c9e02933736e. But rehash already avoids > tail insertion... Agreed, it is real, although not a regression: before this patch, hlist_add_tail_rcu() set n->next = NULL and a reader parked on the socket stopped there as well. v2 simply did not fix this case. We still need the tail insertion: udp4_lib_lookup2() returns as soon as the first matching socket has a reuseport group without connections, so a dual-stack IPv6 group placed first would win over AF_INET sockets, despite their better score. The problem only exists while a reader can still be parked on the socket, that is less than an RCU grace period after udp_lib_unhash(). v3 records get_state_synchronize_rcu() in udp_lib_unhash(), and udp_lib_get_port() only uses tail insertion if poll_state_synchronize_rcu() says the grace period has elapsed, otherwise it uses head insertion, as udp_lib_rehash() already does. The cookie fits in an existing hole of struct udp_sock. The cost is that an IPv6 SO_REUSEPORT socket rebound within a grace period of its disconnect keeps its head position, so the v4/v6 ordering is not enforced for it, the same as after a rehash today. This needs disconnect() then bind() on the same port, with AF_INET and dual-stack AF_INET6 reuseport sockets sharing that port. I also kept sk_nulls_add_node_rcu() unchanged, the tail insertion logic is now local to UDP. Thanks ! pw-bot: cr
Technical Details
Message-ID:
<CAL4WiiobvgoNp3Y-6qEh=OV9truPNn1v8-DoqFxR1rx=rpkZXA@mail.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-355647-linux-kernel-netdev=dewy.ruReferences:
<20261030122045.3035709-1-edumazet@kernel.org> <179362213820.3131.12108035098960840444@kernel.org> <c573bbcc-e0d8-4f43-b14b-09c676a6fe38@redhat.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-355647-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 net] udp: restore hlist_nulls for primary and secondary
hash tables
Date: Tue, 3 Nov 2026 14:34:29 +0100
Organization: Usenet Network
Message-ID: <CAL4WiiobvgoNp3Y-6qEh=OV9truPNn1v8-DoqFxR1rx=rpkZXA@mail.gmail.com>
References: <20261030122045.3035709-1-edumazet@kernel.org> <179362213820.3131.12108035098960840444@kernel.org>
<c573bbcc-e0d8-4f43-b14b-09c676a6fe38@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="3182025"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:M1wYl/yJTT54fhM+vtfVIhcNsQE= sha256:2alvzyKs31HdG9TqJd5g4bRqxsup/CsTZMCVUTBp/z4=
sha1:SrzdafqZQD0StE+t1qZHqe+p9mo= sha256:CKYdNLIwecQNS3TpYrJ+egEDm0K3sDPuIjV9XDr5xC4=
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 EFE171128C8; Tue, 3 Nov 2026 17:06:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
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=kernel.org
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 MSf8p0M8PGD7;
Tue, 3 Nov 2026 17:06:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355647-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 574DE1128BA; Tue, 3 Nov 2026 17:06:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 9E8C036C55; Tue, 3 Nov 2026 13:36:58 +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=1793712887;
b=l4gamWlYdG7ktAeQZSloO4EZrqxaom/fD2R3SVrex2Dzg5iOydH9s3PEUwG7rvnK7YaD
cz/gPFKtVxP5d+Jq+nUrzht4+E8KJOusxuHplBSc/vFUDZYcblG+OzNSggiv6+d7nMFYg
W3kZn/oWT0dieZVG9FgrP2k0M8GJWTxDlpzF0694P4Ib+hMhLeD44Uav8nEwjY7FqFHC6
FujgkPQKNHDo8E75gKx33gP/bIHLzpyj2IH96Av8kkSUlrww5sSfFI5JQt5tXOxHPHVKQ
9EHs+gmeg3juyWY+1BdpGEkHLMpe1FqwK7JaOMWEaVxkKbOnN1VkqT0HsGJ5J1XzSbw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793712887;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=IYte/VFkKdCZ4xhpQyoeocuEaTeaOZru7SAHY391uSM=;
b=oygSm9J+KbYRRAlqHh5dWKB9dpN7a2azO40DQOqIJexTzKOvkS82tKfgE4sm9ZiDMoTS
Sa5GRJ98J8IW8DGKssnwTsi2kGw7RXGpBOhkKtd6E6KrBRdBmyaM7BzWiM3SqH6biobbu
677AFagw9whZNB2q48Thx2ZnHhHnBXv4npl0it1/j6eGT2MFt8pRq7LHbYV9iTyi6TKAe
NGzjrclBRzltJwEmZV5Jj0Amicrqu0IqCQNq5uNP/7TbQXYsD88eahbTJP836iV4KK8tD
gSTLRcqKCGZIoQXZJQimOfsDClhlGaOTqHKDupdhypqH1Xigs8xMdpLq/BFV15xl3KA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=M49GXcet;
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 C54356083612;
Tue, 3 Nov 2026 13:34:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=M49GXcet
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793712881;
b=qcFUMhpUVbpPe83OdCW0/ICC7lwfmCQnxj5WfnTccErm5dX5i6LxWrq8a26S01l5X+aC
Ep/1odBTapLarnLqRSymOGW6dbHhYBndorLHq2ddy+jVariOaN9EdiidZ+CxcQAcDkahu
kQxlmQbcIcqDQqMlPnF9G/IVzNbn+y9m2fW712+RYEEmtyNtLdcLyQSV/hUIV9PjVqTPC
n5JsNY4uI07AWfjEwDOtPCDN9l4v1EvfG2XMQxzz8WVKCijFexWA/bHHHYraVICPV6PQj
Fm/daLbJGrI8/LTF0WhOyuHf1BggPrcO0u9b3wT+9tADiZ4LWOIN92Ho7qRjojipGTA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793712881;
h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
bh=IYte/VFkKdCZ4xhpQyoeocuEaTeaOZru7SAHY391uSM=;
b=FSol0s572qtF0aXdo6567xjA3UZqL9giLTBR38IOE3ye82f16A/wY4H2wa0yFzTV3i1e
nTvh4N4/4PFsG4VVSaOU09NQaNcXKig2dmm1gtkSNSaBIifJUQvK402TZsmsihxWPIqc0
37hZPv1BGg2HQ51dNMFnUzyMQptvWPtypbxuiYvnfEm0RwS6443nop062N9TSSHq1+i9J
S1l6G5CENfU5sTSgfCI62zd7FY3x/XjFVu884B3bnVmeQx14919+c5dG9MC8kIxGuHVsG
DFha49Q9Lem7NbIURcvC+ksII5hbLDb9yF025pQFA5PjMUVQ3kJpsDpQy/QNqvESXqQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=M49GXcet;
arc=none smtp.remote-ip=100.103.45.18
X-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 9629C606A33F
for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 13:34:41 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 437C81F0093A
for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 13:34:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1793712881;
bh=IYte/VFkKdCZ4xhpQyoeocuEaTeaOZru7SAHY391uSM=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=M49GXcethFCnW6HvRe2g3NkrtCtu1clX2LP4cxnrT72d1Ekz9Hb1qvt7LZOYW2CT8
YCr69FbGGWhVnA7gM6Q+sWgUIuQTQyVogVN383HTmNydnIIP5SfBzQKkrDQFPgg2wc
o0LD16cA5OHfUzxVgQBbXOiGkXk5uQc6kxGBn/A31WnPnlNlOGTi54+uXBGNpoV9RE
cINT8ra2eRhtZN0viLV/sT96scSYjjKOvDat/FES1Gmlz0mfE30wqcwqui/xKrHHyq
ylQv8ENQY7AParmbM53WpGHQShI75Cc+2USJiltmpSWSsBG9w4KnFGiQXH/dHqA8fB
fTTZYvWgrH9sw==
X-Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-4a6fb4040cfso1319632fac.3
for <netdev@vger.kernel.org>; Tue, 03 Nov 2026 05:34:41 -0800 (PST)
X-Forwarded-Encrypted: i=1; AKwUvBzfa6TYcyqDYraYZDevamY9IMcjBZlorONMT5NMwOXg09VGbdImt1plQkVYpxTYkCWexMdg20Q=@vger.kernel.org
X-Gm-Message-State: APuU4Z9mXggzzLaA1v1dtP7/yRzTpK3b4rLO79v3mLEiG5nBFTsmSCZL
ZtydpRDlDFoTJxyW18SM8dB8NlShEHerXsgTQdkiUdolqVOzBZEYYaF4iFveCxiQXA6AA0b5IVI
SWv8iw+3l1n8f/TXpL1tT+yHLbszsRSQ=
X-Received: by 2002:a05:6870:312a:b0:483:b752:633f with SMTP id
586e51a60fabf-4a907714416mr7456463fac.36.1793712880594; Tue, 03 Nov 2026
05:34:40 -0800 (PST)
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-In-Reply-To: <c573bbcc-e0d8-4f43-b14b-09c676a6fe38@redhat.com>
X-Gmail-Original-Message-ID: <CAL4WiiobvgoNp3Y-6qEh=OV9truPNn1v8-DoqFxR1rx=rpkZXA@mail.gmail.com>
X-Gm-Features: AclHuK99zDPGvHkXqxIh5HAxw_r9tpWTX1MGzY_JCyqvRX7nBtPz2wuFdyMsuxE
X-Cc: netdev-bot+sashiko@kernel.org, davem@davemloft.net, kuba@kernel.org,
willemb@google.com, horms@kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, david.laight.linux@gmail.com,
willemdebruijn.kernel@gmail.com