From owner-svn-src-user@freebsd.org Sun Mar 1 08:44:16 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 43A0D26A26F for ; Sun, 1 Mar 2020 08:44:16 +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 48VcJb3XKvz4BMB; Sun, 1 Mar 2020 08:44:15 +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 DFB80DE1; Sun, 1 Mar 2020 08:44:14 +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 0218iEDs064409; Sun, 1 Mar 2020 08:44:14 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0218iEGC064408; Sun, 1 Mar 2020 08:44:14 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003010844.0218iEGC064408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 1 Mar 2020 08:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358480 - 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: 358480 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, 01 Mar 2020 08:44:16 -0000 Author: pho Date: Sun Mar 1 08:44:14 2020 New Revision: 358480 URL: https://svnweb.freebsd.org/changeset/base/358480 Log: Added an old test fcntl(2) fuzz scenario. Added: user/pho/stress2/misc/fcntl2.sh (contents, props changed) Added: user/pho/stress2/misc/fcntl2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/fcntl2.sh Sun Mar 1 08:44:14 2020 (r358480) @@ -0,0 +1,191 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Dell EMC Isilon +# +# 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$ +# + +# fcntl(2) fuzz +# "umount: unmount of /mnt failed: Device busy" seen: +# https://people.freebsd.org/~pho/stress/log/fcntl2.txt + +. ../default.cfg +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/fcntl2.c +mycc -o fcntl2 -Wall -Wextra -O0 -g fcntl2.c || exit 1 +rm -f fcntl2.c +cd $odir + +set -e +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart +newfs $newfs_flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +set +e + +(cd $odir/../testcases/swap; ./swap -t 3m -i 20) & +cd $mntpoint +limits -n 10000 $dir/fcntl2 +s=$? +[ -f fcntl2.core -a $s -eq 0 ] && + { ls -l fcntl2.core; mv fcntl2.core $dir; s=1; } +cd $odir +while pkill swap; do :; done + +for i in `jot 6`; do + mount | grep -q "on $mntpoint " || break + umount $mntpoint && break || sleep 10 + [ $i -eq 6 ] && + { echo FATAL; fstat -mf $mntpoint; exit 1; } +done +mdconfig -d -u $mdstart +rm -rf $dir/fcntl2 +exit $s + +EOF +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +static volatile u_int *share; + +#define PARALLEL 64 +#define RUNTIME (3 * 60) +#define SYNC 0 + +#define N (128 * 1024 / (int)sizeof(u_int32_t)) +static u_int32_t r[N]; + +static unsigned long +makearg(void) +{ + unsigned long val; + unsigned int i; + + val = arc4random(); + i = arc4random() % 100; + if (i < 20) + val = val & 0xff; + if (i >= 20 && i < 40) + val = val & 0xffff; + if (i >= 40 && i < 60) + val = (unsigned long)(r) | (val & 0xffff); +#if defined(__LP64__) + if (i >= 60) { + val = (val << 32) | arc4random(); + if (i > 80) + val = val & 0x00007fffffffffffUL; + } +#endif + + return (val); +} +static void +test(void) +{ + time_t start; + unsigned long arg3; + int cmd, fd, i, n, success; + char file[80]; + + atomic_add_int(&share[SYNC], 1); + while (share[SYNC] != PARALLEL) + ; + + success = 0; + snprintf(file, sizeof(file), "file.%d", getpid()); + if ((fd = open(file, O_RDWR | O_CREAT | O_TRUNC, DEFFILEMODE)) + == -1) + err(1, "open(%s)", file); + n = arc4random() % 100 + 1; + for (i = 0; i < n; i++) + if (write(fd, file, sizeof(file)) != sizeof(file)) + err(1, "write()"); + start = time(NULL); + while (time(NULL) - start < 60) { + cmd = arc4random() % 20; + arg3 = makearg(); + alarm(20); + if (fcntl(fd, cmd, arg3) != -1) + success++; + alarm(0); + } + close(fd); + unlink(file); + + + _exit(0); +} + +int +main(void) +{ + pid_t pids[PARALLEL]; + size_t len; + time_t start; + int i, status; + + len = PAGE_SIZE; + if ((share = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0)) == MAP_FAILED) + err(1, "mmap"); + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME) { + for (i = 0; i < N; i++) + r[i] = arc4random(); + share[SYNC] = 0; + for (i = 0; i < PARALLEL; i++) { + if ((pids[i] = fork()) == 0) + test(); + if (pids[i] == -1) + err(1, "fork()"); + } + for (i = 0; i < PARALLEL; i++) { + if (waitpid(pids[i], &status, 0) == -1) + err(1, "waitpid(%d)", pids[i]); + } + } + + return (0); +} From owner-svn-src-user@freebsd.org Sun Mar 1 08:53:46 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 E098926A4AE for ; Sun, 1 Mar 2020 08:53:46 +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 48VcWZ4Whnz4cng; Sun, 1 Mar 2020 08:53:46 +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 6712FFB3; Sun, 1 Mar 2020 08:53:46 +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 0218rkjr070100; Sun, 1 Mar 2020 08:53:46 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0218rkDC070099; Sun, 1 Mar 2020 08:53:46 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003010853.0218rkDC070099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 1 Mar 2020 08:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358481 - 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: 358481 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, 01 Mar 2020 08:53:47 -0000 Author: pho Date: Sun Mar 1 08:53:45 2020 New Revision: 358481 URL: https://svnweb.freebsd.org/changeset/base/358481 Log: Added an old swap test scenario. Added: user/pho/stress2/misc/swap5.sh (contents, props changed) Added: user/pho/stress2/misc/swap5.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/swap5.sh Sun Mar 1 08:53:45 2020 (r358481) @@ -0,0 +1,52 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Dell EMC Isilon +# +# 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$ +# + +# Test with out of swap space: +# swp_pager_getswapspace(32): failed + +# "panic: freeing free block" sen with WiP kernel code: +# https://people.freebsd.org/~pho/stress/log/dougm027.txt + +. ../default.cfg +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 +[ `sysctl -n hw.physmem` -lt $(( 5 * 1024 * 1024 * 1024)) ] && exit 0 +cc -o /tmp/swap5 -Wall -Wextra -O2 ../tools/swap.c || exit 1 +swapoff -a +mdconfig -a -t malloc -o reserve -s 4g -u $mdstart || exit 1 +swapon /dev/md$mdstart || exit 1 +for i in `jot 3`; do + /tmp/swap5 -t 180 -p 85 +done +swapoff /dev/md$mdstart +mdconfig -d -u $mdstart +swapon -a +rm -f /tmp/swap5 +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 06:25:43 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 8188F25B11C for ; Mon, 2 Mar 2020 06:25:43 +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 48W9BH2wTgz446D; Mon, 2 Mar 2020 06:25:43 +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 5828C18366; Mon, 2 Mar 2020 06:25:43 +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 0226Phop048879; Mon, 2 Mar 2020 06:25:43 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226Phis048878; Mon, 2 Mar 2020 06:25:43 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020625.0226Phis048878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:25:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358519 - 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: 358519 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, 02 Mar 2020 06:25:43 -0000 Author: pho Date: Mon Mar 2 06:25:42 2020 New Revision: 358519 URL: https://svnweb.freebsd.org/changeset/base/358519 Log: Added a syzkaller "C reproducer". Added: user/pho/stress2/misc/syzkaller4.sh (contents, props changed) Added: user/pho/stress2/misc/syzkaller4.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/syzkaller4.sh Mon Mar 2 06:25:42 2020 (r358519) @@ -0,0 +1,384 @@ +#!/bin/sh + +# panic: Assertion mtx_unowned(m) failed at ../../../kern/kern_mutex.c:1179 +# cpuid = 2 +# time = 1581180711 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e57958c0 +# vpanic() at vpanic+0x185/frame 0xfffffe00e5795920 +# panic() at panic+0x43/frame 0xfffffe00e5795980 +# _mtx_destroy() at _mtx_destroy+0x4c/frame 0xfffffe00e57959a0 +# solisten_proto() at solisten_proto+0xdb/frame 0xfffffe00e5795a00 +# tcp6_usr_listen() at tcp6_usr_listen+0x16d/frame 0xfffffe00e5795a60 +# solisten() at solisten+0x42/frame 0xfffffe00e5795a80 +# kern_listen() at kern_listen+0x80/frame 0xfffffe00e5795ac0 +# amd64_syscall() at amd64_syscall+0x2f1/frame 0xfffffe00e5795bf0 +# fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe00e5795bf0 + +# $FreeBSD$ + +[ `uname -p` = "i386" ] && exit 0 + +. ../default.cfg +cat > /tmp/syzkaller4.c < + +#include +#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 thread_start(void* (*fn)(void*), void* arg) +{ + pthread_t th; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 128 << 10); + int i; + for (i = 0; i < 100; i++) { + if (pthread_create(&th, &attr, fn, arg) == 0) { + pthread_attr_destroy(&attr); + return; + } + if (errno == EAGAIN) { + usleep(50); + continue; + } + break; + } + exit(1); +} + +typedef struct { + pthread_mutex_t mu; + pthread_cond_t cv; + int state; +} event_t; + +static void event_init(event_t* ev) +{ + if (pthread_mutex_init(&ev->mu, 0)) + exit(1); + if (pthread_cond_init(&ev->cv, 0)) + exit(1); + ev->state = 0; +} + +static void event_reset(event_t* ev) +{ + ev->state = 0; +} + +static void event_set(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + if (ev->state) + exit(1); + ev->state = 1; + pthread_mutex_unlock(&ev->mu); + pthread_cond_broadcast(&ev->cv); +} + +static void event_wait(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + while (!ev->state) + pthread_cond_wait(&ev->cv, &ev->mu); + pthread_mutex_unlock(&ev->mu); +} + +static int event_isset(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +static int event_timedwait(event_t* ev, uint64_t timeout) +{ + uint64_t start = current_time_ms(); + uint64_t now = start; + pthread_mutex_lock(&ev->mu); + for (;;) { + if (ev->state) + break; + uint64_t remain = timeout - (now - start); + struct timespec ts; + ts.tv_sec = remain / 1000; + ts.tv_nsec = (remain % 1000) * 1000 * 1000; + pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); + now = current_time_ms(); + if (now - start > timeout) + break; + } + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +struct thread_t { + int created, call; + event_t ready, done; +}; + +static struct thread_t threads[16]; +static void execute_call(int call); +static int running; + +static void* thr(void* arg) +{ + struct thread_t* th = (struct thread_t*)arg; + for (;;) { + event_wait(&th->ready); + event_reset(&th->ready); + execute_call(th->call); + __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); + event_set(&th->done); + } + return 0; +} + +static void execute_one(void) +{ + int i, call, thread; + int collide = 0; +again: + for (call = 0; call < 19; call++) { + for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); + thread++) { + struct thread_t* th = &threads[thread]; + if (!th->created) { + th->created = 1; + event_init(&th->ready); + event_init(&th->done); + event_set(&th->done); + thread_start(thr, th); + } + if (!event_isset(&th->done)) + continue; + event_reset(&th->done); + th->call = call; + __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); + event_set(&th->ready); + if (collide && (call % 2) == 0) + break; + event_timedwait(&th->done, 45); + break; + } + } + for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) + sleep_ms(1); + if (!collide) { + collide = 1; + goto again; + } +} + +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[6] = {0x0, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, + 0x0, 0xffffffffffffffff}; + +void execute_call(int call) +{ + intptr_t res; + switch (call) { + case 0: + *(uint32_t*)0x20000040 = 0x284002b0; + *(uint32_t*)0x20000044 = 0; + *(uint32_t*)0x20000048 = 0; + *(uint32_t*)0x2000004c = 0; + *(uint32_t*)0x20000050 = 0; + *(uint32_t*)0x20000054 = 0; + *(uint16_t*)0x20000058 = 0; + *(uint16_t*)0x2000005a = 0; + *(uint64_t*)0x20000060 = 0; + *(uint64_t*)0x20000068 = 0; + *(uint64_t*)0x20000070 = 0; + *(uint64_t*)0x20000078 = 0; + *(uint64_t*)0x20000080 = 0; + *(uint64_t*)0x20000088 = 0; + *(uint64_t*)0x20000090 = 0; + syscall(SYS___semctl, 0, 0ul, 0xaul, 0x20000040ul); + break; + case 1: + memcpy( + (void*)0x20000340, + "\x82\x02\xf3\x89\x9c\x53\x3e\x9e\x79\x9b\xd7\xc7\x3c\xcc\x8e\xf9\xba" + "\xb3\x80\xca\x99\xbc\x30\xf1\x8e\x7c\xb0\xc5\x3f\xd6\xa9\xe6\xc6\xa8" + "\xa8\x85\x82\x5b\xdf\x69\xb0\xb9\xed\x55\x59\xd8\x3d\x18\x64\x0d\x49" + "\xdd\x0c\x5b\xba\x14\x0e\xe4\x61\xce\xcf\x6c\x04\x6a\xa1\xda\xa6\x9a" + "\x50\xf8\xa5\xbf\x52\xc2\x63\xf1\x48\xad\xb2\x3e\x5b\x74\xd4\xd3\xe2" + "\x77\x4e\xe8\xef\x92\x6d\x3e\xf6\x35\x76\x60\x9b\x83\xfd\xbc\x00\x45" + "\xd8\x01\x38\x8b\x7b\x9f\x82\x1e\xf2\xe6\x42\xd3\x73\x00\x00\xc4\x05" + "\xc0\xc2\x1a\x82\xc5\x8e\x64\x2d\x07\x86\x09\x4f\xb0\x60\x2a\x5b\xfd" + "\x33\x73\x24\x41\xb5\xaa\x99\xd6\xdf\xbe\x06\xc7\x27\x48\x7e\x13\xfb" + "\x57\xd6\x2f\xcb\x0c\xda\x92\xcc\xc7\x0f\xb4\x6f\x95\xcb\x5d\x0c\x28" + "\x93\x70\xbc\x25\x88\x76\x2f\xd7\x86\x9e\x5e\x03\xfa\x9c\x68\xde\x52" + "\x23\xc5\xae\xa1\x1c\x58\x79\x1a\x6f\xfa\x52\x31\xfc\x2b\xd5\x33\x3d" + "\x49\x60\x80\xa0\x31\x16\x7e\xa5\xd5\x09\x94\x53\x1e\x3b\x56\x3f\x1e" + "\x4d\x95\x76\x44\x9d\x59\x7a\x2d\xbc\xea\xe3\x26\x0d\xf6\x68\xee\xba" + "\xc3\xbb\x9f\xb6\xf1\xa2\x44\xc2\x96\xd5\xdc\xc4\x1c\xa2\xaf\xeb\x92" + "\x4e\xaf\xfc\x1d\x5d\xaf\x30\x9b\x0b\xfd\x19\x1c\x40\xf9\xd0\x0d\xf5" + "\x15\x94\xb7\xe9", + 276); + syscall(SYS_connect, -1, 0x20000340ul, 0x10ul); + break; + case 2: + res = syscall(SYS_semget, 0ul, 0ul, 0x284ul); + if (res != -1) + r[0] = res; + break; + case 3: + res = syscall(SYS_socket, 0x1cul, 1ul, 0ul); + if (res != -1) + r[1] = res; + break; + case 4: + syscall(SYS_listen, r[1], 0); + break; + case 5: + res = syscall(SYS_fstat, r[1], 0x20000080ul); + if (res != -1) + r[2] = *(uint32_t*)0x200000a0; + break; + case 6: + *(uint32_t*)0x20000180 = 0x2840029c; + *(uint32_t*)0x20000184 = 0; + *(uint32_t*)0x20000188 = 0; + *(uint32_t*)0x2000018c = 0; + *(uint32_t*)0x20000190 = r[2]; + *(uint32_t*)0x20000194 = 0; + *(uint16_t*)0x20000198 = 0; + *(uint16_t*)0x2000019a = 0; + *(uint64_t*)0x200001a0 = 0; + *(uint64_t*)0x200001a8 = 0; + *(uint64_t*)0x200001b0 = 0; + *(uint64_t*)0x200001b8 = 0; + *(uint64_t*)0x200001c0 = 0; + *(uint64_t*)0x200001c8 = 0; + *(uint64_t*)0x200001d0 = 0; + syscall(SYS___semctl, r[0], 0ul, 0xaul, 0x20000180ul); + break; + case 7: + res = syscall(SYS_socket, 0x1cul, 1ul, 0x84ul); + if (res != -1) + r[3] = res; + break; + case 8: + syscall(SYS_connect, r[3], 0ul, 0ul); + break; + case 9: + syscall(SYS_fcntl, r[3], 5ul, 0); + break; + case 10: + syscall(SYS_getresuid, 0x20000040ul, 0ul, 0ul); + break; + case 11: + syscall(SYS___semctl, 0, 0ul, 0xaul, 0ul); + break; + case 12: + syscall(SYS___semctl, 0, 0ul, 1ul, 0ul); + break; + case 13: + res = syscall(SYS_semget, 0ul, 0ul, 0x284ul); + if (res != -1) + r[4] = res; + break; + case 14: + syscall(SYS_freebsd11_fstat, -1, 0ul); + break; + case 15: + syscall(SYS___semctl, r[4], 0ul, 1ul, 0ul); + break; + case 16: + res = syscall(SYS_socket, 0x1cul, 1ul, 0ul); + if (res != -1) + r[5] = res; + break; + case 17: + syscall(SYS_listen, r[5], 0); + break; + case 18: + syscall(SYS_fstat, r[5], 0ul); + break; + } +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x1012ul, -1, 0ul); + loop(); + return 0; +} +EOF +mycc -o /tmp/syzkaller4 -Wall -Wextra -O2 /tmp/syzkaller4.c -lpthread || + exit 1 + +(cd /tmp; ./syzkaller4) + +rm /tmp/syzkaller4 /tmp/syzkaller4.c +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 06:26:59 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 4B27A25B15B for ; Mon, 2 Mar 2020 06:26:59 +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 48W9Cl1Mdjz44yc; Mon, 2 Mar 2020 06:26:59 +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 2A3AD18368; Mon, 2 Mar 2020 06:26:59 +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 0226QxhI049022; Mon, 2 Mar 2020 06:26:59 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226Qxf2049021; Mon, 2 Mar 2020 06:26:59 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020626.0226Qxf2049021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358520 - 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: 358520 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, 02 Mar 2020 06:26:59 -0000 Author: pho Date: Mon Mar 2 06:26:58 2020 New Revision: 358520 URL: https://svnweb.freebsd.org/changeset/base/358520 Log: Added a regression test. Added: user/pho/stress2/misc/zz-combo04.sh (contents, props changed) Added: user/pho/stress2/misc/zz-combo04.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/zz-combo04.sh Mon Mar 2 06:26:58 2020 (r358520) @@ -0,0 +1,39 @@ +#!/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_dequeue: queued unlocked page +# 0xfffffe00295e8800" seen with WiP code. +# https://people.freebsd.org/~pho/stress/log/zz-combo04.txt + +for i in `jot 2`; do + ./nullfs5.sh + ./cleanup.sh +done From owner-svn-src-user@freebsd.org Mon Mar 2 06:28:42 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 BC2EF25B1C7 for ; Mon, 2 Mar 2020 06:28:42 +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 48W9Fk4ZqFz46hB; Mon, 2 Mar 2020 06:28:42 +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 779041836A; Mon, 2 Mar 2020 06:28:42 +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 0226Sg1V049214; Mon, 2 Mar 2020 06:28:42 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226SgIU049213; Mon, 2 Mar 2020 06:28:42 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020628.0226SgIU049213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358521 - 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: 358521 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, 02 Mar 2020 06:28:42 -0000 Author: pho Date: Mon Mar 2 06:28:42 2020 New Revision: 358521 URL: https://svnweb.freebsd.org/changeset/base/358521 Log: Added a regression test. Added: user/pho/stress2/misc/zz-combo01.sh (contents, props changed) Added: user/pho/stress2/misc/zz-combo01.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/zz-combo01.sh Mon Mar 2 06:28:42 2020 (r358521) @@ -0,0 +1,46 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Dell EMC Isilon +# +# 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: pmap_demote_pde: firstpte and newpte map different physical +# addresses" seen +# https://people.freebsd.org/~pho/stress/log/kostik1195.txt + +# Fixed by r348306 + +list="su.sh callout_reset_on.sh" +start=`date +%s` +while [ $((`date +%s` - start)) -lt 1200 ]; do + for i in $list; do + echo "`date +%T` $i" + ./$i + done +done +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 06:29:28 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 581FB25B1E7 for ; Mon, 2 Mar 2020 06:29:28 +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 48W9Gc1m7sz47YY; Mon, 2 Mar 2020 06:29:28 +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 331D01836D; Mon, 2 Mar 2020 06:29:28 +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 0226TSoG049334; Mon, 2 Mar 2020 06:29:28 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226TSTK049333; Mon, 2 Mar 2020 06:29:28 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020629.0226TSTK049333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358522 - 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: 358522 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, 02 Mar 2020 06:29:28 -0000 Author: pho Date: Mon Mar 2 06:29:27 2020 New Revision: 358522 URL: https://svnweb.freebsd.org/changeset/base/358522 Log: Added a regression test. Added: user/pho/stress2/misc/setsockopt2.sh (contents, props changed) Added: user/pho/stress2/misc/setsockopt2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/setsockopt2.sh Mon Mar 2 06:29:27 2020 (r358522) @@ -0,0 +1,210 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Dell EMC Isilon +# +# 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: Assertion in_epoch(net_epoch_preempt) failed at raw_ip6.c:742" +# https://people.freebsd.org/~pho/stress/log/setsockopt2.txt + +. ../default.cfg +[ `id -u` -ne 0 ] && echo "Must be root!" && exit 1 + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/setsockopt2.c +mycc -o setsockopt2 -Wall -Wextra -O0 -g setsockopt2.c || exit 1 +rm -f setsockopt2.c +cd $odir + +set -e +mount | grep "on $mntpoint " | grep -q /dev/md && umount -f $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 2g -u $mdstart +newfs $newfs_flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +set +e + +(cd ../testcases/swap; ./swap -t 5m -i 20) & +cd $mntpoint +$dir/setsockopt2 +s=$? +[ -f setsockopt2.core -a $s -eq 0 ] && + { ls -l setsockopt2.core; mv setsockopt2.core $dir; s=1; } +cd $odir +while pkill swap; do :; done +wait + +for i in `jot 6`; do + mount | grep -q "on $mntpoint " || break + umount $mntpoint && break || sleep 10 + [ $i -eq 6 ] && + { echo FATAL; fstat -mf $mntpoint; exit 1; } +done +mdconfig -d -u $mdstart +rm -rf $dir/setsockopt2 +exit $s + +EOF +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static volatile u_int *share; + +#define PARALLEL 128 +#define RUNTIME (2 * 60) +#define SYNC 0 + +static void +test(void) +{ + struct sockaddr_un sun; + pid_t pid; + time_t start; + char file[80]; + int domain, fd, i, one, prot, success, typ; + + success = 0; + snprintf(file, sizeof(file), "setsockopt2.socket.%d", getpid()); + memset(&sun, 0, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", file); + unlink(file); + + start = time(NULL); + while (time(NULL) - start < 30) { + share[SYNC] = 0; + fd = -1; + while (fd == -1) { + domain = arc4random() % 256; + typ = arc4random() % 10; + if (arc4random() % 100 < 20) + prot = arc4random() % 10; + else + prot = 0; + if ((fd = socket(domain, typ, prot)) == -1) + continue; + close(fd); + } + pid = fork(); + if (pid < 0) + err(1, "fork"); + if (pid == 0) { + // listen + fd = socket(domain, typ, prot); + if (fd < 0) + _exit(0); + one = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, + sizeof(one)) < 0) + err(1, "setsockopt"); + if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0) + _exit(0); + if (listen(fd, 10) == 0) { + share[SYNC] = 1; + usleep(random() % 10000); + } + (void)close(fd); + (void)unlink(file); + _exit(0); + } + fd = socket(domain, typ, prot); + if (fd == -1) + goto bad; + + setsockopt(fd, 0xffff, 0x80, 0x0, 0x0); + sun.sun_len = arc4random() % 128; + sun.sun_family = arc4random() % 10; + setsockopt(fd, 0x6, 0x401, &sun, 0x14); + + for (i = 0; share[SYNC] == 0 && i < 10; i++) + usleep(100); + if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) != -1) + success++; + usleep(random() % 100); +bad: + (void)close(fd); + if (waitpid(pid, NULL, 0) != pid) + err(1, "waitpid(%d)", pid); + } + + _exit(0); +} + +int +main(void) +{ + pid_t pids[PARALLEL]; + size_t len; + time_t start; + int e, i, status; + + e = 0; + len = PAGE_SIZE; + if ((share = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0)) == MAP_FAILED) + err(1, "mmap"); + + start = time(NULL); + while ((time(NULL) - start) < RUNTIME) { + for (i = 0; i < PARALLEL; i++) { + if ((pids[i] = fork()) == 0) + test(); + if (pids[i] == -1) + err(1, "fork()"); + } + for (i = 0; i < PARALLEL; i++) { + if (waitpid(pids[i], &status, 0) == -1) + err(1, "waitpid(%d)", pids[i]); + if (status != 0) { + if (WIFSIGNALED(status)) + fprintf(stderr, + "pid %d exit signal %d\n", + pids[i], WTERMSIG(status)); + } + e += status == 0 ? 0 : 1; + } + } + + return (0); +} From owner-svn-src-user@freebsd.org Mon Mar 2 06:30:15 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 F2FD225B212 for ; Mon, 2 Mar 2020 06:30:15 +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 48W9HW5L15z48Q1; Mon, 2 Mar 2020 06:30:15 +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 B1AF318371; Mon, 2 Mar 2020 06:30:15 +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 0226UFYq049484; Mon, 2 Mar 2020 06:30:15 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226UFSe049483; Mon, 2 Mar 2020 06:30:15 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020630.0226UFSe049483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358523 - 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: 358523 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, 02 Mar 2020 06:30:16 -0000 Author: pho Date: Mon Mar 2 06:30:15 2020 New Revision: 358523 URL: https://svnweb.freebsd.org/changeset/base/358523 Log: Added a regression test. Added: user/pho/stress2/misc/aslr.sh (contents, props changed) Added: user/pho/stress2/misc/aslr.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/aslr.sh Mon Mar 2 06:30:15 2020 (r358523) @@ -0,0 +1,48 @@ +#/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2019 Dell EMC Isilon +# +# 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$ +# + +# ELF32/64 address map randomization test. + +# "panic: page 0xfffff8103971b840 has queue state" seen in WiP kernel code. +# https://people.freebsd.org/~pho/stress/log/mark087.txt + +old32=`sysctl -ni kern.elf32.aslr.enable` +old64=`sysctl -ni kern.elf64.aslr.enable` + +if [ -n "$old32" ]; then + sysctl kern.elf32.aslr.enable=$((1 - old32)) + ./su.sh + sysctl kern.elf32.aslr.enable=$old32 +elif [ -n "$old64" ]; then + sysctl kern.elf64.aslr.enable=$((1 - old64)) + ./su.sh + sysctl kern.elf64.aslr.enable=$old64 +fi From owner-svn-src-user@freebsd.org Mon Mar 2 06:31:26 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 8E79B25B388 for ; Mon, 2 Mar 2020 06:31:26 +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 48W9Jt379zz49rQ; Mon, 2 Mar 2020 06:31:26 +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 6097A183C3; Mon, 2 Mar 2020 06:31:26 +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 0226VQr7052711; Mon, 2 Mar 2020 06:31:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226VQmK052710; Mon, 2 Mar 2020 06:31:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020631.0226VQmK052710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358524 - 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: 358524 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, 02 Mar 2020 06:31:26 -0000 Author: pho Date: Mon Mar 2 06:31:25 2020 New Revision: 358524 URL: https://svnweb.freebsd.org/changeset/base/358524 Log: Added an old regression test. Added: user/pho/stress2/misc/quota12.sh (contents, props changed) Added: user/pho/stress2/misc/quota12.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/quota12.sh Mon Mar 2 06:31:25 2020 (r358524) @@ -0,0 +1,82 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Dell EMC Isilon +# +# 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$ +# + +# Run marcus.cfg on a quota enabled FS + +# "Inability to allocate buffers" seen with WiP kernel code: +# https://people.freebsd.org/~pho/stress/log/kostik1218.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ "`sysctl -in kern.features.ufs_quota`" != "1" ] && exit 0 + +. ../default.cfg + +mount | grep "on $mntpoint " | grep -q md${mdstart}$part && umount $mntpoint +[ -c /dev/md$mdstart ] && mdconfig -d -u $mdstart + +mdconfig -a -t swap -s 2g -u $mdstart || exit 1 +bsdlabel -w md$mdstart auto +newfs $newfs_flags md${mdstart}$part > /dev/null +export PATH_FSTAB=/tmp/fstab +trap "rm -f $PATH_FSTAB" 0 +echo "/dev/md${mdstart}$part $mntpoint ufs rw,userquota 2 2" > $PATH_FSTAB +mount $mntpoint +set `df -ik $mntpoint | tail -1 | awk '{print $4,$7}'` +export KBLOCKS=$1 +export INODES=$2 +s=0 + +export QK=$((KBLOCKS / 1)) +export QI=$((INODES / 1)) +edquota -u -f $mntpoint -e \ + ${mntpoint}:$((QK - 50)):$QK:$((QI - 50 )):$QI $testuser > \ + /dev/null 2>&1 +quotaon $mntpoint + +chmod 777 $mntpoint +export runRUNTIME=15m +export RUNDIR=$mntpoint/stressX +su $testuser -c 'cd ..; ./run.sh marcus.cfg > /dev/null 2>&1' + +while ! quotaoff $mntpoint; do + sync + sleep 1 +done +quotacheck $mntpoint + +n=0 +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 + n=$((n + 1)) + [ $n -gt 60 ] && exit 1 +done +mdconfig -d -u $mdstart +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 06:32:41 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 F3FD925B401 for ; Mon, 2 Mar 2020 06:32:40 +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 48W9LJ67Zjz4BlQ; Mon, 2 Mar 2020 06:32:40 +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 CC4921854B; Mon, 2 Mar 2020 06:32:40 +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 0226Wem1055175; Mon, 2 Mar 2020 06:32:40 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226Weuw055174; Mon, 2 Mar 2020 06:32:40 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020632.0226Weuw055174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358525 - 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: 358525 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, 02 Mar 2020 06:32:41 -0000 Author: pho Date: Mon Mar 2 06:32:40 2020 New Revision: 358525 URL: https://svnweb.freebsd.org/changeset/base/358525 Log: Added an old regression test. Added: user/pho/stress2/misc/nullfs23.sh (contents, props changed) Added: user/pho/stress2/misc/nullfs23.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/nullfs23.sh Mon Mar 2 06:32:40 2020 (r358525) @@ -0,0 +1,53 @@ +#!/bin/sh + +# +# Copyright (c) 2017 Dell EMC Isilon +# All rights reserved. +# +# 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: Lock (lockmgr) nullfs not locked @ kern/kern_lock.c:620." seen: +# https://people.freebsd.org/~pho/stress/log/nullfs23.txt + +. ../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 + +mp2=/media +mount | grep "$mp2" | grep -q nfs && umount $mp2 +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mp2 + +export nullfs_srcdir=$mp2 +../misc/nullfs17.sh + +umount $mp2 +while mount | grep "$mp2 " | grep -q nfs; do + umount -f $mp2 +done +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 06:35:27 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 0E99525B4E9 for ; Mon, 2 Mar 2020 06:35:27 +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 48W9PV5FRPz4F45; Mon, 2 Mar 2020 06:35:26 +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 AF4821854E; Mon, 2 Mar 2020 06:35:26 +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 0226ZQNW055544; Mon, 2 Mar 2020 06:35:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0226ZQwT055543; Mon, 2 Mar 2020 06:35:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020635.0226ZQwT055543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 06:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358526 - 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: 358526 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, 02 Mar 2020 06:35:27 -0000 Author: pho Date: Mon Mar 2 06:35:26 2020 New Revision: 358526 URL: https://svnweb.freebsd.org/changeset/base/358526 Log: Added an old regression test. Added: user/pho/stress2/misc/racct.sh (contents, props changed) Added: user/pho/stress2/misc/racct.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/racct.sh Mon Mar 2 06:35:26 2020 (r358526) @@ -0,0 +1,58 @@ +#!/bin/sh + +# +# Copyright (c) 2018 Dell EMC Isilon +# All rights reserved. +# +# 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$ +# +# Regression test inspired by Andriy Gapon for Bug 222027 - panic on +# non-zero RACCT destroy. + +# "panic: destroying non-empty racct ..." seen. +# https://people.freebsd.org/~pho/stress/log/racct.txt +# "Page fault in slab_free_item()" seen: +# https://people.freebsd.org/~pho/stress/log/racct-2.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ "`sysctl -in kern.racct.enable`" != "1" ] && + echo "Note: kern.racct.enable is disabled" +pgrep -Sq accounting || { service accounting onestart && started=1; } +(cd ../testcases/swap; ./swap -t 2m -i 5 -v -l 100) > /dev/null & +sleep .5 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 120 ]; do + pids="" + for i in `jot 5`; do + for i in `jot 500`; do + exec su -c xuser -m root -c ':' & + done & + pids="$pids $!" + done + wait $pids + while [ `pgrep su | wc -l` -gt 100 ]; do sleep 1; done +done +wait +[ $started ] && service accounting onestop +exit 0 From owner-svn-src-user@freebsd.org Mon Mar 2 07:33:16 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 0488525CD1A for ; Mon, 2 Mar 2020 07:33:16 +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 48WBhC63Xlz46dB; Mon, 2 Mar 2020 07:33:15 +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 AC5A019027; Mon, 2 Mar 2020 07:33:15 +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 0227XF50092837; Mon, 2 Mar 2020 07:33:15 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0227XFE9092836; Mon, 2 Mar 2020 07:33:15 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020733.0227XFE9092836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 07:33:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358529 - user/pho/stress2/testcases/swap X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/testcases/swap X-SVN-Commit-Revision: 358529 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, 02 Mar 2020 07:33:16 -0000 Author: pho Date: Mon Mar 2 07:33:15 2020 New Revision: 358529 URL: https://svnweb.freebsd.org/changeset/base/358529 Log: Fix compiler warnings. Added environment variable MAXSWAPPCT to controll max vVM pressure. Modified: user/pho/stress2/testcases/swap/swap.c Modified: user/pho/stress2/testcases/swap/swap.c ============================================================================== --- user/pho/stress2/testcases/swap/swap.c Mon Mar 2 07:13:00 2020 (r358528) +++ user/pho/stress2/testcases/swap/swap.c Mon Mar 2 07:33:15 2020 (r358529) @@ -46,37 +46,52 @@ __FBSDID("$FreeBSD$"); #define MINLEFT (1024LL * 1024 * 1024) #endif -static unsigned long size; +static int64_t size; int setup(int nb) { struct rlimit rlp; - int64_t swapinfo; - unsigned long mem; - int pct; + int64_t mem, swapinfo; + int mi, mx, pct; + char *cp; if (nb == 0) { mem = usermem(); swapinfo = swap(); pct = 0; - if (op->hog == 0) - pct = random_int(80, 100); + if (op->hog == 0) { + mi = 80; + mx = 100; + } - if (op->hog == 1) - pct = random_int(100, 110); + if (op->hog == 1) { + mi = 100; + mx = 110; + } - if (op->hog == 2) - pct = random_int(110, 120); + if (op->hog == 2) { + mi = 110; + mx = 120; + } - if (op->hog >= 3) - pct = random_int(120, 130); + if (op->hog >= 3) { + mi = 120; + mx = 130; + } + if ((cp = getenv("MAXSWAPPCT")) != NULL && *cp != '\0') { + mx = atoi(cp); + mi = mx - 10; + } + pct = random_int(mi, mx); if (swapinfo == 0) { pct = random_int(30, 50); - if (mem <= MINLEFT) + if (mem <= MINLEFT) { + putval(0); _exit(1); + } mem -= MINLEFT; size = mem / 100 * pct; } else { @@ -93,16 +108,21 @@ setup(int nb) err(1,"getrlimit"); rlp.rlim_cur -= 1024 * 1024; - if (size > (unsigned long)rlp.rlim_cur) + if (size > rlp.rlim_cur) size = rlp.rlim_cur; putval(size); if (op->verbose > 1 && nb == 0) - printf("setup: pid %d, %d%%. Total %luMb\n", - getpid(), pct, size / 1024 / 1024 * op->incarnations); + printf("setup: pid %d, %d%%. Total %dMb, %d thread(s).\n", + getpid(), pct, (int)(size / 1024 / 1024 * + op->incarnations), op->incarnations); } else size = getval(); + + if (size == 0) + exit(1); + return (0); } @@ -115,10 +135,12 @@ int test(void) { time_t start; - unsigned long i, oldsize; + int64_t i, oldsize; int page; volatile char *c; + if (size == 0) + return (0); oldsize = size; c = malloc(size); while (c == NULL && done_testing == 0) { @@ -126,8 +148,8 @@ test(void) c = malloc(size); } if (op->verbose > 1 && size != oldsize) - printf("Malloc size changed from %ld Mb to %ld Mb\n", - oldsize / 1024 / 1024, size / 1024 / 1024); + printf("Malloc size changed from %d Mb to %d Mb\n", + (int)(oldsize / 1024 / 1024), (int)(size / 1024 / 102)); page = getpagesize(); start = time(NULL); /* Livelock workaround */ while (done_testing == 0 && From owner-svn-src-user@freebsd.org Mon Mar 2 07:34:07 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 A2C0525CD6D for ; Mon, 2 Mar 2020 07:34:07 +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 48WBjC3vLLz47VQ; Mon, 2 Mar 2020 07:34:07 +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 8126719029; Mon, 2 Mar 2020 07:34:07 +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 0227Y7Gc092921; Mon, 2 Mar 2020 07:34:07 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0227Y7Vs092920; Mon, 2 Mar 2020 07:34:07 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020734.0227Y7Vs092920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 07:34:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358530 - user/pho/stress2/testcases/tcp X-SVN-Group: user X-SVN-Commit-Author: pho X-SVN-Commit-Paths: user/pho/stress2/testcases/tcp X-SVN-Commit-Revision: 358530 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, 02 Mar 2020 07:34:07 -0000 Author: pho Date: Mon Mar 2 07:34:07 2020 New Revision: 358530 URL: https://svnweb.freebsd.org/changeset/base/358530 Log: Addd a timeout. Modified: user/pho/stress2/testcases/tcp/tcp.c Modified: user/pho/stress2/testcases/tcp/tcp.c ============================================================================== --- user/pho/stress2/testcases/tcp/tcp.c Mon Mar 2 07:33:15 2020 (r358529) +++ user/pho/stress2/testcases/tcp/tcp.c Mon Mar 2 07:34:07 2020 (r358530) @@ -58,6 +58,7 @@ reader(void) { struct sockaddr_in inetaddr, inetpeer; int n, t, *buf; + alarm(op->run_time + 30); on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) err(1, "socket(), %s:%d", __FILE__, __LINE__); @@ -107,6 +108,7 @@ writer(void) { struct hostent *hostent; int i, *buf, r; + alarm(op->run_time + 30); on = 1; for (i = 1; i < 5; i++) { if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) From owner-svn-src-user@freebsd.org Mon Mar 2 07:40:09 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 3CE9C25CEFB for ; Mon, 2 Mar 2020 07:40:09 +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 48WBr90tc8z4CTS; Mon, 2 Mar 2020 07:40:09 +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 16BB819030; Mon, 2 Mar 2020 07:40:09 +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 0227e886093407; Mon, 2 Mar 2020 07:40:08 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0227e8K0093406; Mon, 2 Mar 2020 07:40:08 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003020740.0227e8K0093406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Mon, 2 Mar 2020 07:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358531 - 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: 358531 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, 02 Mar 2020 07:40:09 -0000 Author: pho Date: Mon Mar 2 07:40:08 2020 New Revision: 358531 URL: https://svnweb.freebsd.org/changeset/base/358531 Log: Added a regression test. Added: user/pho/stress2/misc/ping.sh (contents, props changed) Added: user/pho/stress2/misc/ping.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/ping.sh Mon Mar 2 07:40:08 2020 (r358531) @@ -0,0 +1,54 @@ +#!/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$ +# +# Regression test for r351461. Handle missing time stamp from SO_TIMESTAMP. +# Fixed by r352229 + +. ../default.cfg +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +[ -z "$nfs_export" ] && exit 0 +ip=`echo $nfs_export | sed 's/:.*//'` +ping -c 2 $ip > /dev/null 2>&1 || exit 0 + +log=/tmp/ping.log +tail -F -n 0 /var/log/messages > $log & +sleep .5 +pid=$! +for i in `jot 10`; do + ping -c 1 $ip & + pids="$pids $!" +done > /dev/null +for i in $pids; do wait $i; done +kill $pid +wait +grep "(ping)" $log && s=1 || s=0 +rm -f $log +exit $s From owner-svn-src-user@freebsd.org Tue Mar 3 10:03:00 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 3C5E026A78E for ; Tue, 3 Mar 2020 10:03:00 +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 48WsyX1djYz3y3y; Tue, 3 Mar 2020 10:03:00 +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 3156436E3; Tue, 3 Mar 2020 10:03:00 +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 023A30iw053385; Tue, 3 Mar 2020 10:03:00 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 023A2wa4053375; Tue, 3 Mar 2020 10:02:58 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003031002.023A2wa4053375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 3 Mar 2020 10:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358571 - 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: 358571 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: Tue, 03 Mar 2020 10:03:00 -0000 Author: pho Date: Tue Mar 3 10:02:58 2020 New Revision: 358571 URL: https://svnweb.freebsd.org/changeset/base/358571 Log: Added new tests all marked as "no run" for now. Added: user/pho/stress2/misc/force.sh (contents, props changed) user/pho/stress2/misc/force2.sh (contents, props changed) user/pho/stress2/misc/force3.sh (contents, props changed) user/pho/stress2/misc/force4.sh (contents, props changed) user/pho/stress2/misc/force5.sh (contents, props changed) user/pho/stress2/misc/getrandom2.sh (contents, props changed) Modified: user/pho/stress2/misc/all.sh Modified: user/pho/stress2/misc/all.sh ============================================================================== --- user/pho/stress2/misc/all.sh Tue Mar 3 09:51:53 2020 (r358570) +++ user/pho/stress2/misc/all.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -42,10 +42,16 @@ # collapse.sh panic: freeing mapped page 0xfffffe0028ed1d50 20200106 # dd.sh CAM stuck in vmwait 20200116 # devfs4.sh WiP 20181031 +# force.sh WiP 20200303 +# force2.sh WiP 20200303 +# force3.sh WiP 20200303 +# force4.sh Known issue 20200303 +# force5.sh WiP 20200303 # fsync.sh panic: Journal overflow 20190208 # fuse.sh Memory corruption seen in log file kostik734.txt 20141114 # fuse2.sh Deadlock seen 20121129 # fuse3.sh Deadlock seen 20141120 +# getrandom2.sh Known DoS issue 20200302 # gjournal.sh panic: Journal overflow 20190626 # gjournal2.sh panic: Journal overflow 20180125 # gjournal3.sh panic: Bio not on queue 20171225 Added: user/pho/stress2/misc/force.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/force.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,68 @@ +#!/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$ +# + +# "mdconfig -o force" test scenario. +# Run with marcus.cfg on a 1g swap backed MD with UFS SU fs. + +# Page fault seen in WiP kernel code: +# https://people.freebsd.org/~pho/stress/log/kirk113.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart +flags=$newfs_flags +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 & + +sleep `jot -r 1 10 40` +while mdconfig -l | grep md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 +done +sleep 1 +../tools/killall.sh +wait +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done +exit $s Added: user/pho/stress2/misc/force2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/force2.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,78 @@ +#!/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$ +# + +# "mdconfig -o force" test scenario. +# Run with marcus.cfg on a 1g swap backed MD with UFS SU fs. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +dd if=/dev/zero of=$diskimage bs=1m count=1k status=none || exit 1 +mdconfig -a -t vnode -f $diskimage -u $mdstart +flags=$newfs_flags +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 & + +sleep `jot -r 1 10 40` +while mdconfig -l | grep md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 +done +sleep 1 +../tools/killall.sh +wait +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done + +mdconfig -a -t vnode -f $diskimage -u $mdstart +fsck_ffs -Rfy /dev/md$mdstart > /dev/null; s=$? +if [ $s -eq 0 ]; then + mount /dev/md$mdstart $mntpoint + ls -lR $mntpoint > /dev/null + umount $mntpoint +fi +mdconfig -d -u $mdstart + +rm -f $diskimage +exit $s Added: user/pho/stress2/misc/force3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/force3.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,68 @@ +#!/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$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# "mdconfig -o force" test scenario. +# Copy of force.sh with an added "umount -f" +# Spin seen in umount() with WiP kernel code. + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart +flags=$newfs_flags +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=3m +export RUNDIR=$mntpoint/stressX + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' > /dev/null 2>&1 & + +sleep `jot -r 1 10 40` +while mdconfig -l | grep md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 +done +sleep .`jot -r 1 1 9` +umount -f $mntpoint +../tools/killall.sh +wait +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done +exit $s Added: user/pho/stress2/misc/force4.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/force4.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,91 @@ +#!/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$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# "mdconfig -o force" test scenario with nullfs. + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart +flags=$newfs_flags +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +mp2=${mntpoint}2 +mkdir -p $mp2 +mount -t nullfs $mntpoint $mp2 || exit 1 + +export LOAD=80 +export MAXSWAPPCT=80 +export RUNDIR=$mp2/stressX +export runRUNTIME=3m +export rwLOAD=80 +export TESTPROGS=' +testcases/lockf2/lockf2 +testcases/symlink/symlink +testcases/openat/openat +testcases/socket/socket +testcases/rw/rw +testcases/mmap/mmap +testcases/fts/fts +testcases/link/link +testcases/lockf/lockf +testcases/creat/creat +testcases/mkdir/mkdir +testcases/rename/rename +testcases/swap/swap +testcases/mkfifo/mkfifo +testcases/dirnprename/dirnprename +testcases/dirrename/dirrename +' + +su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & + +sleep `jot -r 1 20 60` +while mdconfig -l | grep md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 +done +sleep 1 +../tools/killall.sh +wait +umount $mp2 +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done +exit $s Added: user/pho/stress2/misc/force5.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/force5.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,76 @@ +#!/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$ +# + +# "mdconfig -o force" test scenario. +# Rename focus + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart +flags=$newfs_flags +[ `jot -r 1 0 1` -eq 1 ] && flags="-j" +echo "newfs $flags md$mdstart" +newfs $flags md$mdstart > /dev/null +mount /dev/md$mdstart $mntpoint +chmod 777 $mntpoint + +export LOAD=80 +export MAXSWAPPCT=80 +export RUNDIR=$mntpoint/stressX +export runRUNTIME=3m +export rwLOAD=80 +export TESTPROGS=' +testcases/fts/fts +testcases/rename/rename +testcases/swap/swap +testcases/dirnprename/dirnprename +testcases/dirrename/dirrename +' + +su $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > /dev/null 2>&1 & + +sleep `jot -r 1 20 60` +while mdconfig -l | grep md$mdstart; do + mdconfig -d -u $mdstart -o force || sleep 1 +done +sleep 1 +../tools/killall.sh +wait +n=0 +while mount | grep $mntpoint | grep -q /dev/md; do + umount $mntpoint || sleep 1 + [ $((n += 1)) -gt 300 ] && { echo FAIL; exit 1; } +done +exit $s Added: user/pho/stress2/misc/getrandom2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/getrandom2.sh Tue Mar 3 10:02:58 2020 (r358571) @@ -0,0 +1,190 @@ +#!/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$ +# + +# getrandom(2) DoS scenario. + +# panic: pmap_growkernel: no memory to grow kernel +# cpuid = 8 +# time = 1582102582 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe03e6992450 +# vpanic() at vpanic+0x185/frame 0xfffffe03e69924b0 +# panic() at panic+0x43/frame 0xfffffe03e6992510 +# pmap_growkernel() at pmap_growkernel+0x2d4/frame 0xfffffe03e6992550 +# vm_map_insert() at vm_map_insert+0x296/frame 0xfffffe03e69925f0 +# vm_map_find() at vm_map_find+0x617/frame 0xfffffe03e69926d0 +# kva_import() at kva_import+0x3c/frame 0xfffffe03e6992710 +# vmem_try_fetch() at vmem_try_fetch+0xde/frame 0xfffffe03e6992760 +# vmem_xalloc() at vmem_xalloc+0x4bb/frame 0xfffffe03e69927e0 +# kva_import_domain() at kva_import_domain+0x36/frame 0xfffffe03e6992810 +# vmem_try_fetch() at vmem_try_fetch+0xde/frame 0xfffffe03e6992860 +# vmem_xalloc() at vmem_xalloc+0x4bb/frame 0xfffffe03e69928e0 +# vmem_alloc() at vmem_alloc+0x8a/frame 0xfffffe03e6992930 +# kmem_malloc_domainset() at kmem_malloc_domainset+0x92/frame 0xfffffe03e69929a0 +# malloc() at malloc+0x162/frame 0xfffffe03e69929f0 +# read_random_uio() at read_random_uio+0xa5/frame 0xfffffe03e6992a40 +# sys_getrandom() at sys_getrandom+0x7b/frame 0xfffffe03e6992ac0 +# amd64_syscall() at amd64_syscall+0x183/frame 0xfffffe03e6992bf0 +# fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe03e6992bf0 +# --- syscall (563, FreeBSD ELF64, sys_getrandom), rip = 0x80041899a, rsp = 0x7ffffffc3cb8, rbp = 0x7ffffffc3cd0 --- +# KDB: enter: panic +# [ thread pid 12095 tid 186584 ] +# Stopped at kdb_enter+0x37: movq $0,0x1084916(%rip) +# db> x/s version +# version: FreeBSD 13.0-CURRENT #0 r358094: Wed Feb 19 06:25:16 CET 2020\012 pho@t2.osted.lan:/usr/src/sys/amd64/compile/PHO\012 +# db> + +. ../default.cfg + +dir=/tmp +odir=`pwd` +cd $dir +sed '1,/^EOF/d' < $odir/$0 > $dir/getrandom2.c +mycc -o getrandom2 -Wall -Wextra -O0 -g getrandom2.c || exit 1 +rm -f getrandom2.c +cd $odir + +cd /tmp +$dir/getrandom2 +s=$? +[ -f getrandom2.core -a $s -eq 0 ] && + { ls -l getrandom2.core; s=1; } +cd $odir + +rm -rf $dir/getrandom2 +exit $s + +EOF +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static size_t mx; +static _Atomic(int) *share; +static int parallel; +static char *bp; + +#define PARALLEL 40000 /* Arbitrary cap */ +#define SYNC 0 + +static void +test(void) +{ + int i; + + alarm(180); + (void)atomic_fetch_add(&share[SYNC], 1); + while (atomic_load(&share[SYNC]) != parallel) + usleep(200000); + for (i = 0; i < 10; i++) + getrandom(bp, mx, 0); +// close(66); + + _exit(0); +} + +int +main(void) +{ + pid_t *pids; + struct rlimit rlp; + size_t len; + size_t f, vsz; + u_int pages; + int e, i, status; + + e = 0; + len = PAGE_SIZE; + if ((share = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0)) == MAP_FAILED) + err(1, "mmap"); + + if (getrlimit(RLIMIT_NPROC, &rlp) < 0) + err(1, "getrlimit"); + parallel = rlp.rlim_cur / 100 * 80; + if (parallel > PARALLEL) + parallel = PARALLEL; + pids = calloc(parallel, sizeof(pid_t)); + + vsz = sizeof(pages); + if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &vsz, NULL, 0) != 0) + err(1, "sysctl(vm.stats.vm.v_free_count)"); + f = pages; + f *= PAGE_SIZE; + + if (getrlimit(RLIMIT_DATA, &rlp) < 0) + err(1,"getrlimit"); + mx = rlp.rlim_cur; + if (mx > f / parallel) + mx = f / parallel; + if ((bp = mmap(NULL, mx, PROT_READ | PROT_WRITE, MAP_ANON, -1, + 0)) == MAP_FAILED) + err(1, "mmap"); + for (;;) { + if (getrandom(bp, mx, 0) != -1) + break; + mx = mx / 2; + } + printf("Max getrandom() buffer size is %zu, %d threads\n", mx, + parallel); + for (i = 0; i < parallel; i++) { + if ((pids[i] = fork()) == 0) + test(); + if (pids[i] == -1) + err(1, "fork()"); + } + for (i = 0; i < parallel; i++) { + if (waitpid(pids[i], &status, 0) == -1) + err(1, "waitpid(%d)", pids[i]); + if (status != 0) { + if (WIFSIGNALED(status)) + fprintf(stderr, + "pid %d exit signal %d\n", + pids[i], WTERMSIG(status)); + } + e += status == 0 ? 0 : 1; + } + + return (e); +} From owner-svn-src-user@freebsd.org Thu Mar 5 09:19:28 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 9E031263637 for ; Thu, 5 Mar 2020 09:19:28 +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 48Y4vN0LByz3Pg8; Thu, 5 Mar 2020 09:19:27 +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 EE51D4EE7; Thu, 5 Mar 2020 09:19:26 +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 0259JQvp061431; Thu, 5 Mar 2020 09:19:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0259JQBj061430; Thu, 5 Mar 2020 09:19:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003050919.0259JQBj061430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Thu, 5 Mar 2020 09:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358667 - 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: 358667 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: Thu, 05 Mar 2020 09:19:28 -0000 Author: pho Date: Thu Mar 5 09:19:26 2020 New Revision: 358667 URL: https://svnweb.freebsd.org/changeset/base/358667 Log: Added an old test scenario. Added: user/pho/stress2/misc/fifo4.sh (contents, props changed) Added: user/pho/stress2/misc/fifo4.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/fifo4.sh Thu Mar 5 09:19:26 2020 (r358667) @@ -0,0 +1,82 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Dell EMC Isilon +# +# 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$ +# + +# tmpfs(5) version of fifo2.sh +# No problems seen on HEAD. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +odir=`pwd` +cd /tmp +sed '1,/^EOF/d' < $odir/fifo2.sh > fifo2.c +rm -f /tmp/fifo2 +mycc -o fifo2 -Wall -Wextra -O2 -g fifo2.c -lpthread || exit 1 +rm -f fifo2.c + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint + +mount -o size=1g -t tmpfs tmpfs $mntpoint +chmod 777 $mntpoint +for i in `jot 5`; do + mkfifo $mntpoint/f$i + chmod 777 $mntpoint/f$i +done + +daemon sh -c "(cd $odir/../testcases/swap; ./swap -t 10m -i 20 -l 100)" > \ + /dev/null +sleeptime=12 +st=`date '+%s'` +while [ $((`date '+%s'` - st)) -lt $((10 * sleeptime)) ]; do + (cd $mntpoint; /tmp/fifo2) & + while ! pgrep -q fifo2; do :; done + start=`date '+%s'` + while [ $((`date '+%s'` - start)) -lt $sleeptime ]; do + pgrep -q fifo2 || break + sleep .5 + done + while pgrep -q fifo2; do pkill -9 fifo2; done + wait +done +pkill -9 swap fifo2 +while pgrep -q "swap|fifo2"; do pkill -9 swap fifo2; done + +for i in `jot 10`; do + mount | grep -q "on $mntpoint " && \ + umount $mntpoint > /dev/null 2>&1 && break + sleep 10 +done +s=0 +mount | grep -q "on $mntpoint " && + { echo "umount $mntpoint failed"; s=1; } +rm -f /tmp/fifo2 +exit $s From owner-svn-src-user@freebsd.org Thu Mar 5 09:20:34 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 6BEC4263703 for ; Thu, 5 Mar 2020 09:20:34 +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 48Y4wf14L1z3R2f; Thu, 5 Mar 2020 09:20:34 +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 1AFF44EF2; Thu, 5 Mar 2020 09:20:33 +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 0259KWbL061562; Thu, 5 Mar 2020 09:20:32 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0259KW1J061561; Thu, 5 Mar 2020 09:20:32 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003050920.0259KW1J061561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Thu, 5 Mar 2020 09:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358668 - 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: 358668 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: Thu, 05 Mar 2020 09:20:34 -0000 Author: pho Date: Thu Mar 5 09:20:32 2020 New Revision: 358668 URL: https://svnweb.freebsd.org/changeset/base/358668 Log: Added an old NUMA test scenario. Added: user/pho/stress2/misc/numa.sh (contents, props changed) Added: user/pho/stress2/misc/numa.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/numa.sh Thu Mar 5 09:20:32 2020 (r358668) @@ -0,0 +1,47 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2018 Dell EMC Isilon +# +# 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$ + +# Test scenario: Last memory domain significantly smaller than the others. +# https://people.freebsd.org/~pho/stress/log/numa.txt +# Test scenario description by markj@ + +[ `sysctl -n vm.ndomains` -eq 1 ] && exit 0 + +doms=`sysctl -n vm.ndomains` +phys=`sysctl -n hw.physmem` # clamped size +real=`sysctl -n hw.realmem` # HW size + +goal=$((real - (real / doms) + 2 * 1024 * 1024 * 1024)) +mb=$((goal / 1024 / 1024)) +[ $phys -gt $goal ] && + { echo "hw.physmem must be set to ${mb}M for this test."; exit 0; } + +../misc/sort.sh +exit From owner-svn-src-user@freebsd.org Fri Mar 6 07:07:26 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 92728261463 for ; Fri, 6 Mar 2020 07:07:26 +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 48YdwZ2xC6z4LP6; Fri, 6 Mar 2020 07:07:26 +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 2E3DD1C673; Fri, 6 Mar 2020 07:07:26 +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 02677QXx045745; Fri, 6 Mar 2020 07:07:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02677Qsv045744; Fri, 6 Mar 2020 07:07:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <202003060707.02677Qsv045744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Fri, 6 Mar 2020 07:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358692 - 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: 358692 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: Fri, 06 Mar 2020 07:07:26 -0000 Author: pho Date: Fri Mar 6 07:07:25 2020 New Revision: 358692 URL: https://svnweb.freebsd.org/changeset/base/358692 Log: Added a regression test. Added: user/pho/stress2/misc/jexec.sh (contents, props changed) Added: user/pho/stress2/misc/jexec.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/jexec.sh Fri Mar 6 07:07:25 2020 (r358692) @@ -0,0 +1,69 @@ +#!/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$ +# + +# Bug 238032 - "jexec pr_ref leak" by bz@ +# "foo DYING" seen. +# Fixed by r358676 + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +[ -z "$nfs_export" ] && exit 0 +ping -c 2 `echo $nfs_export | sed 's/:.*//'` > /dev/null 2>&1 || + exit 0 +mount | grep "$mntpoint" | grep -q nfs && umount $mntpoint +mount -t nfs -o tcp -o retrycnt=3 -o intr,soft -o rw $nfs_export $mntpoint + +here=`pwd` +cd $mntpoint +(cd $here/../testcases/swap; ./swap -t 2m -i 20) & +sleep 10 +jail -c name=foo persist +start=`date +%s` +while [ $((`date +%s`- start)) -lt 120 ]; do + jexec foo <<-EOF + sleep .2 +EOF +done > /dev/null 2>&1 +jail -r foo +jls -dv | grep foo && s=1 || s=0 + +cd $here +for i in `jot 5`; do + umount $mntpoint && break + sleep 2 +done +wait + +# Break into kgdb and type "show prison" +# Check ref count growth + +exit $s