From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F333738F25C for ; Wed, 22 Apr 2026 02:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776826000; cv=none; b=hipZRYUbPBpaQoHWF6A8B/jUKxur4xD/hxrfPcKmDKA9RoUKVuAasR7EN1Q3g5b9eRstKOBEVh1c4nkBjgXK9KrFbN4Sh4l4H46X/rthAxZ7ez+zpCcwxgjQC6P0RDmLy0gXDCWdZmrFyfm7VFOF3gTBMJVnOyuyWN4Nnesp0Lo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776826000; c=relaxed/simple; bh=OaQovPa9+EGt0TGv46fnTHFkH7yaRjfaIRFduQr/UYw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lnOmdaXQ136koDGuPo/QXGDXCxrjOZMVR9Dv9V8OrvQOblmjc5ETsW6SCPGj/mpsF2BnJkoL7WfhZIDaBiqqtDGl8UFi1VHz8svERcVqnxBfT2WQkBZKMqWSKvadnv8wRGjbmhb+b4Fllzpmir/Ks9bPEJuqbhtnBPSrmMWTslw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FlY59O+2; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FlY59O+2" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-c76b994f7a8so1802458a12.3 for ; Tue, 21 Apr 2026 19:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776825986; x=1777430786; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OfsVOB0fT6t3Cc1A7FO/ne2eHtXjxBYweMBP+Bjao20=; b=FlY59O+2+cAEFXGSvhuuINNDm5uHJnpwY0VA5Ez97mYcbqStGUaqnZ7LK42d/f1TVi BB1BvUaNt4/tDDAiFIbVc4kGrd+3cNY0+1u/tlZv6qJ9IG7QoeIutDdOZWcS/R3oxepw tTsnIlxYiTmHN8BJ6Iazgutnt7l35r7pvfnpZqwRH8LfEF8IGxEjmyaj0c5FP8KvCmex 3sKmB9JadEbKXbBlwpMsaVUNzO6FzxkFOUVW9rXxwGp1py7XX8xUfrx103X1BI7Dc99d 554OZ6ZhPHN+Md+Lxr46EtfvsGXEGltjQt5lTKe/4lWCt44RRbd3DgxNmVJkHnOU+POR WIeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776825986; x=1777430786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OfsVOB0fT6t3Cc1A7FO/ne2eHtXjxBYweMBP+Bjao20=; b=Oyr9vqwd75jNF/QMhIs7MtLTj+l6Zc4Pkf/BoeQQeswLZd4i1U23Gu4ruc37NoxA9N HkA0G3IPMJUAJZe5SkVSdxO7yqIFM0t6sRne95h1vmBd1Zuqkl6vBDRWUrItwLmKYvoX ja1cm883LNHzfEDdoO5NuCr5CHxtyrFRhgdzBoCt/Q+wL/8Xx/E+ESrkWWG0dJMzMM6Z yG6o/0nr/u+woSWoytlmoAR03J75hMFrryFgocn4HD/v6dvp3jCHTssbgaAxOefCRDre XeggfzPv6tXayZJA2RZiWt039pnm1EmXYYHtly8/3ojDQrAWHh0igobQpTmbszGX9gWO 1unw== X-Forwarded-Encrypted: i=1; AFNElJ8Bicl7BqajiwkuVuf5mHgS4J8QhTrt1FEijBHL60Q+UzOLR0XZWZmIS0Ldan9SKMswp/ibJAxqnWvK8C0=@vger.kernel.org X-Gm-Message-State: AOJu0YzFIscvwtdpgcyvDBnD1VjDTBeHbqyn/VgwX3ZFYj39piKVyQ9G yskAuFGr5xHF8pmHHqWtfCmAQ0nYre+I26GFkde1WSFXTJnreK/x3adh X-Gm-Gg: AeBDietPWGu3s4V3utDRL0k0KAHZE1lNxmaI1PFcyuX7SbNoz0BKSmr6rQIgsYoqKsp J6VAsP2Ew8+yZDl5eD1SIvZteOc4X5J3NInbCR6hCHmou7ElRrIufDuuXSAQlHDnG0cfXZLgZXC +/9OprpHXKVu8tYTQqEq9lFZd8hyDdGWhJjEMv3BKqmlA+uoOxyXDGFe/5iw4RNZLZyL9v7uCNz T2O8sfFSUuLlHEnkmL8B1j+JUw5qBWZ7M1sLXNnkG1N9OTa3U/42P50Mm0E0pFDbNA+0pDE2F1+ uedyvhT6wjKtketP+85QCvEZns7nYp8n6VYkw+IFD8SJdianZcTFK8yEhwhfiIV1x/iVGichLpj h2x3OLq82NMzrbZULQNpwOGW9Y9Yhs/6hdCTVuI2XRTYIHAWduxceMz61w9yL5WV8NZye+ds3pf 3JZPNqwJ4AucfKHzjD4CEeOZXaxMO4bxQxE5RNYmJLiJVNAOXF7BnonJAr2s37lg== X-Received: by 2002:a05:6a20:7f92:b0:398:b95c:51f7 with SMTP id adf61e73a8af0-3a08d8e2805mr22818050637.37.1776825986281; Tue, 21 Apr 2026 19:46:26 -0700 (PDT) Received: from DESKTOP-MUHC17F.tail07b66e.ts.net ([188.253.121.151]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c7976f92183sm10656632a12.3.2026.04.21.19.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2026 19:46:25 -0700 (PDT) From: Zhenzhong Wu To: netdev@vger.kernel.org Cc: edumazet@google.com, ncardwell@google.com, kuniyu@google.com, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, tamird@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Zhenzhong Wu Subject: [PATCH net v4 0/2] tcp: fix listener wakeup after reuseport migration Date: Wed, 22 Apr 2026 10:45:52 +0800 Message-ID: <20260422024554.130346-1-jt26wzz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series fixes a missing wakeup when inet_csk_listen_stop() migrates an established child socket from a closing listener to another socket in the same SO_REUSEPORT group after the child has already been queued for accept. The target listener receives the migrated accept-queue entry via inet_csk_reqsk_queue_add(), but its waiters are not notified. Nonblocking accept() still succeeds because it checks the accept queue directly, but readiness-based waiters can remain asleep until another connection generates a wakeup. Patch 1 notifies the target listener after a successful migration in inet_csk_listen_stop() and protects the post-queue_add() nsk accesses with rcu_read_lock()/rcu_read_unlock(). Patch 2 extends the existing migrate_reuseport BPF selftest with epoll readiness checks inside migrate_dance(), around shutdown() where the migration happens. The test now verifies that the target listener is not ready before migration and becomes ready immediately after it, for both TCP_ESTABLISHED and TCP_SYN_RECV. TCP_NEW_SYN_RECV remains excluded because it still depends on later handshake completion. Testing: - On a local unpatched kernel, the focused migrate_reuseport test fails for the listener-migration cases and passes for the TCP_NEW_SYN_RECV cases: not ok 1 IPv4 TCP_ESTABLISHED inet_csk_listen_stop not ok 2 IPv4 TCP_SYN_RECV inet_csk_listen_stop ok 3 IPv4 TCP_NEW_SYN_RECV reqsk_timer_handler ok 4 IPv4 TCP_NEW_SYN_RECV inet_csk_complete_hashdance not ok 5 IPv6 TCP_ESTABLISHED inet_csk_listen_stop not ok 6 IPv6 TCP_SYN_RECV inet_csk_listen_stop ok 7 IPv6 TCP_NEW_SYN_RECV reqsk_timer_handler ok 8 IPv6 TCP_NEW_SYN_RECV inet_csk_complete_hashdance - On a patched kernel booted under QEMU, the full migrate_reuseport selftest passes: ok 1 IPv4 TCP_ESTABLISHED inet_csk_listen_stop ok 2 IPv4 TCP_SYN_RECV inet_csk_listen_stop ok 3 IPv4 TCP_NEW_SYN_RECV reqsk_timer_handler ok 4 IPv4 TCP_NEW_SYN_RECV inet_csk_complete_hashdance ok 5 IPv6 TCP_ESTABLISHED inet_csk_listen_stop ok 6 IPv6 TCP_SYN_RECV inet_csk_listen_stop ok 7 IPv6 TCP_NEW_SYN_RECV reqsk_timer_handler ok 8 IPv6 TCP_NEW_SYN_RECV inet_csk_complete_hashdance SELFTEST_RC=0 --- v4: - fix patch 2 to route shutdown() failures through the epoll cleanup path - guard patch 2's epoll cleanup when no epoll fd was created v3: https://lore.kernel.org/netdev/20260421123106.142299-1-jt26wzz@gmail.com/ v2: https://lore.kernel.org/netdev/20260418181333.1713389-1-jt26wzz@gmail.com/ v1: https://lore.kernel.org/netdev/20260418041633.691435-1-jt26wzz@gmail.com/ Zhenzhong Wu (2): tcp: call sk_data_ready() after listener migration selftests/bpf: check epoll readiness during reuseport migration net/ipv4/inet_connection_sock.c | 3 ++ .../bpf/prog_tests/migrate_reuseport.c | 49 ++++++++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) base-commit: 52bcb57a4e8a0865a76c587c2451906342ae1b2d -- 2.43.0