From owner-svn-src-user@freebsd.org Sun Apr 12 05:57:08 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B512A2B3622 for ; Sun, 12 Apr 2020 05:57:08 +0000 (UTC) (envelope-from pho@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490LcN4p5kz4fyR; Sun, 12 Apr 2020 05:57:08 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84DCE24B5F; Sun, 12 Apr 2020 05:57:08 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03C5v8JN099627; Sun, 12 Apr 2020 05:57:08 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03C5v8Hl099624; Sun, 12 Apr 2020 05:57:08 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202004120557.03C5v8Hl099624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 12 Apr 2020 05:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r359819 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 359819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 05:57:08 -0000 Author: pho Date: Sun Apr 12 05:57:07 2020 New Revision: 359819 URL: https://svnweb.freebsd.org/changeset/base/359819 Log: Added more sendfile() regression tests. Added: user/pho/stress2/misc/sendfile18.sh (contents, props changed) user/pho/stress2/misc/sendfile19.sh (contents, props changed) user/pho/stress2/misc/sendfile20.sh (contents, props changed) Added: user/pho/stress2/misc/sendfile18.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/sendfile18.sh Sun Apr 12 05:57:07 2020 (r359819) @@ -0,0 +1,126 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 Mark Johnston +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "Fatal trap 9: general protection fault while in kernel mode" seen: +# https://people.freebsd.org/~pho/stress/log/sendfile15-4.txt + +# Mark wrote: +# It took me some time but I managed to get a repro. Here is what I did: +# - Create a malloc-backed md(4) device with a UFS filesystem. Configure +# a gnop provider with -q 100 -d 10, i.e., always delay reads by 10ms. +# - Write a small file (e.g., 4KB) to the filesystem. +# - In a loop, unmount the filesystem, mount it, and run the test program. +# The test program: +# - creates a PF_LOCAL socket pair , +# - opens the input file, +# - sends the file over s1, +# - closes s1, +# - sleeps for a second before exiting (and closing s2) +# +# Using a separate filesystem ensures that the input file is not cached +# when the test program runs, so sendfile will perform an async getpages +# and place the "future" mbufs in s2's receive buffer. The gnop delay +# ensures that the I/O request will not be completed before s1 is closed, +# and because s1 is closed uipc_ready() will free the promised mbufs and +# return ECONNRESET. Because of the sleep, s2's receive buffer will not +# be scanned until after the uipc_ready() call. + +# Fixed by r359778 + +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 +kldstat | grep -q geom_nop || { gnop load 2>/dev/null || exit 0 && + notloaded=1; } +gnop status || exit 1 + +. ../default.cfg + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/sendfile18.c +mycc -o sendfile18 -Wall -Wextra -O0 -g sendfile18.c || exit 1 +rm -f sendfile18.c +cd $odir + +set -e +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart + +mdconfig -a -t swap -s 2g -u $mdstart +gnop create /dev/md$mdstart +newfs $newfs_flags /dev/md$mdstart.nop > /dev/null +mount /dev/md$mdstart.nop $mntpoint +chmod 777 $mntpoint +gnop configure -q 100 -d 10 /dev/md$mdstart.nop +set +e + +dd if=/dev/zero of=$mntpoint/file bs=4k count=1 status=none + +start=`date +%s` +while [ $((`date +%s` - start)) -lt 5 ]; do + umount $mntpoint + mount /dev/md$mdstart.nop $mntpoint + /tmp/sendfile18 $mntpoint/file +done +umount $mntpoint + +gnop destroy /dev/md$mdstart.nop +mdconfig -d -u $mdstart +[ $notloaded ] && gnop unload + +exit 0 +EOF +#include + +#include +#include +#include +#include + +int +main(int argc __unused, char **argv) +{ + int fd, sd[2]; + + if (socketpair(PF_LOCAL, SOCK_STREAM, 0, sd) != 0) + err(1, "socketpair"); + + fd = open(argv[1], O_RDONLY | O_DIRECT); + if (fd < 0) + err(1, "open"); + + if (sendfile(fd, sd[0], 0, 4096, NULL, NULL, 0) != 0) + err(1, "sendfile"); + close(sd[0]); + sleep(1); + + return (0); +} Added: user/pho/stress2/misc/sendfile19.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/sendfile19.sh Sun Apr 12 05:57:07 2020 (r359819) @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "panic: Memory modified after free" seen: +# https://people.freebsd.org/~pho/stress/log/sendfile19.txt +# Broken by r358995-r359002 +# Fixed by r359778 + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ -z "$nfs_export" ] && exit 0 +ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || + exit 0 + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > sendfile19.c +mycc -o sendfile19 -Wall sendfile19.c -pthread || exit 1 +rm -f sendfile19.c + +(cd $odir/../testcases/swap; ./swap -t 5m -i 20 -l 100) & +sleep 5 +mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint + +cd $mntpoint +parallel=1000 +for i in `jot $parallel`; do + size=`jot -r 1 1 $((2 * 1024 * 1024))` + dd if=/dev/zero of=input.$i bs=$size count=1 status=none +done +cd $odir +while mount | grep "$mntpoint " | grep -q nfs; do + umount -f $mntpoint +done +sleep 1 +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint +spid=$! +cd $mntpoint +pids= +for i in `jot $parallel`; do + /tmp/sendfile19 input.$i output.$i 1234$i & + pids="$pids $!" +done +for p in $pids; do + wait $p +done +for i in `jot $parallel`; do + rm -f input.$i output.$i +done +while pkill swap; do :; done +wait $spid + +cd $odir +umount $mntpoint +while mount | grep "$mntpoint " | grep -q nfs; do + umount -f $mntpoint +done +rm -f /tmp/sendfile19 +exit 0 +EOF +/* Slightly modified scenario from sendfile.sh */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int port; +char *inputFile; +char *outputFile; +int bufsize = 4096; + +static void +reader(void) { + int tcpsock, msgsock; + int on; + socklen_t len; + struct sockaddr_in inetaddr, inetpeer; + int n, t, *buf, fd; + + on = 1; + if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(1, "socket(), %s:%d", __FILE__, __LINE__); + + if (setsockopt(tcpsock, + SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) + err(1, "setsockopt(), %s:%d", __FILE__, __LINE__); + + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(port); + inetaddr.sin_len = sizeof(inetaddr); + + if (bind(tcpsock, + (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) + err(1, "bind(), %s:%d", __FILE__, __LINE__); + + if (listen(tcpsock, 5) < 0) + err(1, "listen(), %s:%d", __FILE__, __LINE__); + + len = sizeof(inetpeer); + if ((msgsock = accept(tcpsock, + (struct sockaddr *)&inetpeer, &len)) < 0) + err(1, "accept(), %s:%d", __FILE__, __LINE__); + + t = 0; + if ((buf = malloc(bufsize)) == NULL) + err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); + + if ((fd = open(outputFile, O_RDWR | O_CREAT | O_TRUNC, 0640)) == -1) + err(1, "open(%s)", outputFile); + + for (;;) { + if ((n = read(msgsock, buf, bufsize)) < 0) + err(1, "read(), %s:%d", __FILE__, __LINE__); + t += n; + if (n == 0) + break; + + if ((write(fd, buf, n)) != n) + err(1, "write"); + } + close(msgsock); + close(fd); + return; +} + +static void +writer(void) { + int tcpsock, on; + struct sockaddr_in inetaddr; + struct hostent *hostent; + struct stat statb; + int i, r, fd; + off_t off = 0; +#if 1 + size_t size; +#endif + + on = 1; + for (i = 1; i < 5; i++) { + if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(1, "socket(), %s:%d", __FILE__, __LINE__); + + if (setsockopt(tcpsock, + SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) + err(1, "setsockopt(), %s:%d", __FILE__, __LINE__); + +#if 1 /* livelock trigger */ + size = getpagesize() -4; + if (setsockopt(tcpsock, SOL_SOCKET, SO_SNDBUF, (void *)&size, + sizeof(size)) < 0) + err(1, "setsockopt(SO_SNDBUF), %s:%d", + __FILE__, __LINE__); +#endif + + hostent = gethostbyname ("localhost"); + memcpy (&inetaddr.sin_addr.s_addr, hostent->h_addr, + sizeof (struct in_addr)); + + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(port); + inetaddr.sin_len = sizeof(inetaddr); + + r = connect(tcpsock, (struct sockaddr *) &inetaddr, + sizeof(inetaddr)); + if (r == 0) + break; + sleep(1); + close(tcpsock); + } + if (r < 0) + err(1, "connect(), %s:%d", __FILE__, __LINE__); + + if (stat(inputFile, &statb) != 0) + err(1, "stat(%s)", inputFile); + + if ((fd = open(inputFile, O_RDONLY)) == -1) + err(1, "open(%s)", inputFile); + + if (sendfile(fd, tcpsock, 0, statb.st_size, NULL, &off, SF_NOCACHE) == -1) + err(1, "sendfile"); + + return; +} + +int +main(int argc, char **argv) +{ + pid_t pid; + + if (argc != 4) { + fprintf(stderr, "Usage: %s 0) { + reader(); + kill(pid, SIGINT); + } else + err(1, "fork(), %s:%d", __FILE__, __LINE__); + + return (0); +} Added: user/pho/stress2/misc/sendfile20.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/sendfile20.sh Sun Apr 12 05:57:07 2020 (r359819) @@ -0,0 +1,250 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "panic: vm_page_assert_xbusied: page not exclusive busy" seen: +# https://people.freebsd.org/~pho/stress/log/sendfile20.txt +# Fixed by r359778 + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ -z "$nfs_export" ] && exit 0 +ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || + exit 0 + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/$0 > sendfile20.c +mycc -o sendfile20 -Wall sendfile20.c -pthread || exit 1 +rm -f sendfile20.c + +(cd $odir/../testcases/swap; ./swap -t 5m -i 20 -l 100) & +sleep 5 +mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint + +cd $mntpoint +parallel=2000 +for i in `jot $parallel`; do + size=`jot -r 1 1 $((1024 * 1024))` + dd if=/dev/zero of=input.$i bs=$size count=1 status=none +done +cd $odir +while mount | grep "$mntpoint " | grep -q nfs; do + umount -f $mntpoint +done +sleep 1 +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint +spid=$! +cd $mntpoint +pids= +for i in `jot $parallel`; do + /tmp/sendfile20 input.$i output.$i 1234$i & + pids="$pids $!" +done +sleep 30 +while pkill sendfile20; do :; done +for p in $pids; do + wait $p +done +for i in `jot $parallel`; do +# cmp input.$i output.$i || { echo FAIL; ls -l input$i output$i; } + rm -f input.$i output.$i +done +while pkill swap; do :; done +wait $spid + +cd $odir +umount $mntpoint +while mount | grep "$mntpoint " | grep -q nfs; do + umount -f $mntpoint +done +rm -f /tmp/sendfile20 +exit 0 +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int port; +char *inputFile; +char *outputFile; +int bufsize = 4096; + +static void +reader(void) { + int tcpsock, msgsock; + int on; + socklen_t len; + struct sockaddr_in inetaddr, inetpeer; + int n, t, *buf, fd; + + on = 1; + if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(1, "socket(), %s:%d", __FILE__, __LINE__); + + if (setsockopt(tcpsock, + SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) + err(1, "setsockopt(), %s:%d", __FILE__, __LINE__); + + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(port); + inetaddr.sin_len = sizeof(inetaddr); + + if (bind(tcpsock, + (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) + err(1, "bind(), %s:%d", __FILE__, __LINE__); + + if (listen(tcpsock, 5) < 0) + err(1, "listen(), %s:%d", __FILE__, __LINE__); + + len = sizeof(inetpeer); + if ((msgsock = accept(tcpsock, + (struct sockaddr *)&inetpeer, &len)) < 0) + err(1, "accept(), %s:%d", __FILE__, __LINE__); + + t = 0; + if ((buf = malloc(bufsize)) == NULL) + err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); + + if ((fd = open(outputFile, O_RDWR | O_CREAT | O_TRUNC, 0640)) == -1) + err(1, "open(%s)", outputFile); + + for (;;) { + if ((n = read(msgsock, buf, bufsize)) < 0) + err(1, "read(), %s:%d", __FILE__, __LINE__); + t += n; + if (n == 0) + break; + + if ((write(fd, buf, n)) != n) + err(1, "write"); + } + close(msgsock); + close(fd); + return; +} + +static void +writer(void) { + int tcpsock, on; + struct sockaddr_in inetaddr; + struct hostent *hostent; + struct stat statb; + int i, r, fd; + off_t off = 0; +#if 1 + size_t size; +#endif + + on = 1; + for (i = 1; i < 5; i++) { + if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(1, "socket(), %s:%d", __FILE__, __LINE__); + + if (setsockopt(tcpsock, + SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) + err(1, "setsockopt(), %s:%d", __FILE__, __LINE__); + +#if 1 /* livelock trigger */ + size = getpagesize() -4; + if (setsockopt(tcpsock, SOL_SOCKET, SO_SNDBUF, (void *)&size, + sizeof(size)) < 0) + err(1, "setsockopt(SO_SNDBUF), %s:%d", + __FILE__, __LINE__); +#endif + + hostent = gethostbyname ("localhost"); + memcpy (&inetaddr.sin_addr.s_addr, hostent->h_addr, + sizeof (struct in_addr)); + + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(port); + inetaddr.sin_len = sizeof(inetaddr); + + r = connect(tcpsock, (struct sockaddr *) &inetaddr, + sizeof(inetaddr)); + if (r == 0) + break; + sleep(1); + close(tcpsock); + } + if (r < 0) + err(1, "connect(), %s:%d", __FILE__, __LINE__); + + if (stat(inputFile, &statb) != 0) + err(1, "stat(%s)", inputFile); + + if ((fd = open(inputFile, O_RDONLY)) == -1) + err(1, "open(%s)", inputFile); + + if (sendfile(fd, tcpsock, 0, statb.st_size, NULL, &off, SF_NOCACHE) == -1) + err(1, "sendfile"); + + return; +} + +int +main(int argc, char **argv) +{ + pid_t pid; + + if (argc != 4) { + fprintf(stderr, "Usage: %s 0) { + reader(); + kill(pid, SIGINT); + } else + err(1, "fork(), %s:%d", __FILE__, __LINE__); + + return (0); +} From owner-svn-src-user@freebsd.org Sun Apr 12 05:59:21 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 857202B36B7 for ; Sun, 12 Apr 2020 05:59:21 +0000 (UTC) (envelope-from pho@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490Lfx1Jnvz4g4K; Sun, 12 Apr 2020 05:59:21 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2826224B61; Sun, 12 Apr 2020 05:59:21 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03C5xL2D099773; Sun, 12 Apr 2020 05:59:21 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03C5xKI3099770; Sun, 12 Apr 2020 05:59:20 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202004120559.03C5xKI3099770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 12 Apr 2020 05:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r359820 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 359820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 05:59:21 -0000 Author: pho Date: Sun Apr 12 05:59:20 2020 New Revision: 359820 URL: https://svnweb.freebsd.org/changeset/base/359820 Log: Added more syzkaller reproducers. Added: user/pho/stress2/misc/syzkaller5.sh (contents, props changed) user/pho/stress2/misc/syzkaller6.sh (contents, props changed) user/pho/stress2/misc/syzkaller7.sh (contents, props changed) Added: user/pho/stress2/misc/syzkaller5.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/syzkaller5.sh Sun Apr 12 05:59:20 2020 (r359820) @@ -0,0 +1,84 @@ +#!/bin/sh + +# panic: to_ticks == 0 for timer type 11 +# cpuid = 0 +# time = 1585113766 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame 0xfffffe0024a5e4b0 +# vpanic() at vpanic+0x1c7/frame 0xfffffe0024a5e510 +# panic() at panic+0x43/frame 0xfffffe0024a5e570 +# sctp_timer_start() at sctp_timer_start+0xc7f/frame 0xfffffe0024a5e5d0 +# sctp_lower_sosend() at sctp_lower_sosend+0x4b9a/frame 0xfffffe0024a5e7b0 +# sctp_sosend() at sctp_sosend+0x501/frame 0xfffffe0024a5e8e0 +# sosend() at sosend+0xc6/frame 0xfffffe0024a5e950 +# kern_sendit() at kern_sendit+0x33d/frame 0xfffffe0024a5ea00 +# sendit() at sendit+0x224/frame 0xfffffe0024a5ea60 +# sys_sendto() at sys_sendto+0x5c/frame 0xfffffe0024a5eac0 +# amd64_syscall() at amd64_syscall+0x2f4/frame 0xfffffe0024a5ebf0 +# fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0024a5ebf0 + +# Fixed by r359405 + +# $FreeBSD$ + +[ `uname -p` = "i386" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller5.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + res = syscall(SYS_socket, 0x1cul, 5ul, 0x84); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000200 = 0; + *(uint32_t*)0x20000204 = 0; + *(uint32_t*)0x20000208 = 0xfffffffb; + *(uint32_t*)0x2000020c = 0; + syscall(SYS_setsockopt, r[0], 0x84, 1, 0x20000200ul, 0x3f6ul); + memcpy((void*)0x20000040, "\x11", 1); + *(uint8_t*)0x20000100 = 0x10; + *(uint8_t*)0x20000101 = 2; + *(uint16_t*)0x20000102 = htobe16(0x4e21); + *(uint8_t*)0x20000104 = 0xac; + *(uint8_t*)0x20000105 = 0x14; + *(uint8_t*)0x20000106 = 0; + *(uint8_t*)0x20000107 = 0xbb; + *(uint8_t*)0x20000108 = 0; + *(uint8_t*)0x20000109 = 0; + *(uint8_t*)0x2000010a = 0; + *(uint8_t*)0x2000010b = 0; + *(uint8_t*)0x2000010c = 0; + *(uint8_t*)0x2000010d = 0; + *(uint8_t*)0x2000010e = 0; + *(uint8_t*)0x2000010f = 0; + syscall(SYS_sendto, r[0], 0x20000040ul, 1ul, 0x104ul, 0x20000100ul, 0x10ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller5 -Wall -Wextra -O2 /tmp/syzkaller5.c -lpthread || + exit 1 + +(cd /tmp; ./syzkaller5) + +rm /tmp/syzkaller5 /tmp/syzkaller5.c +exit 0 Added: user/pho/stress2/misc/syzkaller6.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/syzkaller6.sh Sun Apr 12 05:59:20 2020 (r359820) @@ -0,0 +1,85 @@ +#!/bin/sh + +# panic: to_ticks == 0 for timer type 2 +# cpuid = 1 +# time = 1585113958 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame 0xfffffe0024a54420 +# vpanic() at vpanic+0x1c7/frame 0xfffffe0024a54480 +# panic() at panic+0x43/frame 0xfffffe0024a544e0 +# sctp_timer_start() at sctp_timer_start+0xc7f/frame 0xfffffe0024a54540 +# sctp_send_initiate() at sctp_send_initiate+0x10b/frame 0xfffffe0024a545d0 +# sctp_lower_sosend() at sctp_lower_sosend+0x3f54/frame 0xfffffe0024a547b0 +# sctp_sosend() at sctp_sosend+0x501/frame 0xfffffe0024a548e0 +# sosend() at sosend+0xc6/frame 0xfffffe0024a54950 +# kern_sendit() at kern_sendit+0x33d/frame 0xfffffe0024a54a00 +# sendit() at sendit+0x224/frame 0xfffffe0024a54a60 +# sys_sendto() at sys_sendto+0x5c/frame 0xfffffe0024a54ac0 +# amd64_syscall() at amd64_syscall+0x2f4/frame 0xfffffe0024a54bf0 +# fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0024a54bf0 + +# $FreeBSD$ + +# Fixed by r359405 + +[ `uname -p` = "i386" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller6.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[1] = {0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + res = syscall(SYS_socket, 0x1cul, 5ul, 0x84); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000200 = 0; + *(uint32_t*)0x20000204 = 0xfffffff9; + *(uint32_t*)0x20000208 = 0xfffffffb; + *(uint32_t*)0x2000020c = 0; + syscall(SYS_setsockopt, r[0], 0x84, 1, 0x20000200ul, 0x39eul); + memcpy((void*)0x20000040, "\x11", 1); + *(uint8_t*)0x20000100 = 0x10; + *(uint8_t*)0x20000101 = 2; + *(uint16_t*)0x20000102 = htobe16(0x4e21); + *(uint8_t*)0x20000104 = 0xac; + *(uint8_t*)0x20000105 = 0x14; + *(uint8_t*)0x20000106 = 0; + *(uint8_t*)0x20000107 = 0xbb; + *(uint8_t*)0x20000108 = 0; + *(uint8_t*)0x20000109 = 0; + *(uint8_t*)0x2000010a = 0; + *(uint8_t*)0x2000010b = 0; + *(uint8_t*)0x2000010c = 0; + *(uint8_t*)0x2000010d = 0; + *(uint8_t*)0x2000010e = 0; + *(uint8_t*)0x2000010f = 0; + syscall(SYS_sendto, r[0], 0x20000040ul, 1ul, 0ul, 0x20000100ul, 0x10ul); + return 0; +} +EOF +mycc -o /tmp/syzkaller6 -Wall -Wextra -O2 /tmp/syzkaller6.c -lpthread || + exit 1 + +(cd /tmp; ./syzkaller6) + +rm /tmp/syzkaller6 /tmp/syzkaller6.c +exit 0 Added: user/pho/stress2/misc/syzkaller7.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/syzkaller7.sh Sun Apr 12 05:59:20 2020 (r359820) @@ -0,0 +1,163 @@ +#!/bin/sh + +# panic: Duplicate free of 0xfffff800049ad800 from zone +# 0xfffff800041e82c0(mbuf) slab 0xfffff800049adf90(8) +# +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame +# 0xfffffe0016b2c4a0 +# vpanic() at vpanic+0x1e0/frame 0xfffffe0016b2c500 +# panic() at panic+0x43/frame 0xfffffe0016b2c560 +# uma_dbg_free() at uma_dbg_free+0x246/frame 0xfffffe0016b2c5b0 +# uma_zfree_arg() at uma_zfree_arg+0x1aa/frame 0xfffffe0016b2c640 +# uipc_ready() at uipc_ready+0x19f/frame 0xfffffe0016b2c690 +# sendfile_iodone() at sendfile_iodone+0x342/frame 0xfffffe0016b2c6f0 +# vnode_pager_generic_getpages_done_async() at +# vnode_pager_generic_getpages_done_async+0x4a/frame 0xfffffe0016b2c720 +# bufdone() at bufdone+0xa1/frame 0xfffffe0016b2c7a0 +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c800 +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c860 +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c8c0 +# g_disk_done() at g_disk_done+0x179/frame 0xfffffe0016b2c910 +# dadone() at dadone+0x655/frame 0xfffffe0016b2c9a0 +# xpt_done_process() at xpt_done_process+0x5b2/frame 0xfffffe0016b2ca00 +# xpt_done_td() at xpt_done_td+0x175/frame 0xfffffe0016b2ca60 +# fork_exit() at fork_exit+0xb0/frame 0xfffffe0016b2cab0 +# fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0016b2cab0 +# --- trap 0, rip = 0, rsp = 0, rbp = 0 --- + +# $FreeBSD$ + +# Not reproduced on r359769 +# Fixed by r359779 + +[ `uname -p` = "i386" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller7.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; + for (iter = 0;; 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 < 5 * 1000) + continue; + kill_and_wait(pid, &status); + break; + } + } +} + +uint64_t r[5] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, + 0xffffffffffffffff, 0xffffffffffffffff}; + +void execute_one(void) +{ + long res = 0; + memcpy((void*)0x20001180, "./file0\000", 8); + res = syscall(SYS_open, 0x20001180, 0x8240, 0); + if (res != -1) + r[0] = res; + res = syscall(SYS_socketpair, 1, 1, 0, 0x20000100); + if (res != -1) { + r[1] = *(uint32_t*)0x20000100; + r[2] = *(uint32_t*)0x20000104; + } + memcpy((void*)0x20000480, "./file0\000", 8); + res = syscall(SYS_open, 0x20000480, 0x80000000000206, 0); + if (res != -1) + r[3] = res; + res = syscall(SYS_dup, r[3]); + if (res != -1) + r[4] = res; + *(uint64_t*)0x20000100 = 0x200002c0; + memcpy((void*)0x200002c0, "\xdd", 1); + *(uint64_t*)0x20000108 = 1; + syscall(SYS_pwritev, r[4], 0x20000100, 1, 0); + *(uint64_t*)0x20002e80 = 0x20000540; + memcpy((void*)0x20000540, "\x7f", 1); + *(uint64_t*)0x20002e88 = 1; + syscall(SYS_pwritev, r[3], 0x20002e80, 1, 0xbf24); + memcpy((void*)0x200004c0, + "\x89\x88\xaa\x4a\xc3\x95\x23\x77\x54\xee\x66\xf3\x8d\xa4\xae\xf3\x47" + "\x6d\x78\xb7\x1f\xe6\x0d\xb7\x4a\x9f\xb9\xc9\x99\x91\x6c\x98", + 32); + syscall(SYS_setsockopt, r[2], 0, 2, 0x200004c0, 0x20); + syscall(SYS_fcntl, r[4], 4, 0x10044); + syscall(SYS_read, r[4], 0x20000000, 0x6d999); + syscall(SYS_sendfile, r[0], r[1], 0, 2); +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); + loop(); + return 0; +} +EOF +mycc -o /tmp/syzkaller7 -Wall -Wextra -O2 /tmp/syzkaller7.c -lpthread || + exit 1 + +(cd /tmp; ./syzkaller7) & +sleep 60 +pkill -9 syzkaller7 +wait + +rm -f /tmp/syzkaller7 /tmp/syzkaller7.c /tmp/syzkaller7.core /tmp/file0 +exit 0 From owner-svn-src-user@freebsd.org Sun Apr 12 06:01:03 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC9332B36F8 for ; Sun, 12 Apr 2020 06:01:03 +0000 (UTC) (envelope-from pho@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490Lhv62RSz4g9x; Sun, 12 Apr 2020 06:01:03 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA81524B8F; Sun, 12 Apr 2020 06:01:03 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03C613Gh002595; Sun, 12 Apr 2020 06:01:03 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03C613E3002594; Sun, 12 Apr 2020 06:01:03 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202004120601.03C613E3002594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 12 Apr 2020 06:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r359821 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 359821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 06:01:04 -0000 Author: pho Date: Sun Apr 12 06:01:03 2020 New Revision: 359821 URL: https://svnweb.freebsd.org/changeset/base/359821 Log: Fix cleanup. Modified: user/pho/stress2/misc/syzkaller1.sh user/pho/stress2/misc/syzkaller2.sh Modified: user/pho/stress2/misc/syzkaller1.sh ============================================================================== --- user/pho/stress2/misc/syzkaller1.sh Sun Apr 12 05:59:20 2020 (r359820) +++ user/pho/stress2/misc/syzkaller1.sh Sun Apr 12 06:01:03 2020 (r359821) @@ -244,5 +244,5 @@ mycc -o /tmp/syzkaller1 -Wall -Wextra -O2 /tmp/syzkall (cd /tmp; ./syzkaller1) -rm /tmp/syzkaller1 /tmp/syzkaller1.c +rm -f /tmp/syzkaller1 /tmp/syzkaller1.c /tmp/syzkaller1.core exit 0 Modified: user/pho/stress2/misc/syzkaller2.sh ============================================================================== --- user/pho/stress2/misc/syzkaller2.sh Sun Apr 12 05:59:20 2020 (r359820) +++ user/pho/stress2/misc/syzkaller2.sh Sun Apr 12 06:01:03 2020 (r359821) @@ -87,5 +87,5 @@ rm /tmp/syzkaller2.c (cd /tmp; ./syzkaller2) -rm /tmp/syzkaller2 +rm -f /tmp/syzkaller2 /tmp/syzkaller2.core exit 0 From owner-svn-src-user@freebsd.org Sun Apr 12 16:25:45 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F23E82C1E9E for ; Sun, 12 Apr 2020 16:25:45 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490cYj65Xjz4KYW; Sun, 12 Apr 2020 16:25:45 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x842.google.com with SMTP id i3so5452707qtv.8; Sun, 12 Apr 2020 09:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=p29qBp1NHgzjIC9SYnkTK3rxdMm+QTI3GCJijOBD92U=; b=YPHpQJr4awOed0VhUlsvy+DKaR024I6touyHaEga6I53mpQtrxBKseOlDVzdHd6nqg ErHCVXwitkF9WuFDSyJzv5l08XWxlRoBL+2uH1a5y3nOpVPT/jJxdhIHH+ec4Sed6y01 k0hQ/QAO/ZJkCiZVNeWBSwJXRWxyPH8Z1v19NnWPx+nLgyc+nJlTzJOwbrtvm7B1OeCW rhV8vnHLwvC639zibUNefipt9qwZRpUwqlnu3nQelUqG4U3Sy/Nlw8RPXTbZrBNzwYlS LcO5edaLgYftVloE9CGDZlUiHkxxYEHsqazG5zXnGLqh8/ouU5K+rsI203WrRKgo0g1b Mnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=p29qBp1NHgzjIC9SYnkTK3rxdMm+QTI3GCJijOBD92U=; b=F7ANP2lk3dBdEz1FiaDH4zvRWxfjk0+8vlW2fXYm8nquWBV0QWC7d0Q2WKc1wGk0ZN vQHKpkw52w7rRqpy+S8GEW3MSgKmIWsoGSRl2K1uyV21IqOTwUnYdi9kj+4RwNTzOUGm ALzyNxnS90cSAZ+S8itv2XkEF0Yzzcqo6jkbOewNub1VJNkd6Ta03a8fvszLXySAqb1r hUO9r7mj7fQdpGID1thuMZzmEGO/OyrQ3lXsdtj5u2B528lVA0YWuU+ebVZ1vOAJltB7 I8FxgyY/DnW4yzG+6Zuf7qcjM76MG+MTo7NZoRn3Q9/LO9yNHZ8xocgUdOvmcK5lh/K1 jMIA== X-Gm-Message-State: AGi0PuaQvrZMnR7kOei3D7fU/2O2RZ0rUqrXDQBNy80o9pRWJILcNM/8 yc365wXGbLi+5Rq7c1gzfHf7z/94 X-Google-Smtp-Source: APiQypLMLcdycYIPsXUdGO+GQBKh/IRMpafvYQivccb1jTVwIDEb/Dc8dqJnh/mfx6Q4D8/1r5vofg== X-Received: by 2002:aed:2e65:: with SMTP id j92mr1706798qtd.273.1586708744602; Sun, 12 Apr 2020 09:25:44 -0700 (PDT) Received: from raichu (toroon0560w-lp130-10-174-94-17-182.dsl.bell.ca. [174.94.17.182]) by smtp.gmail.com with ESMTPSA id u26sm6011283qku.54.2020.04.12.09.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 09:25:43 -0700 (PDT) Sender: Mark Johnston Date: Sun, 12 Apr 2020 12:25:39 -0400 From: Mark Johnston To: Peter Holm Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r359820 - user/pho/stress2/misc Message-ID: <20200412162539.GA2519@raichu> References: <202004120559.03C5xKI3099770@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202004120559.03C5xKI3099770@repo.freebsd.org> X-Rspamd-Queue-Id: 490cYj65Xjz4KYW X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 16:25:46 -0000 On Sun, Apr 12, 2020 at 05:59:20AM +0000, Peter Holm wrote: > Author: pho > Date: Sun Apr 12 05:59:20 2020 > New Revision: 359820 > URL: https://svnweb.freebsd.org/changeset/base/359820 > > Log: > Added more syzkaller reproducers. > > Added: > user/pho/stress2/misc/syzkaller5.sh (contents, props changed) > user/pho/stress2/misc/syzkaller6.sh (contents, props changed) > user/pho/stress2/misc/syzkaller7.sh (contents, props changed) > [...] > Added: user/pho/stress2/misc/syzkaller7.sh > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ user/pho/stress2/misc/syzkaller7.sh Sun Apr 12 05:59:20 2020 (r359820) > @@ -0,0 +1,163 @@ > +#!/bin/sh > + > +# panic: Duplicate free of 0xfffff800049ad800 from zone > +# 0xfffff800041e82c0(mbuf) slab 0xfffff800049adf90(8) > +# > +# KDB: stack backtrace: > +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame > +# 0xfffffe0016b2c4a0 > +# vpanic() at vpanic+0x1e0/frame 0xfffffe0016b2c500 > +# panic() at panic+0x43/frame 0xfffffe0016b2c560 > +# uma_dbg_free() at uma_dbg_free+0x246/frame 0xfffffe0016b2c5b0 > +# uma_zfree_arg() at uma_zfree_arg+0x1aa/frame 0xfffffe0016b2c640 > +# uipc_ready() at uipc_ready+0x19f/frame 0xfffffe0016b2c690 > +# sendfile_iodone() at sendfile_iodone+0x342/frame 0xfffffe0016b2c6f0 > +# vnode_pager_generic_getpages_done_async() at > +# vnode_pager_generic_getpages_done_async+0x4a/frame 0xfffffe0016b2c720 > +# bufdone() at bufdone+0xa1/frame 0xfffffe0016b2c7a0 > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c800 > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c860 > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c8c0 > +# g_disk_done() at g_disk_done+0x179/frame 0xfffffe0016b2c910 > +# dadone() at dadone+0x655/frame 0xfffffe0016b2c9a0 > +# xpt_done_process() at xpt_done_process+0x5b2/frame 0xfffffe0016b2ca00 > +# xpt_done_td() at xpt_done_td+0x175/frame 0xfffffe0016b2ca60 > +# fork_exit() at fork_exit+0xb0/frame 0xfffffe0016b2cab0 > +# fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0016b2cab0 > +# --- trap 0, rip = 0, rsp = 0, rbp = 0 --- > + > +# $FreeBSD$ > + > +# Not reproduced on r359769 There is a bug in old reproducers that causes them to fail. Specifically, the call: syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); should be syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0ul); There is some discussion of the problem here: https://github.com/google/syzkaller/pull/1493 In general, when testing old reproducers, all you need to do is manually adjust SYS_mmap calls as above. > +# Fixed by r359779 > + > +[ `uname -p` = "i386" ] && exit 0 > + > +. ../default.cfg > +cat > /tmp/syzkaller7.c < +// https://syzkaller.appspot.com/bug?id=3a27f6d4656356facc22a9329be797ef1143d0ad > +// autogenerated by syzkaller (https://github.com/google/syzkaller) > + > +#define _GNU_SOURCE > + > +#include > + > +#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; > + for (iter = 0;; 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 < 5 * 1000) > + continue; > + kill_and_wait(pid, &status); > + break; > + } > + } > +} > + > +uint64_t r[5] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, > + 0xffffffffffffffff, 0xffffffffffffffff}; > + > +void execute_one(void) > +{ > + long res = 0; > + memcpy((void*)0x20001180, "./file0\000", 8); > + res = syscall(SYS_open, 0x20001180, 0x8240, 0); > + if (res != -1) > + r[0] = res; > + res = syscall(SYS_socketpair, 1, 1, 0, 0x20000100); > + if (res != -1) { > + r[1] = *(uint32_t*)0x20000100; > + r[2] = *(uint32_t*)0x20000104; > + } > + memcpy((void*)0x20000480, "./file0\000", 8); > + res = syscall(SYS_open, 0x20000480, 0x80000000000206, 0); > + if (res != -1) > + r[3] = res; > + res = syscall(SYS_dup, r[3]); > + if (res != -1) > + r[4] = res; > + *(uint64_t*)0x20000100 = 0x200002c0; > + memcpy((void*)0x200002c0, "\xdd", 1); > + *(uint64_t*)0x20000108 = 1; > + syscall(SYS_pwritev, r[4], 0x20000100, 1, 0); > + *(uint64_t*)0x20002e80 = 0x20000540; > + memcpy((void*)0x20000540, "\x7f", 1); > + *(uint64_t*)0x20002e88 = 1; > + syscall(SYS_pwritev, r[3], 0x20002e80, 1, 0xbf24); > + memcpy((void*)0x200004c0, > + "\x89\x88\xaa\x4a\xc3\x95\x23\x77\x54\xee\x66\xf3\x8d\xa4\xae\xf3\x47" > + "\x6d\x78\xb7\x1f\xe6\x0d\xb7\x4a\x9f\xb9\xc9\x99\x91\x6c\x98", > + 32); > + syscall(SYS_setsockopt, r[2], 0, 2, 0x200004c0, 0x20); > + syscall(SYS_fcntl, r[4], 4, 0x10044); > + syscall(SYS_read, r[4], 0x20000000, 0x6d999); > + syscall(SYS_sendfile, r[0], r[1], 0, 2); > +} > +int main(void) > +{ > + syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); > + loop(); > + return 0; > +} > +EOF > +mycc -o /tmp/syzkaller7 -Wall -Wextra -O2 /tmp/syzkaller7.c -lpthread || > + exit 1 > + > +(cd /tmp; ./syzkaller7) & > +sleep 60 > +pkill -9 syzkaller7 > +wait > + > +rm -f /tmp/syzkaller7 /tmp/syzkaller7.c /tmp/syzkaller7.core /tmp/file0 > +exit 0 From owner-svn-src-user@freebsd.org Sun Apr 12 18:22:17 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 948952C4ED2 for ; Sun, 12 Apr 2020 18:22:17 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay05.pair.com (relay05.pair.com [216.92.24.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 490g892GKCz4SWf; Sun, 12 Apr 2020 18:22:16 +0000 (UTC) (envelope-from pho@holm.cc) Received: from x8.osted.lan (ip-5-186-118-155.cgn.fibianet.dk [5.186.118.155]) by relay05.pair.com (Postfix) with ESMTP id 0F5021A354E; Sun, 12 Apr 2020 14:22:15 -0400 (EDT) Received: from x8.osted.lan (localhost [127.0.0.1]) by x8.osted.lan (8.15.2/8.15.2) with ESMTPS id 03CIMEui092461 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 12 Apr 2020 20:22:14 +0200 (CEST) (envelope-from pho@x8.osted.lan) Received: (from pho@localhost) by x8.osted.lan (8.15.2/8.15.2/Submit) id 03CIMEeU092460; Sun, 12 Apr 2020 20:22:14 +0200 (CEST) (envelope-from pho) Date: Sun, 12 Apr 2020 20:22:14 +0200 From: Peter Holm To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r359820 - user/pho/stress2/misc Message-ID: <20200412182214.GA92381@x8.osted.lan> References: <202004120559.03C5xKI3099770@repo.freebsd.org> <20200412162539.GA2519@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200412162539.GA2519@raichu> X-Rspamd-Queue-Id: 490g892GKCz4SWf X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 18:22:17 -0000 On Sun, Apr 12, 2020 at 12:25:39PM -0400, Mark Johnston wrote: > On Sun, Apr 12, 2020 at 05:59:20AM +0000, Peter Holm wrote: > > Author: pho > > Date: Sun Apr 12 05:59:20 2020 > > New Revision: 359820 > > URL: https://svnweb.freebsd.org/changeset/base/359820 > > > > Log: > > Added more syzkaller reproducers. > > > > Added: > > user/pho/stress2/misc/syzkaller5.sh (contents, props changed) > > user/pho/stress2/misc/syzkaller6.sh (contents, props changed) > > user/pho/stress2/misc/syzkaller7.sh (contents, props changed) > > [...] > > Added: user/pho/stress2/misc/syzkaller7.sh > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ user/pho/stress2/misc/syzkaller7.sh Sun Apr 12 05:59:20 2020 (r359820) > > @@ -0,0 +1,163 @@ > > +#!/bin/sh > > + > > +# panic: Duplicate free of 0xfffff800049ad800 from zone > > +# 0xfffff800041e82c0(mbuf) slab 0xfffff800049adf90(8) > > +# > > +# KDB: stack backtrace: > > +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame > > +# 0xfffffe0016b2c4a0 > > +# vpanic() at vpanic+0x1e0/frame 0xfffffe0016b2c500 > > +# panic() at panic+0x43/frame 0xfffffe0016b2c560 > > +# uma_dbg_free() at uma_dbg_free+0x246/frame 0xfffffe0016b2c5b0 > > +# uma_zfree_arg() at uma_zfree_arg+0x1aa/frame 0xfffffe0016b2c640 > > +# uipc_ready() at uipc_ready+0x19f/frame 0xfffffe0016b2c690 > > +# sendfile_iodone() at sendfile_iodone+0x342/frame 0xfffffe0016b2c6f0 > > +# vnode_pager_generic_getpages_done_async() at > > +# vnode_pager_generic_getpages_done_async+0x4a/frame 0xfffffe0016b2c720 > > +# bufdone() at bufdone+0xa1/frame 0xfffffe0016b2c7a0 > > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c800 > > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c860 > > +# g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c8c0 > > +# g_disk_done() at g_disk_done+0x179/frame 0xfffffe0016b2c910 > > +# dadone() at dadone+0x655/frame 0xfffffe0016b2c9a0 > > +# xpt_done_process() at xpt_done_process+0x5b2/frame 0xfffffe0016b2ca00 > > +# xpt_done_td() at xpt_done_td+0x175/frame 0xfffffe0016b2ca60 > > +# fork_exit() at fork_exit+0xb0/frame 0xfffffe0016b2cab0 > > +# fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0016b2cab0 > > +# --- trap 0, rip = 0, rsp = 0, rbp = 0 --- > > + > > +# $FreeBSD$ > > + > > +# Not reproduced on r359769 > > There is a bug in old reproducers that causes them to fail. > Specifically, the call: > > syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); > > should be > > syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0ul); > Ah, yes. Thank you. panic: Duplicate free of 0xfffff8001528fe00 from zone 0xfffff80003b34000(mbuf) slab 0xfffff8001528ffd8(14) cpuid = 19 time = 1586715583 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0126af9780 vpanic() at vpanic+0x182/frame 0xfffffe0126af97d0 panic() at panic+0x43/frame 0xfffffe0126af9830 uma_dbg_free() at uma_dbg_free+0x1f2/frame 0xfffffe0126af9870 uma_zfree_arg() at uma_zfree_arg+0x130/frame 0xfffffe0126af98c0 m_free() at m_free+0x81/frame 0xfffffe0126af98e0 uipc_ready() at uipc_ready+0xf8/frame 0xfffffe0126af9920 sendfile_iodone() at sendfile_iodone+0xb1/frame 0xfffffe0126af9960 vnode_pager_generic_getpages_done_async() at vnode_pager_generic_getpages_done_async+0x3a/frame 0xfffffe0126af9980 bufdone() at bufdone+0x6c/frame 0xfffffe0126af99f0 g_io_deliver() at g_io_deliver+0x25e/frame 0xfffffe0126af9a40 g_io_deliver() at g_io_deliver+0x25e/frame 0xfffffe0126af9a90 g_disk_done() at g_disk_done+0xed/frame 0xfffffe0126af9ad0 dadone() at dadone+0x5e0/frame 0xfffffe0126af9b20 xpt_done_process() at xpt_done_process+0x382/frame 0xfffffe0126af9b60 xpt_done_td() at xpt_done_td+0xf5/frame 0xfffffe0126af9bb0 fork_exit() at fork_exit+0x80/frame 0xfffffe0126af9bf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0126af9bf0 --- trap 0, rip = 0, rsp = 0, rbp = 0 --- KDB: enter: panic [ thread pid 32 tid 100163 ] Stopped at kdb_enter+0x37: movq $0,0x10cd696(%rip) db> x/s version version: FreeBSD 13.0-CURRENT #0 r359769: Fri Apr 10 08:41:12 CEST 2020\012 pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO\012 db> - Peter > There is some discussion of the problem here: > https://github.com/google/syzkaller/pull/1493 > > In general, when testing old reproducers, all you need to do is manually > adjust SYS_mmap calls as above. > > > +# Fixed by r359779 > > + > > +[ `uname -p` = "i386" ] && exit 0 > > + > > +. ../default.cfg > > +cat > /tmp/syzkaller7.c < > +// https://syzkaller.appspot.com/bug?id=3a27f6d4656356facc22a9329be797ef1143d0ad > > +// autogenerated by syzkaller (https://github.com/google/syzkaller) > > + > > +#define _GNU_SOURCE > > + > > +#include > > + > > +#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; > > + for (iter = 0;; 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 < 5 * 1000) > > + continue; > > + kill_and_wait(pid, &status); > > + break; > > + } > > + } > > +} > > + > > +uint64_t r[5] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, > > + 0xffffffffffffffff, 0xffffffffffffffff}; > > + > > +void execute_one(void) > > +{ > > + long res = 0; > > + memcpy((void*)0x20001180, "./file0\000", 8); > > + res = syscall(SYS_open, 0x20001180, 0x8240, 0); > > + if (res != -1) > > + r[0] = res; > > + res = syscall(SYS_socketpair, 1, 1, 0, 0x20000100); > > + if (res != -1) { > > + r[1] = *(uint32_t*)0x20000100; > > + r[2] = *(uint32_t*)0x20000104; > > + } > > + memcpy((void*)0x20000480, "./file0\000", 8); > > + res = syscall(SYS_open, 0x20000480, 0x80000000000206, 0); > > + if (res != -1) > > + r[3] = res; > > + res = syscall(SYS_dup, r[3]); > > + if (res != -1) > > + r[4] = res; > > + *(uint64_t*)0x20000100 = 0x200002c0; > > + memcpy((void*)0x200002c0, "\xdd", 1); > > + *(uint64_t*)0x20000108 = 1; > > + syscall(SYS_pwritev, r[4], 0x20000100, 1, 0); > > + *(uint64_t*)0x20002e80 = 0x20000540; > > + memcpy((void*)0x20000540, "\x7f", 1); > > + *(uint64_t*)0x20002e88 = 1; > > + syscall(SYS_pwritev, r[3], 0x20002e80, 1, 0xbf24); > > + memcpy((void*)0x200004c0, > > + "\x89\x88\xaa\x4a\xc3\x95\x23\x77\x54\xee\x66\xf3\x8d\xa4\xae\xf3\x47" > > + "\x6d\x78\xb7\x1f\xe6\x0d\xb7\x4a\x9f\xb9\xc9\x99\x91\x6c\x98", > > + 32); > > + syscall(SYS_setsockopt, r[2], 0, 2, 0x200004c0, 0x20); > > + syscall(SYS_fcntl, r[4], 4, 0x10044); > > + syscall(SYS_read, r[4], 0x20000000, 0x6d999); > > + syscall(SYS_sendfile, r[0], r[1], 0, 2); > > +} > > +int main(void) > > +{ > > + syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); > > + loop(); > > + return 0; > > +} > > +EOF > > +mycc -o /tmp/syzkaller7 -Wall -Wextra -O2 /tmp/syzkaller7.c -lpthread || > > + exit 1 > > + > > +(cd /tmp; ./syzkaller7) & > > +sleep 60 > > +pkill -9 syzkaller7 > > +wait > > + > > +rm -f /tmp/syzkaller7 /tmp/syzkaller7.c /tmp/syzkaller7.core /tmp/file0 > > +exit 0 From owner-svn-src-user@freebsd.org Mon Apr 13 08:56:49 2020 Return-Path: Delivered-To: svn-src-user@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D4DE2B7759 for ; Mon, 13 Apr 2020 08:56:49 +0000 (UTC) (envelope-from pho@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4912YD6VZGz4JrR; Mon, 13 Apr 2020 08:56:48 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA4AD18B05; Mon, 13 Apr 2020 08:56:48 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03D8umTn095937; Mon, 13 Apr 2020 08:56:48 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03D8umEI095936; Mon, 13 Apr 2020 08:56:48 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202004130856.03D8umEI095936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 13 Apr 2020 08:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r359852 - user/pho/stress2/misc X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/misc X-SVN-Commit-Revision: 359852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 08:56:49 -0000 Author: pho Date: Mon Apr 13 08:56:48 2020 New Revision: 359852 URL: https://svnweb.freebsd.org/changeset/base/359852 Log: Fix the mmap() argument type. The test now works as expected. Remove some trailing blanks while here. Reported by: Mark Johnston Modified: user/pho/stress2/misc/syzkaller7.sh Modified: user/pho/stress2/misc/syzkaller7.sh ============================================================================== --- user/pho/stress2/misc/syzkaller7.sh Mon Apr 13 08:56:19 2020 (r359851) +++ user/pho/stress2/misc/syzkaller7.sh Mon Apr 13 08:56:48 2020 (r359852) @@ -1,10 +1,10 @@ #!/bin/sh -# panic: Duplicate free of 0xfffff800049ad800 from zone +# panic: Duplicate free of 0xfffff800049ad800 from zone # 0xfffff800041e82c0(mbuf) slab 0xfffff800049adf90(8) # # KDB: stack backtrace: -# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame +# db_trace_self_wrapper() at db_trace_self_wrapper+0x47/frame # 0xfffffe0016b2c4a0 # vpanic() at vpanic+0x1e0/frame 0xfffffe0016b2c500 # panic() at panic+0x43/frame 0xfffffe0016b2c560 @@ -12,7 +12,7 @@ # uma_zfree_arg() at uma_zfree_arg+0x1aa/frame 0xfffffe0016b2c640 # uipc_ready() at uipc_ready+0x19f/frame 0xfffffe0016b2c690 # sendfile_iodone() at sendfile_iodone+0x342/frame 0xfffffe0016b2c6f0 -# vnode_pager_generic_getpages_done_async() at +# vnode_pager_generic_getpages_done_async() at # vnode_pager_generic_getpages_done_async+0x4a/frame 0xfffffe0016b2c720 # bufdone() at bufdone+0xa1/frame 0xfffffe0016b2c7a0 # g_io_deliver() at g_io_deliver+0x35b/frame 0xfffffe0016b2c800 @@ -28,7 +28,7 @@ # $FreeBSD$ -# Not reproduced on r359769 +# Reproduced on r359769 # Fixed by r359779 [ `uname -p` = "i386" ] && exit 0 @@ -146,7 +146,7 @@ void execute_one(void) } int main(void) { - syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0); + syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0ul); loop(); return 0; }