From patchwork Thu Mar 13 10:48:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Curutchet X-Patchwork-Id: 14014712 X-Patchwork-Delegate: bpf@iogearbox.net Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 C04D0266B60; Thu, 13 Mar 2025 10:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741862900; cv=none; b=C/hTqtfnIysfKz28f3zHApA39VuweIaNRkIOwtqYK9gsIN9THzbjGVH2UiMzMqWpMeym6Dl1l2QFmthkHddE69nHy+HXztJ4c0Ko96QCtjHno2vaSfKr9ClkA+h1FATzVyNAsnM7Wl9JjYbgL5mHQpO6xn6ZxsOxer8KSdupMM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741862900; c=relaxed/simple; bh=ZQaZFd7AW9f9/unsK2igQLPsHgcymG632UXUfYrQN5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DC5McuK28q6SF4o0Co7i6Jzl8IbLq5DPQzEhGNTkT5WS7ANVbvg78nwOd6OvDwHyK5CyjDnsCrdo29njG+ofiC83260V1Udd8ba4jk1pb1iGjSfi0LVevsPLPyAEzfL2bTknJZiFodN62jPsFthUGm5tZZWZvMFNxy0FfmXgkok= 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=nSFMOV0p; arc=none smtp.client-ip=217.70.183.200 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="nSFMOV0p" Received: by mail.gandi.net (Postfix) with ESMTPSA id C47854322D; Thu, 13 Mar 2025 10:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1741862896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pFl7R25Q4N3Infj10DbmvYfGESOwYYT/HdPxE8csK44=; b=nSFMOV0pJcTZrHvnY+qtT8cnnPIkOyTgUGh7z2KaHe1u88wOw3O0Sr3To9Px0NIFgSUVXz QyGFFeHg8CIuIwBjwCRbgEutuTrPc58qsGrkU8bKbPENPtzRcaQRF1hYcvuaekAQAtihnh ZNZ+YTtbjJtP5ZhRSdJUAmmSjHZMhDAlKAvvorMbYMGgHdH5PALHzI6eLygFP41hJTFoe4 rRukKdp3BCT/s6nRXpD3znD6tpQ1RNkCMbseAw7D1xbTzqBp93CNR9kS54mFJePSma6GIg tHJS9vT5yIv5Upd8bjL4+G3yjXXljwuUE3YGBBUBK3QPbPYaCA5H0mB+gylujA== From: "Bastien Curutchet (eBPF Foundation)" Date: Thu, 13 Mar 2025 11:48:06 +0100 Subject: [PATCH 08/13] selftests/bpf: test_xsk: Don't exit immediately if validate_traffic fails Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250313-xsk-v1-8-7374729a93b9@bootlin.com> References: <20250313-xsk-v1-0-7374729a93b9@bootlin.com> In-Reply-To: <20250313-xsk-v1-0-7374729a93b9@bootlin.com> To: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , 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-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdejjeehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomhepfdeurghsthhivghnucevuhhruhhttghhvghtucdlvgeurffhucfhohhunhgurghtihhonhdmfdcuoegsrghsthhivghnrdgtuhhruhhttghhvghtsegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeegfeduhfeutddtieffteffleejffekveeviedutdegjeelfedtjeegtdejtddthfenucfkphepvdgrtddumegtsgduleemkedvheefmeguuddttdemfhelvgdumeeftgejudemjeeitdgtmedutggsrgenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepihhnvghtpedvrgdtudemtggsudelmeekvdehfeemugdutddtmehflegvudemfegtjedumeejiedttgemudgtsggrpdhhvghlohepfhgvughorhgrrdhhohhmvgdpmhgrihhlfhhrohhmpegsrghsthhivghnrdgtuhhruhhttghhvghtsegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopedvkedprhgtphhtthhopegvugguhiiikeejsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghlvgigihhsrdhlohhthhhorhgvsegsohhothhlihhnrdgtohhmpdhrtghpt hhtohepshhhuhgrhheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhihkhholhgrlhesfhgsrdgtohhmpdhrtghpthhtohephihonhhghhhonhhgrdhsohhngheslhhinhhugidruggvvhdprhgtphhtthhopehmrghgnhhushdrkhgrrhhlshhsohhnsehinhhtvghlrdgtohhmpdhrtghpthhtohepmhgrrhhtihhnrdhlrghusehlihhnuhigrdguvghvpdhrtghpthhtohepsggrshhtihgvnhdrtghurhhuthgthhgvthessghoohhtlhhinhdrtghomh X-GND-Sasl: bastien.curutchet@bootlin.com X-Patchwork-Delegate: bpf@iogearbox.net __testapp_validate_traffic() calls exit_on_error() on failures. This exits the program immediately and can lead to memory leaks. Return TEST_FAILURE instead of calling exit_on_error(). Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/xskxceiver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 5b1b05c21a04e05673d01855567320452db1f9c5..41c744c627d9b8acffc687f6893a01557e6556c5 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1931,12 +1931,12 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i err = test_spec_set_mtu(test, test->mtu); if (err) { print_msg("Error, could not set mtu.\n"); - exit_with_error(err); + return TEST_FAILURE; } if (ifobj2) { if (pthread_barrier_init(&barr, NULL, 2)) - exit_with_error(errno); + return TEST_FAILURE; pkt_stream_reset(ifobj2->xsk->pkt_stream); } @@ -1951,7 +1951,7 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i if (ifobj2) { pthread_barrier_wait(&barr); if (pthread_barrier_destroy(&barr)) - exit_with_error(errno); + return TEST_FAILURE; /*Spawn TX thread */ pthread_create(&t1, NULL, ifobj2->func_ptr, test);