Skip to contentSkip to conversation

Wrapper for Syzkaller reproducers

PATCH New Richard Palethorpe 3 participants 3 messages Jun 10, 2020 – Jun 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Wrapper for Syzkaller reproducers

Allows one to run the Syzkaller reproducers as part of the LTP.

---

V4:
+ Remove space in Makefile x86 check
+ Modify and add to README

 .gitmodules                                  |   4 +
 configure.ac                                 |  12 ++
 include/mk/features.mk.in                    |   2 +
 runtest/.gitignore                           |   1 +
 testcases/kernel/Makefile                    |   1 +
 testcases/kernel/syzkaller-repros/.gitignore |   1 +
 testcases/kernel/syzkaller-repros/Makefile   | 105 +++++++++++++++
 testcases/kernel/syzkaller-repros/README.md  |  70 ++++++++++
 testcases/kernel/syzkaller-repros/syzwrap.c  | 134 +++++++++++++++++++
 testcases/linux-arts                         |   1 +
 10 files changed, 331 insertions(+)
 create mode 100644 runtest/.gitignore
 create mode 100644 testcases/kernel/syzkaller-repros/.gitignore
 create mode 100644 testcases/kernel/syzkaller-repros/Makefile
 create mode 100644 testcases/kernel/syzkaller-repros/README.md
 create mode 100644 testcases/kernel/syzkaller-repros/syzwrap.c
 create mode 160000 testcases/linux-arts
.gitmodules +4 -0
index 1c9e9c38a..2b9e836e6 100644
@@ -1,3 +1,7 @@
 [submodule "testcases/kernel/mce-test"]
 	path = testcases/kernel/mce-test
 	url = git://git.kernel.org/pub/scm/linux/kernel/git/gong.chen/mce-test.git
+[submodule "testcases/linux-arts"]
+	path = testcases/linux-arts
+	url = https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-arts.git
+	shallow = true
configure.ac +12 -0
index 1d3ea58d0..20293040b 100644
@@ -271,6 +271,18 @@ else
     AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["no"])
 fi
 
+AC_ARG_WITH([syzkaller-repros],
+  [AC_HELP_STRING([--with-syzkaller-repros],
+    [compile and install Syzkaller reproducers (default=no)])],
+  [with_syzkaller_repros=$withval],
+  [with_syzkaller_repros=no]
+)
+if test "x$with_syzkaller_repros" = xyes; then
+    AC_SUBST([WITH_SYZKALLER_REPROS],["yes"])
+else
+    AC_SUBST([WITH_SYZKALLER_REPROS],["no"])
+fi
+
 # TODO: testcases/realtime requires bash and python.
 AC_ARG_WITH([realtime-testsuite],
   [AC_HELP_STRING([--with-realtime-testsuite],
include/mk/features.mk.in +2 -0
index 8e561b738..3ab7f4721 100644
@@ -47,3 +47,5 @@ WITH_REALTIME_TESTSUITE		:= no
 else
 WITH_REALTIME_TESTSUITE		:= @WITH_REALTIME_TESTSUITE@
 endif
+
+WITH_SYZKALLER_REPROS		:= @WITH_SYZKALLER_REPROS@
runtest/.gitignore new file +1 -0
new file mode 100644
index 000000000..2ae05bfac
@@ -0,0 +1 @@
+syzkaller*
testcases/kernel/Makefile +1 -0
index 3319b3163..0150cfb4f 100644
@@ -53,6 +53,7 @@ SUBDIRS			+= connectors \
 			   sched \
 			   security \
 			   sound \
+			   syzkaller-repros \
 			   tracing \
 			   uevents \
 
testcases/kernel/syzkaller-repros/.gitignore new file +1 -0
new file mode 100644
index 000000000..dbda1c71f
@@ -0,0 +1 @@
+syzwrap
testcases/kernel/syzkaller-repros/Makefile new file +105 -0

105 lines not on this page · raw message

testcases/kernel/syzkaller-repros/README.md new file +70 -0

70 lines not on this page · raw message

testcases/kernel/syzkaller-repros/syzwrap.c new file +134 -0

134 lines not on this page · raw message

testcases/linux-arts new file +1 -0
new file mode 160000
index 000000000..e39dd3846
@@ -0,0 +1 @@
+Subproject commit e39dd38466d956a7a9b6c061163cba783cf09b2e
Signature · 1 line
2.26.2
#1 lore raw

PATCH v4 1/1 Wrapper for Syzkaller reproducers

Quoted 5 lines · Richard Palethorpe

Allows one to run the Syzkaller reproducers as part of the LTP.

+

testcases/kernel/syzkaller-repros/syzwrap.c line 63

Quoted 4 lines
testcases/kernel/syzkaller-repros/syzwrap.c new file +3 -0
+static void setup(void)
+{
+       tst_taint_init(TST_TAINT_W | TST_TAINT_D | TST_TAINT_L);

My only concern is that the limitation is too strict for syzkaller.

Because if one of the tests (near the top of the name rankings) trigger a WARNING in SUT kernel, the syzwrap.c will be skipping all remaining test cases.

Maybe we can just use 'TST_TAINT_D' here, and I wish to hear more opinions from others.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200615/25a83f68/attachment.htm>
#2 lore raw

PATCH v4 1/1 Wrapper for Syzkaller reproducers

Hello Li,

Quoted 9 lines · Li Wang
Quoted 5 lines · Richard Palethorpe

Allows one to run the Syzkaller reproducers as part of the LTP.

Thanks!

Quoted 9 lines

+

testcases/kernel/syzkaller-repros/syzwrap.c line 63

Quoted 4 lines
testcases/kernel/syzkaller-repros/syzwrap.c new file +3 -0
+static void setup(void)
+{
+       tst_taint_init(TST_TAINT_W | TST_TAINT_D | TST_TAINT_L);

My only concern is that the limitation is too strict for syzkaller.

Quoted 10 lines

Because if one of the tests (near the top of the name rankings) trigger a WARNING in SUT kernel, the syzwrap.c will be skipping all remaining test cases.

Maybe we can just use 'TST_TAINT_D' here, and I wish to hear more opinions from others.

Signature · 2 lines
Regards,
Li Wang

You should restart/reset the SUT if the kernel is tainted. Please see the README section on test runner requirements.

It might even be best to panic on warn instead of relying on syzwrap or the test runner detecting the taint.

So far I have found enough warnings are caused by bugs that you can't reliably continue testing afterwards.

OTOH the LTP library should maybe provide some args to override taints, but that is not specific to syzwrap.

Signature · 2 lines
Thank you,
Richard.