From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 D1B442FF164; Thu, 4 Sep 2025 10:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756980691; cv=none; b=OwZIXlEl2dtyjs50yzL9mGyIc9HUuUFW/uKDgl1sLLf2OWfGySQsufVcRmdtMFM4hqGW9UJy2EDIEtTwGVRfU/ishYgyJa4I3SPTp0emI5WKPNYk3ky+DWcooHsuLRWSNIw/92s+KotO1LzVA1YNm8Zbj7wJWKks9x92C/gpUtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756980691; c=relaxed/simple; bh=gd3oTP6bjhjJ2qctyz6KrLlk2+kMJXS0BqyDgSmpEc8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FQ+5j/9GIsuZLUcnGa5VzIkDy9aZFOZrt1QvoNcSB7YoK5k60wefD5MjbVTzW/R8is7lTwB8KphFVYkyMNanPWqV5cWSX0lL2zQ0vbbPaj6xFz4DdihkjwMZvuJkfHIlYQbBki5mzkpTi7UIjz0s2qnyjDXOSMrN5q4cOjQ1zbA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cBiqIPZn; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cBiqIPZn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 617AF1A0D4B; Thu, 4 Sep 2025 10:11:28 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 36100606BB; Thu, 4 Sep 2025 10:11:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 664FD1C22DD6B; Thu, 4 Sep 2025 12:11:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1756980687; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=kpNg2hMJQqf0lEz1s/GLCJuxsavDrYZXkOUPLs+u3QU=; b=cBiqIPZneZ4cIWol3TbY43Xv+cDsRrUkBOgpR0alp0KBlgKNQZpQEcvVYzlNcZ6Ca8JN+K 7H74d/bpSR4h8miomjEb2fhL06GkHZ32//bdCCztThVpmhk70G9i8puwZU7VwZrj1hE6dy DUz7DTcjeWBAGV5RqUOQJGHXTqub4Xdpx0d4dmeRKHy9aFSUrnv1VepcI8iEhbUbh053vV gV3DJ5h4nLPmcZtivbYwXmdVx6a3Q/iMH4ZUX8uo9nEx/2rdQaLxJZ3d+4Ec5ZksyKbl5T S5/3YRqfx7lKRrNcOV4anwkZspst1+0zObOFXoNLKnduIYdBY4lwU5UmKDDx6g== From: "Bastien Curutchet (eBPF Foundation)" Date: Thu, 04 Sep 2025 12:10:20 +0200 Subject: [PATCH bpf-next v3 05/14] selftests/bpf: test_xsk: Release resources when swap fails Precedence: bulk X-Mailing-List: netdev@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: <20250904-xsk-v3-5-ce382e331485@bootlin.com> References: <20250904-xsk-v3-0-ce382e331485@bootlin.com> In-Reply-To: <20250904-xsk-v3-0-ce382e331485@bootlin.com> To: =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: Thomas Petazzoni , Alexis Lothore , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (eBPF Foundation)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/test_xsk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftests/bpf/test_xsk.c index f70a05d570681e36d3e592a6845637402d1bb58f..0805917eaa1a33469fef2f1ad0757975f39d3077 100644 --- a/tools/testing/selftests/bpf/test_xsk.c +++ b/tools/testing/selftests/bpf/test_xsk.c @@ -1873,8 +1873,13 @@ int testapp_xdp_prog_cleanup(struct test_spec *test) if (testapp_validate_traffic(test)) return TEST_FAILURE; - if (swap_xsk_resources(test)) + if (swap_xsk_resources(test)) { + clean_sockets(test, test->ifobj_rx); + clean_sockets(test, test->ifobj_tx); + clean_umem(test, test->ifobj_rx, test->ifobj_tx); return TEST_FAILURE; + } + return testapp_validate_traffic(test); } -- 2.50.1