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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b4ea2d9d566206e14e33ddceeb39a2fa3fa541e1.1374566394.git.lv.zheng@intel.com>
Date:	Tue, 23 Jul 2013 16:10:36 +0800
From:	Lv Zheng <lv.zheng@...el.com>
To:	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Len Brown <len.brown@...el.com>,
	Corey Minyard <minyard@....org>,
	Zhao Yakui <yakui.zhao@...el.com>
Cc:	Lv Zheng <lv.zheng@...el.com>, <linux-kernel@...r.kernel.org>,
	linux-acpi@...r.kernel.org,
	openipmi-developer@...ts.sourceforge.net
Subject: [PATCH 12/13] Testing: Add module load/unload test suite

This patch contains two test scripts for module load/unload race testing.

Follow the following steps to use this test suite:
1. Run several instances invoking endless_cat.sh to access the sysfs files
   that exported by the module.
2. Run endless_mod.sh to load/unload the module frequently to see if races
   will happen.

Signed-off-by: Lv Zheng <lv.zheng@...el.com>
---
 tools/testing/module-unloading/endless_cat.sh |   32 ++++++++++
 tools/testing/module-unloading/endless_mod.sh |   81 +++++++++++++++++++++++++
 2 files changed, 113 insertions(+)
 create mode 100755 tools/testing/module-unloading/endless_cat.sh
 create mode 100755 tools/testing/module-unloading/endless_mod.sh

diff --git a/tools/testing/module-unloading/endless_cat.sh b/tools/testing/module-unloading/endless_cat.sh
new file mode 100755
index 0000000..72e035c
--- /dev/null
+++ b/tools/testing/module-unloading/endless_cat.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+fatal() {
+	echo $1
+	exit 1
+}
+
+usage() {
+	echo "Usage: `basename $0` <file>"
+	echo "Where:"
+	echo " file: file to cat"
+}
+
+fatal_usage() {
+	usage
+	exit 1
+}
+
+if [ "x$1" = "x" ]; then
+	echo "Missing <file> paraemter."
+	fatal_usage
+fi
+if [ ! -f $1 ]; then
+	echo "$1 is not an accessible file."
+	fatal_usage
+fi
+
+while :
+do
+	cat $1
+	echo "-----------------------------------"
+done
diff --git a/tools/testing/module-unloading/endless_mod.sh b/tools/testing/module-unloading/endless_mod.sh
new file mode 100755
index 0000000..359b0c0
--- /dev/null
+++ b/tools/testing/module-unloading/endless_mod.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+fatal() {
+	echo $1
+	exit 1
+}
+
+usage() {
+	echo "Usage: `basename $0` [-t second] <module>"
+	echo "Where:"
+	echo " second: seconds to sleep between module actions"
+	echo " module: name of module to test"
+}
+
+fatal_usage() {
+	usage
+	exit 1
+}
+
+SLEEPSEC=10
+
+while getopts "t:" opt
+do
+	case $opt in
+	t) SLEEPSEC=$OPTARG;;
+	?) echo "Invalid argument $opt"
+	   fatal_usage;;
+	esac
+done
+shift $(($OPTIND - 1))
+
+if [ "x$1" = "x" ]; then
+	echo "Missing <module> paraemter."
+	fatal_usage
+fi
+
+find_module() {
+	curr_modules=`lsmod | cut -d " " -f1`
+
+	for m in $curr_modules; do
+		if [ "x$m" = "x$1" ]; then
+			return 0
+		fi
+	done
+	return 1
+}
+
+remove_module() {
+	while :
+	do
+		find_module $1
+		if [ $? -eq 0 ]; then
+			rmmod $1
+			echo "Removing $1 ..."
+		else
+			break
+		fi
+	done
+}
+
+insert_module() {
+	while :
+	do
+		find_module $1
+		if [ ! $? -eq 0 ]; then
+			modprobe $1
+			echo "Inserting $1 ..."
+		else
+			break
+		fi
+	done
+}
+
+while :
+do
+	echo "-----------------------------------"
+	insert_module $1
+	sleep $SLEEPSEC
+	remove_module $1
+	sleep $SLEEPSEC
+done
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ