Index: user/pho/stress2/misc/kevent7.sh =================================================================== --- user/pho/stress2/misc/kevent7.sh (revision 297315) +++ user/pho/stress2/misc/kevent7.sh (revision 297316) @@ -1,265 +1,268 @@ #!/bin/sh # # Copyright (c) 2013 EMC Corp. # 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$ # # Threaded syscall(2) fuzz test inspired by the iknowthis test suite # by Tavis Ormandy # kevent(2) with random arguments. # Spinning threads seen. # Fixed in r255877. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg ulimit -t 200 odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > kevent7.c rm -f /tmp/kevent7 mycc -o kevent7 -Wall -Wextra -O2 -g kevent7.c -lpthread || exit 1 rm -f kevent7.c 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 2g -u $mdstart || exit 1 bsdlabel -w md$mdstart auto newfs $newfs_flags md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint for i in `jot 5`; do (cd $mntpoint; /tmp/kevent7 $* < /dev/null) & sleep 60 - killall -9 kevent7 + while pgrep -q kevent7; do + pkill -9 kevent7 + sleep 1 + done done for i in `jot 5`; do mount | grep -q md${mdstart}$part && \ umount $mntpoint && mdconfig -d -u $mdstart && break sleep 10 done if mount | grep -q md${mdstart}$part; then fstat $mntpoint echo "umount $mntpoint failed" exit 1 fi rm -f /tmp/kevent7 -exit +exit 0 EOF #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include int fd[900], fds[2], socketpr[2]; #define N (128 * 1024 / (int)sizeof(u_int32_t)) u_int32_t r[N]; int syscallno; static void hand(int i __unused) { /* handler */ _exit(1); } unsigned long makearg(void) { unsigned int i; unsigned long val; 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); } void * test(void *arg __unused) { FTS *fts; FTSENT *p; int ftsoptions; char *args[5]; int i; ftsoptions = FTS_PHYSICAL; args[0] = "/dev"; args[1] = "/proc"; args[2] = "/usr/compat/linux/proc"; args[3] = "."; args[4] = 0; for (;;) { for (i = 0; i < N; i++) r[i] = arc4random(); if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) err(1, "fts_open"); i = 0; while ((p = fts_read(fts)) != NULL) { if (fd[i] > 0) close(fd[i]); if ((fd[i] = open(p->fts_path, O_RDWR)) == -1) if ((fd[i] = open(p->fts_path, O_WRONLY)) == -1) if ((fd[i] = open(p->fts_path, O_RDONLY)) == -1) continue; i++; i = i % 900; } if (fts_close(fts) == -1) if (errno != ENOTDIR) warn("fts_close()"); if (pipe(fds) == -1) err(1, "pipe()"); if (socketpair(PF_UNIX, SOCK_SEQPACKET, 0, socketpr) == -1) err(1, "socketpair()"); sleep(1); close(socketpr[0]); close(socketpr[1]); close(fds[0]); close(fds[1]); } return(0); } void * calls(void *arg __unused) { int i, kq, num; unsigned long arg1, arg2, arg3, arg4, arg5, arg6, arg7; if ((kq = kqueue()) < 0) err(1, "kqueue()"); for (i = 0;; i++) { if (i == 0) usleep(1000); num = syscallno; arg1 = makearg(); arg2 = makearg(); arg3 = makearg(); arg4 = makearg(); arg5 = makearg(); arg6 = makearg(); arg7 = makearg(); #if 0 fprintf(stderr, "%2d : syscall(%3d, %lx, %lx, %lx, %lx, %lx, %lx, %lx)\n", i, num, arg1, arg2, arg3, arg4, arg5, arg6, arg7); #endif alarm(1); syscall(num, arg1, arg2, arg3, arg4, arg5, arg6, arg7); num = 0; } close(kq); return (0); } int main(void) { struct passwd *pw; time_t start; pthread_t rp, cp[50]; int e, j; if ((pw = getpwnam("nobody")) == NULL) err(1, "no such user: nobody"); if (setgroups(1, &pw->pw_gid) || setegid(pw->pw_gid) || setgid(pw->pw_gid) || seteuid(pw->pw_uid) || setuid(pw->pw_uid)) err(1, "Can't drop privileges to \"nobody\""); endpwent(); signal(SIGALRM, hand); signal(SIGILL, hand); signal(SIGFPE, hand); signal(SIGSEGV, hand); signal(SIGBUS, hand); signal(SIGURG, hand); signal(SIGSYS, hand); signal(SIGTRAP, hand); syscallno = SYS_kevent; start = time(NULL); while (time(NULL) - start < 120) { if (fork() == 0) { arc4random_stir(); if ((e = pthread_create(&rp, NULL, test, NULL)) != 0) errc(1, e, "pthread_create"); usleep(1000); for (j = 0; j < 50; j++) if ((e = pthread_create(&cp[j], NULL, calls, NULL)) != 0) errc(1, e, "pthread_create"); for (j = 0; j < 50; j++) pthread_join(cp[j], NULL); _exit(0); } wait(NULL); } return (0); } Index: user/pho/stress2/misc/ldt.sh =================================================================== --- user/pho/stress2/misc/ldt.sh (revision 297315) +++ user/pho/stress2/misc/ldt.sh (revision 297316) @@ -1,371 +1,372 @@ #!/bin/sh # # Copyright (c) 2009 Peter Holm # 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$ # # Test the amd64 implementation of: # 1. Per-process private ldt and corresponding i386 arch syscalls. # 2. Per-process private io permission bitmap and corresponding # i386 arch syscalls. # 3. Sigcontext # The tests must be compiled on i386 and run on amd64 # All tests by kib@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg cd /tmp if [ "`uname -p`" = "i386" ]; then cat > ldt.c < #include #include #include #include #include #include #include #include #include #include char stack[64 * 1024]; char a[1]; int s2ds(int sel) { return (LSEL(sel, SEL_UPL)); } unsigned char readbyte(int sel, int offset) { unsigned char res; __asm__ volatile( "\tpushl %%es\n" "\tmovl %1,%%es\n" "\tmovb %%es:(%2),%0\n" "\tpopl %%es\n" : "=r"(res) : "r"(s2ds(sel)), "r"(offset)); return (res); } void writebyte(int sel, int offset, unsigned char val) { __asm__ volatile( "\tpushl %%es\n" "\tmovl %0,%%es\n" "\tmovb %2,%%es:(%1)\n" "\tpopl %%es\n" : : "r"(s2ds(sel)), "r"(offset), "r"(val) : "memory"); } int alloc_sel(char *base, size_t len, int type, int p) { int sel; union descriptor descs[1], descsk[1]; uintptr_t pb; memset(descs, 0, sizeof(descs)); if (len > PAGE_SIZE) { len = roundup(len, PAGE_SIZE); len /= PAGE_SIZE; descs[0].sd.sd_lolimit = len & 0xffff; descs[0].sd.sd_hilimit = (len >> 16) & 0xf; descs[0].sd.sd_gran = 1; } else { descs[0].sd.sd_lolimit = len; descs[0].sd.sd_hilimit = 0; descs[0].sd.sd_gran = 0; } pb = (uintptr_t)base; descs[0].sd.sd_lobase = pb & 0xffffff; descs[0].sd.sd_hibase = (pb >> 24) & 0xff; descs[0].sd.sd_type = type; descs[0].sd.sd_dpl = SEL_UPL; descs[0].sd.sd_p = p; descs[0].sd.sd_def32 = 1; if ((sel = i386_set_ldt(LDT_AUTO_ALLOC, descs, 1)) == -1) fprintf(stderr, "i386_set_ldt: %s\n", strerror(errno)); else if (i386_get_ldt(sel, descsk, 1) == -1) { fprintf(stderr, "i386_get_ldt: %s\n", strerror(errno)); sel = -1; } else if (memcmp(descs, descsk, sizeof(descs)) != 0) { fprintf(stderr, "descs != descsk\n"); sel = -1; } else fprintf(stderr, "selector %d\n", sel); return (sel); } int test1(int tnum, int sel) { unsigned char ar; writebyte(sel, 0, '1'); ar = readbyte(sel, 0); if (ar == '1') fprintf(stderr, "test %d.1 ok\n", tnum); else fprintf(stderr, "test%d.1 failed, ar %x\n", tnum, ar); writebyte(sel, 0, '2'); ar = readbyte(sel, 0); if (ar == '2') fprintf(stderr, "test %d.2 ok\n", tnum); else fprintf(stderr, "test%d.2 failed, ar %x\n", tnum, ar); return (sel); } int test2_func(void *arg) { int *sel; sel = arg; test1(2, *sel); rfork(0); test1(3, *sel); return (0); } void test2(int sel) { pid_t r; int status; r = rfork_thread(RFPROC | RFMEM, stack + sizeof(stack), test2_func, &sel); if (r == -1) { fprintf(stderr, "rfork(RFPROC): %s\n", strerror(errno)); return; } else { waitpid(r, &status, 0); if (WIFSIGNALED(status)) { fprintf(stderr, "test2: child terminated by %s\n", strsignal(WTERMSIG(status))); } } } int main(int argc, char *argv[]) { int sel; sel = alloc_sel(a, 1, SDT_MEMRWA, 1); if (sel == -1) return (1); test1(1, sel); test2(sel); return (0); } EOF cc -o ldt_static_i386 -Wall -static ldt.c rm ldt.c cat > ioperm.c < #include #include #include #include #include static const unsigned int port_num = 0x130; unsigned char inb(unsigned int port) { unsigned char data; __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); return (data); } void sigbus_handler(int signo) { fprintf(stderr, "Got SIGBUS\n"); exit(0); } int main(int argc, char *argv[]) { struct sigaction sa; unsigned int length1; int enable1; if (i386_get_ioperm(port_num, &length1, &enable1) == -1) { fprintf(stderr, "get 1: %s\n", strerror(errno)); return (1); } if (length1 != 0 && enable1 != 0) { fprintf(stderr, "enable1: enabled\n"); return (1); } if (i386_set_ioperm(port_num, 1, 1) == -1) { fprintf(stderr, "set 1: %s\n", strerror(errno)); return (1); } inb(port_num); if (i386_set_ioperm(port_num, 1, 0) == -1) { fprintf(stderr, "set 2: %s\n", strerror(errno)); return (1); } if (i386_get_ioperm(port_num, &length1, &enable1) == -1) { fprintf(stderr, "get 1: %s\n", strerror(errno)); return (1); } if (enable1 != 0) { fprintf(stderr, "enable2: enabled\n"); return (1); } fprintf(stderr, "And now we should get SIGBUS\n"); memset(&sa, 0, sizeof(sa)); sa.sa_handler = sigbus_handler; if (sigaction(SIGBUS, &sa, NULL) == -1) { fprintf(stderr, "sigaction(SIGBUS): %s\n", strerror(errno)); return (1); } inb(port_num); return (0); } EOF cc -o ioperm_static_i386 -Wall -static ioperm.c rm ioperm.c cat > fault.c < #include #include #include #include #include #include #include extern char *fault_instr; int run; void sigsegv_sigaction(int signo, siginfo_t *si, void *c) { ucontext_t *uc; mcontext_t *mc; uc = c; mc = &uc->uc_mcontext; printf("SIGSEGV run %d err %x ds %x ss %x es %x fs %x gs %x\n", run, mc->mc_err, mc->mc_ds, mc->mc_ss, mc->mc_es, mc->mc_fs, mc->mc_gs); switch (run) { case 0: mc->mc_ds = 0x1111; break; case 1: mc->mc_es = 0x1111; break; case 2: mc->mc_fs = 0x1111; break; case 3: mc->mc_gs = 0x1111; break; case 4: mc->mc_ss = 0x1111; break; case 5: _exit(11); } run++; } void fault(void) { __asm__ volatile(".globl\tfault_instr;fault_instr:\ttestl\t\$0,0\n"); } int main(int argc, char *argv[]) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_sigaction = sigsegv_sigaction; sa.sa_flags = SA_SIGINFO; if (sigaction(SIGSEGV, &sa, NULL) == -1) { fprintf(stderr, "sigaction: %s\n", strerror(errno)); return (1); } if (sigaction(SIGBUS, &sa, NULL) == -1) { fprintf(stderr, "sigaction: %s\n", strerror(errno)); return (1); } fault(); return (0); } EOF cc -o fault_static_i386 -Wall -static fault.c rm fault.c fi if [ "`uname -p`" = "amd64" ]; then [ -x ldt_static_i386 ] && ./ldt_static_i386 [ -x ioperm_static_i386 ] && ./ioperm_static_i386 [ -x fault_static_i386 ] && ./fault_static_i386 fi +exit 0 Index: user/pho/stress2/misc/mac.sh =================================================================== --- user/pho/stress2/misc/mac.sh (revision 297315) +++ user/pho/stress2/misc/mac.sh (revision 297316) @@ -1,40 +1,40 @@ #!/bin/sh # # Copyright (c) 2008 Peter Holm # 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$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 if sysctl security.mac.test 2>&1 | grep -q unknown; then echo "Kernel must be configured with MAC and MAC_TEST!" - exit 1 + exit 0 fi ./crossmp.sh sysctl security.mac.test Index: user/pho/stress2/misc/nullfs17.sh =================================================================== --- user/pho/stress2/misc/nullfs17.sh (revision 297315) +++ user/pho/stress2/misc/nullfs17.sh (revision 297316) @@ -1,86 +1,86 @@ #!/bin/sh # # Copyright (c) 2016 EMC Corp. # 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$ # # Variation of nullfs.sh # "panic: LK_RETRY set with incompatible flags (0x202400) or # an error occured (11)" seen. # https://people.freebsd.org/~pho/stress/log/matt001.txt [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg mounts=15 # Number of parallel scripts : ${nullfs_srcdir:=/tmp} : ${nullfs_dstdir:=$mntpoint} CONT=/tmp/nullfs17.continue if [ $# -eq 0 ]; then for i in `jot $mounts`; do [ ! -d ${nullfs_dstdir}$i ] && mkdir ${nullfs_dstdir}$i mount | grep -q " ${nullfs_dstdir}$i " && umount ${nullfs_dstdir}$i done # start the parallel tests for i in `jot $mounts`; do ./$0 $i & ./$0 find $i & done wait for i in `jot $mounts`; do umount ${nullfs_dstdir}$i > /dev/null 2>&1 done - + exit 0 else if [ $1 = find ]; then while [ -f $CONT ]; do find ${nullfs_dstdir}$2 -type f -maxdepth 2 -ls > \ /dev/null 2>&1 done else # The test: Parallel mount and unmounts touch $CONT start=`date '+%s'` while [ `date '+%s'` -lt $((start + 300)) ]; do m=$1 mount_nullfs $nullfs_srcdir ${nullfs_dstdir}$m > \ /dev/null 2>&1 opt=`[ $(( m % 2 )) -eq 0 ] && echo -f` while mount | grep -q ${nullfs_dstdir}$m; do umount $opt ${nullfs_dstdir}$m > \ /dev/null 2>&1 done done rm -f $CONT fi fi Index: user/pho/stress2/misc/nullfs3.sh =================================================================== --- user/pho/stress2/misc/nullfs3.sh (revision 297315) +++ user/pho/stress2/misc/nullfs3.sh (revision 297316) @@ -1,57 +1,58 @@ #!/bin/sh # # Copyright (c) 2009 Peter Holm # 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$ # # Test scenario by "Paul B. Mahol" # Caused: lock violation [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg # NULLFS(5) and SUJ has known issues. mount | grep "on `df $RUNDIR | sed '1d;s/.* //'` " | \ grep -q "journaled soft-updates" && { echo "Skipping test due to SUJ."; exit 0; } [ -d $RUNDIR/stressX ] || mkdir -p $RUNDIR/stressX mp=$mntpoint mount | grep -q $mp && umount -f $mp mount -t nullfs `dirname $RUNDIR` $mp cd $mp/stressX whereis something > /dev/null cd / umount $mp mount | grep -q $mp && umount -f $mp +exit 0 Index: user/pho/stress2/misc/procfs2.sh =================================================================== --- user/pho/stress2/misc/procfs2.sh (revision 297315) +++ user/pho/stress2/misc/procfs2.sh (revision 297316) @@ -1,37 +1,38 @@ #!/bin/sh # # Copyright (c) 2010 Peter Holm # 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: projects/stress2/misc/procfs.sh 187224 2009-01-14 16:03:10Z pho $ # # panic: not suspended thread 0xc674c870 # Found by scrashme and fixed in r216120 for i in `find /proc ! -type d`; do dd if=$i of=/dev/null > /dev/null 2>&1 dd if=/dev/random of=$i > /dev/null 2>&1 done +exit 0 Index: user/pho/stress2/misc/quota5.sh =================================================================== --- user/pho/stress2/misc/quota5.sh (revision 297315) +++ user/pho/stress2/misc/quota5.sh (revision 297316) @@ -1,45 +1,45 @@ #!/bin/sh # # Copyright (c) 2008-2011 Peter Holm # 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$ # [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 mount | grep -q "on /tmp (ufs," || exit 0 if ! grep /tmp /etc/fstab | grep -q quota ; then echo "/tmp must have quota enabled!" - exit 2 + exit 0 fi edquota -u -f /tmp -e /tmp:1500000:1400000:200000:180000 $testuser edquota -g -f /tmp -e /tmp:1500000:1400000:200000:180000 $testuser quotaon /tmp su $testuser -c "export runRUNTIME=60m; cd ../testcases/mkdir; \ ./mkdir -t 30m -i 200 -v -v" quotaoff /tmp Index: user/pho/stress2/misc/tmpfs3.sh =================================================================== --- user/pho/stress2/misc/tmpfs3.sh (revision 297315) +++ user/pho/stress2/misc/tmpfs3.sh (revision 297316) @@ -1,46 +1,47 @@ #!/bin/sh # # Copyright (c) 2009-2011 Peter Holm # 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: tmpfs_alloc_vp: type 0xc866ce58 0, seen. [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 . ../default.cfg mount | grep "$mntpoint" | grep -q tmpfs && umount $mntpoint mount -t tmpfs tmpfs $mntpoint export RUNDIR=$mntpoint/stressX export runRUNTIME=10m # Run tests for 10 minutes (cd ..; ./run.sh vfs.cfg) umount $mntpoint mount | grep "$mntpoint" | grep -q tmpfs && umount -f $mntpoint +exit 0 Index: user/pho/stress2/misc/trim6.sh =================================================================== --- user/pho/stress2/misc/trim6.sh (revision 297315) +++ user/pho/stress2/misc/trim6.sh (revision 297316) @@ -1,59 +1,60 @@ #!/bin/sh # # Copyright (c) 2015 EMC Corp. # 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$ # # Test scenario for exhausting limited malloc KVA on 32bit machine, by # extending a file on a UFS SU volume. # Create a large file on a file system with trim enabled. # Watchdog timeout seen: # https://people.freebsd.org/~pho/stress/log/trim6.txt # Fixed by r287361. # "panic: negative mnt_ref" seen: # https://people.freebsd.org/~pho/stress/log/kostik835.txt [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 r=`mount | grep -w soft-updates | awk '{print $1}' | while read dev; do dumpfs $dev | head -20 | grep -qw trim || continue df -k $dev done | sort -rn +3 | head -1 | awk '{print $4, $6}'` [ -z "$r" ] && exit # No trim enabled file systems found set $r free=$(($1 / 1024 / 10 * 9)) # in Mb max=$((128 * 1024)) # Max is 128 GB [ $free -gt $max ] && free=$max mp=$2 image=`echo $mp/diskimage | sed s#//#/#` # fix "//" for case mp = "/" -trap "rm -f $image" EXIT SIGINT +trap "rm -f $image" EXIT INT echo "dd if=/dev/zero of=$image bs=1m count=$free" dd if=/dev/zero of=$image bs=1m count=$free 2>&1 | egrep -v 'records|transferred' +exit 0