lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Wed,  8 May 2024 13:23:22 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Shuah Khan <shuah@...nel.org>
Cc: Phil Sutter <phil@....cc>,
	Pablo Neira Ayuso <pablo@...filter.org>,
	Florian Westphal <fw@...len.de>,
	Felix Huettner <felix.huettner@...l.schwarz>,
	Max Lamprecht <max.lamprecht@...l.schwarz>,
	Luca Czesla <luca.czesla@...l.schwarz>,
	Xin Long <lucien.xin@...il.com>,
	"David S . Miller" <davem@...emloft.net>,
	Paul Moore <paul@...l-moore.com>,
	Richard Guy Briggs <rgb@...hat.com>,
	Boris Sukholitko <boris.sukholitko@...adcom.com>,
	Valentin Obst <kernel@...entinobst.de>,
	linux-kselftest@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>,
	llvm@...ts.linux.dev,
	John Hubbard <jhubbard@...dia.com>
Subject: [PATCH] selftests/netfilter: formally SKIP() two cases of setup failure

If mnl_socket_open() or mnl_socket_bind() fails, it's generally due to
not having the user space parts fully installed and configured
correctly. This was previously ignored and reported as a test PASS, but
what really happened is that the tests were being skipped. This led to
generating inaccurate TAP output (I've omitted the leading '#'
character):

   Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

Fix this by using kselftest's SKIP() macro. The new output on the same
misconfigured system shows:

    Totals: pass:0 fail:0 xfail:0 xpass:0 skip:3 error:0

This was briefly discussed already with Felix Huettner [1].

[1] https://lore.kernel.org/all/edca87be-d8a7-4c62-b9c1-f9b3f5752595@nvidia.com/

Cc: Felix Huettner <felix.huettner@...l.schwarz>
Signed-off-by: John Hubbard <jhubbard@...dia.com>
---
 tools/testing/selftests/netfilter/conntrack_dump_flush.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/netfilter/conntrack_dump_flush.c b/tools/testing/selftests/netfilter/conntrack_dump_flush.c
index e9df4ae14e16..4a73afad4de4 100644
--- a/tools/testing/selftests/netfilter/conntrack_dump_flush.c
+++ b/tools/testing/selftests/netfilter/conntrack_dump_flush.c
@@ -317,12 +317,12 @@ FIXTURE_SETUP(conntrack_dump_flush)
 	self->sock = mnl_socket_open(NETLINK_NETFILTER);
 	if (!self->sock) {
 		perror("mnl_socket_open");
-		exit(EXIT_FAILURE);
+		SKIP(exit(EXIT_FAILURE), "mnl_socket_open() failed");
 	}
 
 	if (mnl_socket_bind(self->sock, 0, MNL_SOCKET_AUTOPID) < 0) {
 		perror("mnl_socket_bind");
-		exit(EXIT_FAILURE);
+		SKIP(exit(EXIT_FAILURE), "mnl_socket_bind() failed");
 	}
 
 	ret = conntracK_count_zone(self->sock, TEST_ZONE_ID);

base-commit: 45db3ab70092637967967bfd8e6144017638563c
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
prerequisite-patch-id: 9db2d20be98dc44731d8605a3da64ff118d2546d
prerequisite-patch-id: 72413b9b47d66666f20967a664470199892fe282
-- 
2.45.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ