Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp279085lqp; Fri, 12 Apr 2024 18:43:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGPT8YcQcpCcIdKp0THdoQH/z0X4QkdcDyKOxGvpMadjX7ubbmVp/eQY0oN83aYrE2rZrdNVK5X4kiw7AF6pCha9dQt2b3crS8sJ28Ig== X-Google-Smtp-Source: AGHT+IH4GSVlyYeHMWkisV94Qs72+lrVPCuqGJrmMWbrZNbbiJ+rRT1mezppYIzm3DqGogaj2t+L X-Received: by 2002:a17:903:1247:b0:1e4:25e8:c2f2 with SMTP id u7-20020a170903124700b001e425e8c2f2mr4656678plh.41.1712972617826; Fri, 12 Apr 2024 18:43:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712972617; cv=pass; d=google.com; s=arc-20160816; b=Z+qnkxmaK1bbhCITdW3jx3u3Jf5FQfXsqL6PU2x5nlLn4GH9pWJxUAV2wXnoxfk71e b+Mjo+bXGmtsZUMhAD3h3+Aff5fEz1NRAP13ngzZWRARE3AsZDcIHts7bRRzN9iSu1E1 V0Bi0yeA/oDryI0PiyKm5UrXh5pF5T/JSZ7gWcxpXwceSU096RfcZ1z1yd2GAZADMgYO 9iHefJ0ZIOppvzNqK3JKmwGUuaF+WNKSwoACZUmcd6abQ6DBUSsq7SPej+WxUzYULcvD w7qBP2U79KLHBU47B1R9589YbKplnb1bw3x1qZ0iECKJUotd1YnnU9p7fI6UMENouIl2 zrQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=GlLt4og29ogqnaOJhaANPsKE8JxLMoJ5KYyBXvRzkeQ=; fh=mIjzXHw5v7A2Erx58fxNJLY3dKis8KZygbiuspmBmUM=; b=oQbvy0wW1orTb7+E1kzsWoIHGPQ0dSRF+sGneUC1whkJsCflglOyxQg+sebzG0DWmt ozu5Eh3c6jmIE4YcQG6eaSMRTQ5glO8+d6i/ghvBXHFPDpdQiXhiRDdApC2sq1UgeSop DxOMmTB05O4lJNpfIEZ6WUJWfXW1czGcgrJa9ugE8MUC/pRUaWjZCDkS5y7XT5sH1KPX 3Yk3WctAvmcAYtzxYcs+p18RKQDjrwXJ4YFsk3hxQwjrkwpL2kUU7/sD9ossLZkHW+0z w0amGZlDKcizrOECfXukST5L7ZW9dwfS5kN9ejc9+pwIeTiT0jgWm436pNJ25pip2nqL xnpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vs89Ysm6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143496-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143496-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h5-20020a170902f70500b001e27c30fa68si4329498plo.450.2024.04.12.18.43.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 18:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143496-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vs89Ysm6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143496-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143496-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 85BDA283C43 for ; Sat, 13 Apr 2024 01:43:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEC3118E1F; Sat, 13 Apr 2024 01:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vs89Ysm6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D6A4F7492; Sat, 13 Apr 2024 01:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712972584; cv=none; b=NZoYfBHs4YByH11dOAH1PgPNSq7XM9LRZwx6v5fvmVzXJ6o+cuiaLP78M7WD4vprOdnAM3RrSWzqGJ5vX3TpeZ3fZ6Ax0ZMmzoL9jRbBpwdlOD0bM3+WEOBr/eziZXenTYdylC61AJEYDnkEN/LwDund9NBr4Qky/BbjJUEvoWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712972584; c=relaxed/simple; bh=tvGa1RDSYHvI02nHuHPX+BD+1F1uJG9F/D3Zv650p0g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cz1ywEdXxifd/xTck1wOHuS/fBhI7Yg14HNYxdRPzSiVdW+AvgR8NQuXgq9hMLhVIBztH73ZbPiEOzXRDMrmOVRZg4QxTptpq5NfQv+7aOggts2DvEj7dSjoaS1DMIvOp56Cv3mrlq58B4yyoRduLWEKul3rw26Spp1f+1q0cxE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vs89Ysm6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 68011C2BD11; Sat, 13 Apr 2024 01:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712972584; bh=tvGa1RDSYHvI02nHuHPX+BD+1F1uJG9F/D3Zv650p0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Vs89Ysm6Eq6GyH7Erh2wAgEBXOtwbQsc6i4A+2O21cGpbZO8fEKMTenXKzqsXx+bG SoN0FNIKee2t8YjC9UmZgpM6HWpMtOiVEO1WVQ0WHAZSZ7yytceQryTiA+73AAQBnz /4PRBp1ETUKvUSkjX1j2Ffc5zsbM6kzAWiab+kKjnLyw45GSkYmaxobHIZN0QSaKtb hi3qZemRjiifBWn9pDEOeCTQn2dLAorItZqNNlhqmg4r1uuQFpnh4HNV9r7gbdz/o3 gHjbSgAfFTBXDjXaBkZoDhgvf7B+eX1B388Fh5SGB4hGFahivOl/fLKGxu+ksBCfP+ c9Z+N/KkJspSQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 506A0C00A94; Sat, 13 Apr 2024 01:43:04 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Sat, 13 Apr 2024 02:42:52 +0100 Subject: [PATCH net 1/4] selftests/tcp_ao: Make RST tests less flaky Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240413-tcp-ao-selftests-fixes-v1-1-f9c41c96949d@gmail.com> References: <20240413-tcp-ao-selftests-fixes-v1-0-f9c41c96949d@gmail.com> In-Reply-To: <20240413-tcp-ao-selftests-fixes-v1-0-f9c41c96949d@gmail.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712972582; l=3102; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=M06UR6shNbxtrWai0TpYoMLXyAZTaGGEZv0XA0Xj5PY=; b=3va35F/mXlgdzh4og0lSK3APn3dow8vd3RX7hV6FJZKkqOHaKzkUaSBVDLVqV13KEESoEVRwIJt1 St/bbfmHDE5G6xTenLVkdp79QtRqUMLirepzGOgub8zEZ3hdVpl3 X-Developer-Key: i=0x7f454c46@gmail.com; a=ed25519; pk=cFSWovqtkx0HrT5O9jFCEC/Cef4DY8a2FPeqP4THeZQ= X-Endpoint-Received: by B4 Relay for 0x7f454c46@gmail.com/20240410 with auth_id=152 X-Original-From: Dmitry Safonov <0x7f454c46@gmail.com> Reply-To: 0x7f454c46@gmail.com From: Dmitry Safonov <0x7f454c46@gmail.com> Currently, "active reset" cases are flaky, because select() is called for 3 sockets, while only 2 are expected to receive RST. The idea of the third socket was to get into request_sock_queue, but the test mistakenly attempted to connect() after the listener socket was shut down. Repair this test, it's important to check the different kernel code-paths for signing RST TCP-AO segments. Fixes: c6df7b2361d7 ("selftests/net: Add TCP-AO RST test") Reported-by: Jakub Kicinski Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- tools/testing/selftests/net/tcp_ao/rst.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/tcp_ao/rst.c b/tools/testing/selftests/net/tcp_ao/rst.c index 7df8b8700e39..a2fe88d35ac0 100644 --- a/tools/testing/selftests/net/tcp_ao/rst.c +++ b/tools/testing/selftests/net/tcp_ao/rst.c @@ -256,8 +256,6 @@ static int test_wait_fds(int sk[], size_t nr, bool is_writable[], static void test_client_active_rst(unsigned int port) { - /* one in queue, another accept()ed */ - unsigned int wait_for = backlog + 2; int i, sk[3], err; bool is_writable[ARRAY_SIZE(sk)] = {false}; unsigned int last = ARRAY_SIZE(sk) - 1; @@ -275,16 +273,20 @@ static void test_client_active_rst(unsigned int port) for (i = 0; i < last; i++) { err = _test_connect_socket(sk[i], this_ip_dest, port, (i == 0) ? TEST_TIMEOUT_SEC : -1); - if (err < 0) test_error("failed to connect()"); } - synchronize_threads(); /* 2: connection accept()ed, another queued */ - err = test_wait_fds(sk, last, is_writable, wait_for, TEST_TIMEOUT_SEC); + synchronize_threads(); /* 2: two connections: one accept()ed, another queued */ + err = test_wait_fds(sk, last, is_writable, last, TEST_TIMEOUT_SEC); if (err < 0) test_error("test_wait_fds(): %d", err); + /* async connect() with third sk to get into request_sock_queue */ + err = _test_connect_socket(sk[last], this_ip_dest, port, -1); + if (err < 0) + test_error("failed to connect()"); + synchronize_threads(); /* 3: close listen socket */ if (test_client_verify(sk[0], packet_sz, quota / packet_sz, TEST_TIMEOUT_SEC)) test_fail("Failed to send data on connected socket"); @@ -292,13 +294,14 @@ static void test_client_active_rst(unsigned int port) test_ok("Verified established tcp connection"); synchronize_threads(); /* 4: finishing up */ - err = _test_connect_socket(sk[last], this_ip_dest, port, -1); - if (err < 0) - test_error("failed to connect()"); synchronize_threads(); /* 5: closed active sk */ - err = test_wait_fds(sk, ARRAY_SIZE(sk), NULL, - wait_for, TEST_TIMEOUT_SEC); + /* + * Wait for 2 connections: one accepted, another in the accept queue, + * the one in request_sock_queue won't get fully established, so + * doesn't receive an active RST, see inet_csk_listen_stop(). + */ + err = test_wait_fds(sk, last, NULL, last, TEST_TIMEOUT_SEC); if (err < 0) test_error("select(): %d", err); -- 2.42.0