From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 B21D81A6817 for ; Sat, 18 Apr 2026 04:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776485842; cv=none; b=oFKElE/eoDrl0/iYafmczLry4542PUSx6rGW7Ys3SK5/aiPSzu4JTvh/zJTI4lAwlw6edRuKMnykpUezYITfosEjWlCV9mycQmD9S+vDsHyjwu6pDSUWQPLiFGj6Prce/s7i8LCAQtDth3QbS/1gzUqpMImQ93uOrfafa+Tl38o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776485842; c=relaxed/simple; bh=lWu4lifEBC+paMWkBtn1n5QMc+5bw0cgiGP7ZcJVeJo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P5xgLi8AKbnf5mHG+OEYefY+Qjx7Q9Ekh7rnHM6Q2yw5vReGvMx5K9o8h4auSQRa4F9jKJ0jhfcUsrpfnAW8YLrvqGhy+P/nwKbJSbl/qNkcQT5udDcLrXvpxfetBReaz3heyFFMJBRf55hiFLWLwZGlD5gPBBJ1L/9mIu+IF/Y= 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=QhLFWnEy; arc=none smtp.client-ip=209.85.210.181 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="QhLFWnEy" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-82f351ca23cso626572b3a.2 for ; Fri, 17 Apr 2026 21:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776485840; x=1777090640; 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=Y3YeiL1Jj/muMdy1IqA7Xewdi0uB6Hzewvx0oWM/aKg=; b=QhLFWnEysR5NKXZ5QlgmR6qCCj6tDpUooqPy87McO5vei51N36ti6XdrFD7CzQvOmU U+gJgqQA8XgjDE6RvjRqd2WCOUO26j8Qc/QC3Wh3vUvoqa4S5n1b4b388/iMF2SEgVhI wX3E6WiUYYVUefzM1/9+FZk7ucqGx2dMd2HirSNoVi/2SeeUNOOlgHQwFPfCdsSTAICb 8N56S26Dmkog26z+alV54yFWxNgySn29lJS4H8oU7GZk8FS4y0urprk5N7vdz3m0GWYD M6JEus+SV8VtYeF15eySECDbry0GyTrBCrDONOGa4FnYMZMVK4WgIR55pBPDIS9e/Zib ZDIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776485840; x=1777090640; 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=Y3YeiL1Jj/muMdy1IqA7Xewdi0uB6Hzewvx0oWM/aKg=; b=KwE4yI0Agks1r6JHyjSD8Vu7y96a5SrH0HEcUA+mw0US82CfpC565/7zNF6unIyFX+ oB0VMuU5jc3yTQEKXtOS1xkfLRWhLt3a0ZYoMvoFkkEg1Umr2LJn2NmHtZrJBifAOhs1 12XPV4QwhyBBc/xr6vwGxWBZw8YXfpPfgQ+GCR/SlUy6RulvRr7XiJuj882stYj9U5dH fta6UiG3KoGKM4W0Os8d3hPmvgCYJNweRZgZIvDPs6nwyOElACjoI4TfycQNRNTYp1Sa NtD9vghhubSM7di8rNmBeSKmYKJy1S6b2NylTowtFfd1g60X8qzGbeIhlOiKyF/JwTMa SalA== X-Forwarded-Encrypted: i=1; AFNElJ/wnQWGbBgqB9hDPfbVZA0lNWOlk1t18qw/glaNqlB/0ITQA4sDckM7NYLP8bi1vGEoZzRo01cV/T7eeaM=@vger.kernel.org X-Gm-Message-State: AOJu0YyAgAF9BPu3b1ntSghm4fw3CCc6CjX2bAooV+nmXe8kNHcZtHOU xyFguP7LEN6TmHVCQmlhFh4sUH3FVDPIlv6m0LMKPUY0IbeaccJ+OAik X-Gm-Gg: AeBDievSHYW7Yc6tfS8y9BOgGfwfjHUUVR6Kdhpp/xVHrFlQCbyNastIdU3XYxfGMhR HpN80XyTfTgI5qDYQXHUnQoHJDkT1N92TKV4sY4VDbvOrTTFsXNh3bXrmeY14cI/mRYUHMUACQV eth70tvNR/xunArV5mgbQbIN81K9NpYhlQxbPh4OJT+1L2Ua5XnNdijm2iAAQcTJ2/HEsOJYDmf 3+DkqUSg0XT+1ERvnFvASLTcLa8xa3aou2nDzrk4fHj6bX+vzTdJ39KIQ1i658yCVUcMcP5JLXu 7smBHMlTzb3lZ6YJOjI9VIc012e3n741C8+LDySadYSIqk3h2b1Ew9gtIo+sy4OOiCTwICFA5ig 0zLpawS6uwa+mEXKbpmlnEPtsdZcjn+XwDciBa3FTJbklfaWN0VwjaCO3Q0i7PMUT1du1qNiSq0 0zzf6sX0Ie4wFyRCwkRW+hF2RZq11rAij4CLL0T/9ejK+7IOg8jc/IJmXpAXrUvQ== X-Received: by 2002:a05:6a00:2307:b0:82a:6b97:34a7 with SMTP id d2e1a72fcca58-82f8c941403mr6183189b3a.39.1776485839874; Fri, 17 Apr 2026 21:17:19 -0700 (PDT) Received: from DESKTOP-MUHC17F.tail07b66e.ts.net ([188.253.121.151]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8e981992sm4356787b3a.7.2026.04.17.21.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2026 21:17:19 -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 0/2] tcp: fix listener wakeup after reuseport migration Date: Sat, 18 Apr 2026 12:16:31 +0800 Message-ID: <20260418041633.691435-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 Hi, this small series fixes a missing wakeup after listener migration in the SO_REUSEPORT close path and adds regression selftests. The issue shows up when a fully established child has already been queued on listener A, userspace has not accepted it yet, and listener A is then closed. The kernel migrates that child to listener B in the same SO_REUSEPORT group via inet_csk_reqsk_queue_add(), but the target listener's waiters are not notified. As a result, a nonblocking accept() still succeeds because it checks the accept queue directly, but waiters that sleep for listener readiness can remain asleep until another connection generates a wakeup. This affects poll()/epoll_wait()-based waiters, and can also leave a blocking accept() asleep after migration even though the child is already in the target listener's accept queue. The fix is to notify the target listener after a successful inet_csk_reqsk_queue_add() in inet_csk_listen_stop(). I also checked the half-open migration path in reqsk_timer_handler(). That path does not need an extra wakeup here because the listener becomes readable only after the final ACK completes the handshake, and tcp_child_process() already wakes the parent listener at that point. The series adds selftests under tools/testing/selftests/net/ that reproduce the regression for both IPv4 and IPv6. They cover both epoll-based waiters and a blocking accept() waiter. Patch 1 contains only the runtime fix so it can stand on its own and be considered for stable backporting. Patch 2 adds the selftest coverage. Testing: On an unpatched host kernel: unshare -Ur sh -c \ './tools/testing/selftests/net/reuseport_migrate_epoll' unshare -Ur sh -c \ './tools/testing/selftests/net/reuseport_migrate_accept' The epoll selftest fails for both IPv4 and IPv6 with: accept queue was populated, but epoll_wait() timed out The blocking accept selftest fails for both IPv4 and IPv6, for example with: blocking accept() completed only in cleanup On a patched kernel booted under QEMU with a minimal initramfs, both selftests pass: ok 1 ipv4 epoll wake after reuseport migration ok 2 ipv6 epoll wake after reuseport migration reuseport_migrate_epoll_RC=0 ok 1 ipv4 blocking accept wake after reuseport migration ok 2 ipv6 blocking accept wake after reuseport migration reuseport_migrate_accept_RC=0 Zhenzhong Wu (2): tcp: call sk_data_ready() after listener migration selftests: net: add reuseport migration wakeup regression tests net/ipv4/inet_connection_sock.c | 1 + tools/testing/selftests/net/Makefile | 3 + .../selftests/net/reuseport_migrate_accept.c | 533 ++++++++++++++++++ .../selftests/net/reuseport_migrate_epoll.c | 353 ++++++++++++ 4 files changed, 890 insertions(+) create mode 100644 tools/testing/selftests/net/reuseport_migrate_accept.c create mode 100644 tools/testing/selftests/net/reuseport_migrate_epoll.c base-commit: 52bcb57a4e8a0865a76c587c2451906342ae1b2d -- 2.43.0