Skip to contentSkip to conversation

selftests/lkdtm: Add tests for LKDTM targets

PATCH New Kees Cook 1 participant 1 message Jan 10, 2020

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v3 1/1 selftests/lkdtm: Add tests for LKDTM targets

This adds a basic framework for running all the "safe" LKDTM tests. This will allow easy introspection into any selftest logs to examine the results of most LKDTM tests.

---
v3: replace open-coded "4" with $KSELFTEST_SKIP_TEXT (shuah), add DOUBLE_FAULT
v2: https://lore.kernel.org/lkml/201912301453.19D686EE6@keescook
v1: https://lore.kernel.org/lkml/201905091013.E228F0F0BE@keescook

---
 MAINTAINERS                             |  1 +
 tools/testing/selftests/Makefile        |  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 +++++++++++++++++++
 6 files changed, 178 insertions(+)
 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 cc0a4a8ae06a..eacc00c6cfd5 100644
@@ -9578,6 +9578,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 +1 -0
index b001c602414b..f0b02a12ba39 100644
@@ -26,6 +26,7 @@ TARGETS += kexec
 TARGETS += kvm
 TARGETS += lib
 TARGETS += livepatch
+TARGETS += lkdtm
 TARGETS += membarrier
 TARGETS += memfd
 TARGETS += memory-hotplug
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

Signature · 5 lines
2.20.1


-- 
Kees Cook