The branch main has been updated by pho:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=afce58357164f68caa62b541edcbf87a3c2cb901

commit afce58357164f68caa62b541edcbf87a3c2cb901
Author:     Peter Holm <p...@freebsd.org>
AuthorDate: 2021-06-15 05:33:58 +0000
Commit:     Peter Holm <p...@freebsd.org>
CommitDate: 2021-06-15 05:33:58 +0000

    stress2: Added a new verified syzkaller reproducer, update the exclude list 
and remove a few syscalls from the ignore list
---
 tools/test/stress2/misc/all.exclude    |   2 +
 tools/test/stress2/misc/syscall4.sh    |   3 -
 tools/test/stress2/misc/syzkaller42.sh | 124 +++++++++++++++++++++++++++++++++
 3 files changed, 126 insertions(+), 3 deletions(-)

diff --git a/tools/test/stress2/misc/all.exclude 
b/tools/test/stress2/misc/all.exclude
index 833e4fb0dbd3..9b33cf1a1f23 100644
--- a/tools/test/stress2/misc/all.exclude
+++ b/tools/test/stress2/misc/all.exclude
@@ -56,6 +56,7 @@ swapoff5.sh           log0005.txt, known issue                
                        20210111
 systrace.sh            WiP                                                     
        20200227
 systrace2.sh           WiP                                                     
        20200227
 syzkaller11.sh         WiP                                                     
        20200721
+syzkaller15.sh         WiP                                                     
        20200712
 syzkaller19.sh         WiP                                                     
        20200712
 syzkaller25.sh         WiP                                                     
        20201116
 syzkaller28.sh         WiP                                                     
        20201120
@@ -67,6 +68,7 @@ syzkaller33.sh                Fatal trap 18: integer divide 
fault while in kernel mode        2021041
 syzkaller39.sh         WiP                                                     
        20210607
 syzkaller40.sh         WiP                                                     
        20210607
 syzkaller41.sh         WiP                                                     
        20210607
+syzkaller42.sh         WiP                                                     
        20210613
 truss3.sh              WiP                                                     
        20200915
 unionfs.sh             insmntque: non-locked vp: xx is not exclusive locked... 
        20130909
 unionfs2.sh            insmntque: mp-safe fs and non-locked vp is not ...      
        20111219
diff --git a/tools/test/stress2/misc/syscall4.sh 
b/tools/test/stress2/misc/syscall4.sh
index 824089760ba7..209a00f7af9b 100755
--- a/tools/test/stress2/misc/syscall4.sh
+++ b/tools/test/stress2/misc/syscall4.sh
@@ -141,10 +141,7 @@ static int ignore[] = {
        SYS___syscall,
        216,                    /* custom syscall */
        SYS_rfork,
-       SYS_sigsuspend,
        SYS_mac_syscall,
-       SYS_sigtimedwait,
-       SYS_sigwaitinfo,
 };
 
 static int fd[900], fds[2], kq, socketpr[2];
diff --git a/tools/test/stress2/misc/syzkaller42.sh 
b/tools/test/stress2/misc/syzkaller42.sh
new file mode 100755
index 000000000000..07425e4b8731
--- /dev/null
+++ b/tools/test/stress2/misc/syzkaller42.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+[ `uname -p` != "amd64" ] && exit 0
+[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
+
+# panic: Assertion lock == sq->sq_lock failed at 
../../../kern/subr_sleepqueue.c:371
+# cpuid = 1
+# time = 1623487895
+# KDB: stack backtrace:
+# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfffffe06c14b4700
+# vpanic() at vpanic+0x181/frame 0xfffffe06c14b4750
+# panic() at panic+0x43/frame 0xfffffe06c14b47b0
+# sleepq_add() at sleepq_add+0x3e6/frame 0xfffffe06c14b4800
+# _sleep() at _sleep+0x20e/frame 0xfffffe06c14b48b0
+# kern_sigtimedwait() at kern_sigtimedwait+0x532/frame 0xfffffe06c14b4a20
+# sys_sigwaitinfo() at sys_sigwaitinfo+0x43/frame 0xfffffe06c14b4ac0
+# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe06c14b4bf0
+# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe06c14b4bf0
+# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x8003af5fa, rsp = 
0x7fffffffe5f8, rbp = 0x7fffffffe610 ---
+# KDB: enter: panic
+# [ thread pid 15370 tid 356127 ]
+# Stopped at      kdb_enter+0x37: movq    $0,0x1285b4e(%rip)
+# db> x/s version
+# version: FreeBSD 14.0-CURRENT #0 main-n247326-2349cda44fea: Sat Jun 12 
03:57:33 CEST 2021
+# p...@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO
+# db> 
+
+. ../default.cfg
+cat > /tmp/syzkaller42.c <<EOF
+// 
https://syzkaller.appspot.com/bug?id=b12f0c4dc1e73c25636e4c4d4787209d155cca0a
+// autogenerated by syzkaller (https://github.com/google/syzkaller)
+// Reported-by: syzbot+1d89fc2a9ef92ef64...@syzkaller.appspotmail.com
+
+#define _GNU_SOURCE
+
+#include <sys/types.h>
+
+#include <pwd.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/endian.h>
+#include <sys/syscall.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+
+static void kill_and_wait(int pid, int* status)
+{
+  kill(pid, SIGKILL);
+  while (waitpid(-1, status, 0) != pid) {
+  }
+}
+
+static void sleep_ms(uint64_t ms)
+{
+  usleep(ms * 1000);
+}
+
+static uint64_t current_time_ms(void)
+{
+  struct timespec ts;
+  if (clock_gettime(CLOCK_MONOTONIC, &ts))
+    exit(1);
+  return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
+}
+
+static void execute_one(void);
+
+#define WAIT_FLAGS 0
+
+static void loop(void)
+{
+  int iter = 0;
+  for (;; iter++) {
+    int pid = fork();
+    if (pid < 0)
+      exit(1);
+    if (pid == 0) {
+      execute_one();
+      exit(0);
+    }
+    int status = 0;
+    uint64_t start = current_time_ms();
+    for (;;) {
+      if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
+        break;
+      sleep_ms(1);
+      if (current_time_ms() - start < 5000) {
+        continue;
+      }
+      kill_and_wait(pid, &status);
+      break;
+    }
+  }
+}
+
+void execute_one(void)
+{
+  syscall(SYS_rfork, 0x14034ul);
+  *(uint32_t*)0x20000140 = 0x80000002;
+  *(uint32_t*)0x20000144 = 0xfffffff7;
+  *(uint32_t*)0x20000148 = 0x41;
+  *(uint32_t*)0x2000014c = 3;
+  syscall(SYS_sigwaitinfo, 0x20000140ul, 0ul);
+}
+int main(void)
+{
+  syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul);
+  loop();
+  return 0;
+}
+EOF
+mycc -o /tmp/syzkaller42 -Wall -Wextra -O0 /tmp/syzkaller42.c -lpthread ||
+    exit 1
+
+(cd /tmp; timeout 3m ./syzkaller42)
+
+rm -rf /tmp/syzkaller42 syzkaller42.c /tmp/syzkaller.*
+exit 0
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to