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>] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  7 Feb 2018 02:37:23 +0530
From:   Naresh Kamboju <naresh.kamboju@...aro.org>
To:     shuahkh@....samsung.com, linux-kselftest@...r.kernel.org
Cc:     shuah@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org,
        alexei.starovoitov@...il.com, ast@...nel.org
Subject: [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod

test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.

Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
"modprobe test_bpf"

Signed-off-by: Naresh Kamboju <naresh.kamboju@...aro.org>
---
 tools/testing/selftests/bpf/test_kmod.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmod.sh b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..54177b1 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,8 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-SRC_TREE=../../../../
-
 test_run()
 {
 	sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
@@ -10,8 +8,13 @@ test_run()
 
 	echo "[ JIT enabled:$1 hardened:$2 ]"
 	dmesg -C
-	insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
-	if [ $? -ne 0 ]; then
+	# Use modprobe dry run to check for missing test_bpf module
+	if ! /sbin/modprobe -q -n test_bpf; then
+		echo "test_bpf: [SKIP]"
+	elif /sbin/modprobe -q test_bpf; then
+		echo "test_bpf: ok"
+	else
+		echo "test_bpf: [FAIL]"
 		rc=1
 	fi
 	rmmod  test_bpf 2> /dev/null
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ