From nobody Sat Jun 25 06:40:49 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C2F6186ADD4; Sat, 25 Jun 2022 06:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LVPWj50DYz4lMs; Sat, 25 Jun 2022 06:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656139249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aPQ5HsgpTm+e/j+kYH+pXzcTlXjjc+9H4LrFiP5FDX0=; b=yL57OxTSo39JJqhKeRXs8m32plLCdCzhi3mbTJEVOeJOIN6wA+in8CoqMj9fVrI+uRHtAy y50fJoD3VgrHzlhA8RBjUQmta0/SFBSH+OxNSANun/LPMq4D0lHEO2pER1kXiG9xWG7ETC nVCx4Kx2iKr92oWKIzmdOx/Ni69PHdlWPGW0xgNuoBHJQ6MWF3WxWbk7Tml3P1WEpUqk/u bOeB2jW89GuotWFJPF4c1oPW4mYyD84JZ52o4AZ5gWsxqikUm2UAuktplvNZzeLk1FBIZC yHsGBH4mRVQeSC6VvsNz2c0kSDTyI8T5JZ+Ilk4M/ZeShZjQCee3qfQSu4D8Sw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C85E1F8A4; Sat, 25 Jun 2022 06:40:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25P6ensw091858; Sat, 25 Jun 2022 06:40:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25P6enYi091857; Sat, 25 Jun 2022 06:40:49 GMT (envelope-from git) Date: Sat, 25 Jun 2022 06:40:49 GMT Message-Id: <202206250640.25P6enYi091857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: e3b31e23ffdf - main - stress2: Added two syzkaller reproducers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3b31e23ffdf009d41a7f74ba76271f1307f44e2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656139249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aPQ5HsgpTm+e/j+kYH+pXzcTlXjjc+9H4LrFiP5FDX0=; b=U3VOifrcKctKATlQq3xKBjRFMhHAk3+J3w9681TTXJ2K4Z8K658yrlL6+6siJukCCJN1aD 6N22Y4WDiL6QVZU+GHiZxl04qD1N1sDA7kCRFvEz3XoOQASAOtFCXC13xK9fOZFjzS8JIy J5ULPasDu7rPWMDFNuaPzrxHnTly01YNKPbh9IJdacGCwZyFzZ9h+0JlWWAEjywJ/lYhqR may1yN1toUYGJ22FqZe+HA0TohKq9S+1qRLbUobz9aDogUCHjIpIU6cIcgybIPsGIlg/C9 FlWJuxwVL2fe22j+l/VZ5wAn35mvnGJ+VAMaEQEzphuXNMDSyR722+nxIySgcg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656139249; a=rsa-sha256; cv=none; b=G4sRlG8R9F2O8ONBBtuXXGIF88bMwm2OA8P4Yr7tmTrr2gqasGXncNW5zm3MhwLxbGXT0u QnRMXdveUnx5m+qQKuFDFFTqEh9gPDYV9JWNt/4lCUibOxcito3DQzsFCU2fEi2CXtfyVt dvN5G6MCyOlT+X2qUSmxnlbIfblgZwS33JxbmCjUdvdn4QMgUs+u+78pdmot4UU3VnF11u XaZ5722ORQ2tRh8gJkvRyI53EX529K2QQeg3dOjhSq2/tLQWu3hBcsS83cYkj89xbUyoLv /pemDJydDyLv+KBMBQfQ57uxOjT/LJAhctnlkjJbxcirXlsm2zOFXJsIcudV9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b31e23ffdf009d41a7f74ba76271f1307f44e2 commit e3b31e23ffdf009d41a7f74ba76271f1307f44e2 Author: Peter Holm AuthorDate: 2022-06-25 06:40:20 +0000 Commit: Peter Holm CommitDate: 2022-06-25 06:40:20 +0000 stress2: Added two syzkaller reproducers --- tools/test/stress2/misc/all.exclude | 3 +- tools/test/stress2/misc/syzkaller59.sh | 154 +++++++++++++++++++++++++++++++++ tools/test/stress2/misc/syzkaller60.sh | 103 ++++++++++++++++++++++ 3 files changed, 259 insertions(+), 1 deletion(-) 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