diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index ac5576ed1308..22cbea832194 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -63,7 +63,8 @@ syzkaller28.sh WiP 20201120 syzkaller50.sh panic: Assertion done != job_total_nbytes failed at ... 20220405 syzkaller54.sh panic: td 0xfffffe014f7193a0 is not suspended 20220527 syzkaller55.sh panic: Counter goes negative 20220525 -timeout.sh Waiting for commit +syzkaller59.sh Page fault 20220625 +syzkaller60.sh Page fault 20220625 truss3.sh WiP 20200915 unionfs14.sh WiP 20220111 unionfs9.sh https://people.freebsd.org/~pho/stress/log/log0226.txt 20220111 diff --git a/tools/test/stress2/misc/syzkaller59.sh b/tools/test/stress2/misc/syzkaller59.sh new file mode 100755 index 000000000000..b628c25d3298 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller59.sh @@ -0,0 +1,154 @@ +#!/bin/sh + +# Fatal trap 12: page fault while in kernel mode +# cpuid = 8; apic id = 08 +# fault virtual address = 0x8 +# fault code = supervisor read data, page not present +# instruction pointer = 0x20:0xffffffff80b98b73 +# stack pointer = 0x0:0xfffffe06996fc700 +# frame pointer = 0x0:0xfffffe06996fc730 +# code segment = base 0x0, limit 0xfffff, type 0x1b +# = DPL 0, pres 1, long 1, def32 0, gran 1 +# processor eflags = interrupt enabled, resume, IOPL = 0 +# current process = 46538 (repro11) +# trap number = 12 +# panic: page fault +# cpuid = 8 +# time = 1655883715 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe06996fc4c0 +# vpanic() at vpanic+0x151/frame 0xfffffe06996fc510 +# panic() at panic+0x43/frame 0xfffffe06996fc570 +# trap_fatal() at trap_fatal+0x387/frame 0xfffffe06996fc5d0 +# trap_pfault() at trap_pfault+0xab/frame 0xfffffe06996fc630 +# calltrap() at calltrap+0x8/frame 0xfffffe06996fc630 +# --- trap 0xc, rip = 0xffffffff80b98b73, rsp = 0xfffffe06996fc700, rbp = 0xfffffe06996fc730 --- +# knlist_remove_kq() at knlist_remove_kq+0xa3/frame 0xfffffe06996fc730 +# kqueue_drain() at kqueue_drain+0x2c8/frame 0xfffffe06996fc770 +# kqueue_close() at kqueue_close+0x7e/frame 0xfffffe06996fc7b0 +# _fdrop() at _fdrop+0x1b/frame 0xfffffe06996fc7d0 +# closef() at closef+0x1db/frame 0xfffffe06996fc860 +# fdescfree() at fdescfree+0x433/frame 0xfffffe06996fc930 +# exit1() at exit1+0x4ef/frame 0xfffffe06996fc9a0 +# sigexit() at sigfce20 +# postsig() at postsig+0x1aa/frame 0xfffffe06996fcef0 +# ast() at ast+0x4fb/frame 0xfffffe06996fcf30 +# doreti_ast() at doreti_ast+0x1f/frame 0x821076840 +# KDB: enter: panic +# [ thread pid 46538 tid 356284 ] +# Stopped at kdb_enter+0x32: movq $0,0x129f1a3(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n256236-4f1d91e413d7e: Wed Jun 22 07:47:51 CEST 2022 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller59.c < + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; + } + } +} + +uint64_t r[1] = {0xffffffffffffffff}; + +void execute_one(void) +{ + intptr_t res = 0; + res = syscall(SYS_kqueue); + if (res != -1) + r[0] = res; + *(uint64_t*)0x20000140 = 0; + *(uint16_t*)0x20000148 = 0xfffa; + *(uint16_t*)0x2000014a = 0x4021; + *(uint32_t*)0x2000014c = 0; + *(uint64_t*)0x20000150 = 0; + *(uint64_t*)0x20000158 = 0; + *(uint64_t*)0x20000160 = 0; + *(uint64_t*)0x20000168 = 0; + *(uint64_t*)0x20000170 = 0; + *(uint64_t*)0x20000178 = 0; + syscall(SYS_kevent, r[0], 0x20000140ul, 1ul, 0ul, 0ul, 0ul); + syscall(SYS_rfork, 0x90030ul); +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + loop(); + return 0; +} +EOF +mycc -o /tmp/syzkaller59 -Wall -Wextra -O0 /tmp/syzkaller59.c || exit 1 + +(cd /tmp; timeout 3m ./syzkaller59) + +rm -rf /tmp/syzkaller59 /tmp/syzkaller59.c /tmp/syzkaller59.core \ + /tmp/syzkaller.?????? +exit 0 diff --git a/tools/test/stress2/misc/syzkaller60.sh b/tools/test/stress2/misc/syzkaller60.sh new file mode 100755 index 000000000000..cc93834152ae --- /dev/null +++ b/tools/test/stress2/misc/syzkaller60.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +# Fatal trap 12: page fault while in kernel mode +# cpuid = 5; apic id = 05 +# fault virtual address = 0x3e07d728 +# fault code = supervisor write data, page not present +# instruction pointer = 0x20:0xffffffff80c9ba1d +# stack pointer = 0x28:0xfffffe014d9ceba0 +# frame pointer = 0x28:0xfffffe014d9cec00 +# code segment = base 0x0, limit 0xfffff, type 0x1b +# = DPL 0, pres 1, long 1, def32 0, gran 1 +# processor eflags = interrupt enabled, resume, IOPL = 0 +# current process = 3135 (syzkaller60) +# trap number = 12 +# panic: page fault +# cpuid = 5 +# time = 1656134459 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe014d9ce960 +# vpanic() at vpanic+0x151/frame 0xfffffe014d9ce9b0 +# panic() at panic+0x43/frame 0xfffffe014d9cea10 +# trap_fatal() at trap_fatal+0x387/frame 0xfffffe014d9cea70 +# trap_pfault() at trap_pfault+0xab/frame 0xfffffe014d9cead0 +# calltrap() at calltrap+0x8/frame 0xfffffe014d9cead0 +# --- trap 0xc, rip = 0xffffffff80c9ba1d, rsp = 0xfffffe014d9ceba0, rbp = 0xfffffe014d9cec00 --- +# soclose() at soclose+0x1ad/frame 0xfffffe014d9cec00 +# _fdrop() at _fdrop+0x1b/frame 0xfffffe014d9cec20 +# closef() at closef+0x1db/frame 0xfffffe014d9cecb0 +# fdescfree() at fdescfree+0x433/frame 0xfffffe014d9ced80 +# exit1() at exit1+0x4ef/frame 0xfffffe014d9cedf0 +# sys_exit() at sys_exit+0xd/frame 0xfffffe014d9cee00 +# amd64_syscall() md64_syscall+0x145/frame 0xfffffe014d9cef30 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe014d9cef30 +# --- syscall (1, FreeBSD ELF64, sys_exit), rip = 0x82209fdca, rsp = 0x820fab718, rbp = 0x820fab730 --- +# KDB: enter: panic +# [ thread pid 3135 tid 100332 ] +# Stopped at kdb_enter+0x32: movq $0,0x129f1a3(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n256319-c11e64ce51308: Sat Jun 25 07:12:49 CEST 2022\012 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller60.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + res = syscall(SYS_socket, 0x1cul, 1ul, 0x84); + if (res != -1) + r[0] = res; + *(uint8_t*)0x20000000 = 0x1c; + *(uint8_t*)0x20000001 = 0x1c; + *(uint16_t*)0x20000002 = htobe16(0x4e22); + *(uint32_t*)0x20000004 = 0; + memset((void*)0x20000008, 0, 16); + *(uint32_t*)0x20000018 = 0; + syscall(SYS_bind, r[0], 0x20000000ul, 0x1cul); + syscall(SYS_listen, r[0], 0x40000); + res = syscall(SYS_socket, 0x1cul, 1ul, 0x84); + if (res != -1) + r[1] = res; + *(uint8_t*)0x20000180 = 0x1c; + *(uint8_t*)0x20000181 = 0x1c; + *(uint16_t*)0x20000182 = htobe16(0x4e22); + *(uint32_t*)0x20000184 = 0; + *(uint64_t*)0x20000188 = htobe64(0); + *(uint64_t*)0x20000190 = htobe64(1); + *(uint32_t*)0x20000198 = 0; + syscall(SYS_connect, r[1], 0x20000180ul, 0x1cul); + return 0; +} +EOF +mycc -o /tmp/syzkaller60 -Wall -Wextra -O0 /tmp/syzkaller60.c || exit 1 + +kldstat | grep -q sctp || { kldload sctp.ko && loaded=1; } +(cd /tmp; timeout 3m ./syzkaller60) + +rm -rf /tmp/syzkaller60 /tmp/syzkaller60.c /tmp/syzkaller60.core \ + /tmp/syzkaller.?????? +[ $loaded ] && kldunload sctp.ko +exit 0