Skip to contentSkip to conversation

Kselftest update for Linux 5.6-rc1

GIT PULL Merged Shuah Khan 2 participants 2 messages Jan 29, 2020

Subsystems (5)
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

Hi Linus,

Please pull the following Kselftest update for Linux 5.6-rc1

This Kselftest update for Linux 5.6-rc1 consists of several fixes to framework and individual tests. In addition, it enables LKDTM tests adding lkdtm target to kselftest Makefile.

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------
The following changes since commit c79f46a282390e0f5b306007bf7b11a46d529538:

Linux 5.5-rc5 (2020-01-05 14:23:27 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-5.6-rc1

for you to fetch changes up to af4ddd607dff7aabd466a4a878e01b9f592a75ab:

selftests/ftrace: fix glob selftest (2020-01-28 13:36:48 -0700)

----------------------------------------------------------------
linux-kselftest-5.6-rc1

This Kselftest update for Linux 5.6-rc1 consists of several fixes to framework and individual tests. In addition, it enables LKDTM tests adding lkdtm target to kselftest Makefile.

----------------------------------------------------------------
Cristian Marussi (1):
selftests: fix build behaviour on targets' failures

Dan Carpenter (1):
selftests: Uninitialized variable in test_cgcore_proc_migration()

Kees Cook (1):
selftests/lkdtm: Add tests for LKDTM targets

Matthieu Baerts (1):
selftests: settings: tests can be in subsubdirs

Miroslav Benes (2):
selftests/livepatch: Replace set_dynamic_debug() with
setup_config() in README
selftests/livepatch: Remove unused local variable in
set_ftrace_enabled()

Siddhesh Poyarekar (1):
kselftest: Minimise dependency of get_size on C library interfaces

Sven Schnelle (1):
selftests/ftrace: fix glob selftest

 MAINTAINERS                                        |  1 +
 tools/testing/selftests/Makefile                   | 19 +++--
 tools/testing/selftests/cgroup/test_core.c         |  2 +-
 .../ftrace/test.d/ftrace/func-filter-glob.tc       |  2 +-
 tools/testing/selftests/kselftest/runner.sh        |  2 +-
 tools/testing/selftests/livepatch/README           |  2 +-
 tools/testing/selftests/livepatch/functions.sh     |  1 -
 tools/testing/selftests/lkdtm/Makefile             | 12 +++
 tools/testing/selftests/lkdtm/config               |  1 +
 tools/testing/selftests/lkdtm/run.sh               | 92 
++++++++++++++++++++++
 tools/testing/selftests/lkdtm/tests.txt            | 71 +++++++++++++++++
 tools/testing/selftests/size/get_size.c            | 24 ++++--
 12 files changed, 211 insertions(+), 18 deletions(-)
 create mode 100644 tools/testing/selftests/lkdtm/Makefile
 create mode 100644 tools/testing/selftests/lkdtm/config
 create mode 100755 tools/testing/selftests/lkdtm/run.sh
 create mode 100644 tools/testing/selftests/lkdtm/tests.txt

----------------------------------------------------------------

MAINTAINERS +1 -0
index 8982c6e013b3..0587fcc197c8 100644
@@ -9581,6 +9581,7 @@ LINUX KERNEL DUMP TEST MODULE (LKDTM)
 M:	Kees Cook <[email protected]>
 S:	Maintained
 F:	drivers/misc/lkdtm/*
+F:	tools/testing/selftests/lkdtm/*
 
 LINUX KERNEL MEMORY CONSISTENCY MODEL (LKMM)
 M:	Alan Stern <[email protected]>
tools/testing/selftests/Makefile +12 -7
index b001c602414b..5182d6078cbc 100644
@@ -26,6 +26,7 @@ TARGETS += kexec
 TARGETS += kvm
 TARGETS += lib
 TARGETS += livepatch
+TARGETS += lkdtm
 TARGETS += membarrier
 TARGETS += memfd
 TARGETS += memory-hotplug
@@ -143,11 +144,13 @@ else
 endif
 
 all: khdr
-	@for TARGET in $(TARGETS); do		\
-		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		mkdir $$BUILD_TARGET  -p;	\
-		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
-	done;
+	@ret=1;							\
+	for TARGET in $(TARGETS); do				\
+		BUILD_TARGET=$$BUILD/$$TARGET;			\
+		mkdir $$BUILD_TARGET  -p;			\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;	\
+		ret=$$((ret * $$?));				\
+	done; exit $$ret;
 
 run_tests: all
 	@for TARGET in $(TARGETS); do \
@@ -196,10 +199,12 @@ ifdef INSTALL_PATH
 	install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
 	install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
 	install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
-	@for TARGET in $(TARGETS); do \
+	@ret=1;	\
+	for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
-	done;
+		ret=$$((ret * $$?));		\
+	done; exit $$ret;
 
 	@# Ask all targets to emit their test scripts
 	echo "#!/bin/sh" > $(ALL_SCRIPT)
tools/testing/selftests/cgroup/test_core.c +1 -1
index c5ca669feb2b..e19ce940cd6a 100644
@@ -369,7 +369,7 @@ static void *dummy_thread_fn(void *arg)
 static int test_cgcore_proc_migration(const char *root)
 {
 	int ret = KSFT_FAIL;
-	int t, c_threads, n_threads = 13;
+	int t, c_threads = 0, n_threads = 13;
 	char *src = NULL, *dst = NULL;
 	pthread_t threads[n_threads];
 
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +1 -1
index 27a54a17da65..f4e92afab14b 100644
@@ -30,7 +30,7 @@ ftrace_filter_check '*schedule*' '^.*schedule.*$'
 ftrace_filter_check 'schedule*' '^schedule.*$'
 
 # filter by *mid*end
-ftrace_filter_check '*aw*lock' '.*aw.*lock$'
+ftrace_filter_check '*pin*lock' '.*pin.*lock$'
 
 # filter by start*mid*
 ftrace_filter_check 'mutex*try*' '^mutex.*try.*'
tools/testing/selftests/kselftest/runner.sh +1 -1
index a8d20cbb711c..e84d901f8567 100644
@@ -91,7 +91,7 @@ run_one()
 run_many()
 {
 	echo "TAP version 13"
-	DIR=$(basename "$PWD")
+	DIR="${PWD#${BASE_DIR}/}"
 	test_num=0
 	total=$(echo "$@" | wc -w)
 	echo "1..$total"
tools/testing/selftests/livepatch/README +1 -1
index b73cd0e2dd51..621d325425c2 100644
@@ -35,7 +35,7 @@ Adding tests
 ------------
 
 See the common functions.sh file for the existing collection of utility
-functions, most importantly set_dynamic_debug() and check_result().  The
+functions, most importantly setup_config() and check_result().  The
 latter function greps the kernel's ring buffer for "livepatch:" and
 "test_klp" strings, so tests be sure to include one of those strings for
 result comparison.  Other utility functions include general module
tools/testing/selftests/livepatch/functions.sh +0 -1
index a6e3d5517a6f..2aab9791791d 100644
@@ -64,7 +64,6 @@ function set_dynamic_debug() {
 }
 
 function set_ftrace_enabled() {
-	local sysctl="$1"
 	result=$(sysctl kernel.ftrace_enabled="$1" 2>&1 | paste --serial --delimiters=' ')
 	echo "livepatch: $result" > /dev/kmsg
 }
tools/testing/selftests/lkdtm/Makefile new file +12 -0
new file mode 100644
index 000000000000..1bcc9ee990eb
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for LKDTM regression tests
+
+include ../lib.mk
+
+# NOTE: $(OUTPUT) won't get default value if used before lib.mk
+TEST_FILES := tests.txt
+TEST_GEN_PROGS = $(patsubst %,$(OUTPUT)/%.sh,$(shell awk '{print $$1}' tests.txt | sed -e 's/\#//'))
+all: $(TEST_GEN_PROGS)
+
+$(OUTPUT)/%: run.sh tests.txt
+	install -m 0744 run.sh $@
tools/testing/selftests/lkdtm/config new file +1 -0
new file mode 100644
index 000000000000..d874990e442b
@@ -0,0 +1 @@
+CONFIG_LKDTM=y
tools/testing/selftests/lkdtm/run.sh new file +92 -0

92 lines not on this page · raw message

tools/testing/selftests/lkdtm/tests.txt new file +71 -0

71 lines not on this page · raw message

tools/testing/selftests/size/get_size.c +18 -6
index 2ad45b944355..2980b1a63366 100644
@@ -11,23 +11,35 @@
  * own execution.  It also attempts to have as few dependencies
  * on kernel features as possible.
  *
- * It should be statically linked, with startup libs avoided.
- * It uses no library calls, and only the following 3 syscalls:
+ * It should be statically linked, with startup libs avoided.  It uses
+ * no library calls except the syscall() function for the following 3
+ * syscalls:
  *   sysinfo(), write(), and _exit()
  *
  * For output, it avoids printf (which in some C libraries
  * has large external dependencies) by  implementing it's own
  * number output and print routines, and using __builtin_strlen()
+ *
+ * The test may crash if any of the above syscalls fails because in some
+ * libc implementations (e.g. the GNU C Library) errno is saved in
+ * thread-local storage, which does not get initialized due to avoiding
+ * startup libs.
  */
 
 #include <sys/sysinfo.h>
 #include <unistd.h>
+#include <sys/syscall.h>
 
 #define STDOUT_FILENO 1
 
 static int print(const char *s)
 {
-	return write(STDOUT_FILENO, s, __builtin_strlen(s));
+	size_t len = 0;
+
+	while (s[len] != '\0')
+		len++;
+
+	return syscall(SYS_write, STDOUT_FILENO, s, len);
 }
 
 static inline char *num_to_str(unsigned long num, char *buf, int len)
@@ -79,12 +91,12 @@ void _start(void)
 	print("TAP version 13\n");
 	print("# Testing system size.\n");
 
-	ccode = sysinfo(&info);
+	ccode = syscall(SYS_sysinfo, &info);
 	if (ccode < 0) {
 		print("not ok 1");
 		print(test_name);
 		print(" ---\n reason: \"could not get sysinfo\"\n ...\n");
-		_exit(ccode);
+		syscall(SYS_exit, ccode);
 	}
 	print("ok 1");
 	print(test_name);
@@ -100,5 +112,5 @@ void _start(void)
 	print(" ...\n");
 	print("1..1\n");
 
-	_exit(0);
+	syscall(SYS_exit, 0);
 }
merge bot Merged
#1 lore raw
The pull request you sent on Wed, 29 Jan 2020 08:44:48 -0700:

The pull request you sent on Wed, 29 Jan 2020 08:44:48 -0700:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-5.6-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ce7ae9d9fe4391413db680ce0732da2144b6f4a3

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker