From nobody Sat Jan 08 06:11:45 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 59346194B56B; Sat, 8 Jan 2022 06:11:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JW8qk0ZRdz3nZx; Sat, 8 Jan 2022 06:11:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E89161947F; Sat, 8 Jan 2022 06:11:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2086BjCH066702; Sat, 8 Jan 2022 06:11:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2086Bj5C066701; Sat, 8 Jan 2022 06:11:45 GMT (envelope-from git) Date: Sat, 8 Jan 2022 06:11:45 GMT Message-Id: <202201080611.2086Bj5C066701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: bf48a958ad10 - main - stress2: Aded two msdos FS fuzzer tests List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf48a958ad100bf59604bb31a433582ba8aa12b9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641622306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7KV6hTpoXTzv/s0+3KCJtdVyKbYk5NoHgFr0mIikN70=; b=cYM3Pj2b0HFyNOxeGibq7yMx4MRhkQ/vkw0ljNECHkK7pde+v4bDI9EQjIy9sQCj4Vva64 yka5HILnlAKowKUUYF2BsvCMWpBMBEX8Iw7FGvc+05brd4Dwl+pJVxyg/J8Ks22iZqq9s2 5s7vSIICAB9R7IHaaRVYnK/qFIVATFoufAhD+QsV1Q7rKq9XIvtl2oHov465YtK6y+0Igb 8z4gZwXpdbhxLqa0ach+F8yTHfauzvyb3M7OLsnYB5CNcDwm3iMRnHw8yim5W51WWB68gJ bFXkGz3lSK48ZkXJMAH0U6/myrF2+i95goUubfSImwojhFePxR7SLO83aURNVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641622306; a=rsa-sha256; cv=none; b=G+K3YShmpNIThKdK+afRMLJpvIuEdOmOF3ClOL2tu0Z7SD56YvxAmpTIPLPcCxYHU/DBbZ yCod9WgqpYCXNL1T2/n3f5OMebqWCN8FjFlXxGdg4vUi0fK3IqzGhzZpTzfNEhACaZQvUa ejZnPZUVGdR4rukAwkzps7t+Q3XKhRHjCQqs1+rmoUjVRbAntFyNPh+VWQGGU/A/F5lvlg vz1ZZHCwRBxCUi/JwVQIryeRTuo1AT+DRrWLg/rcqlu5CY5LNEVe6FMOdf9jFx87k7Ilg2 NkwyubW1aGj0d+3arxaiR65pf53C4AlA/qKmh36RMTauijTs1jvFgHOF6lsLVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=bf48a958ad100bf59604bb31a433582ba8aa12b9 commit bf48a958ad100bf59604bb31a433582ba8aa12b9 Author: Peter Holm AuthorDate: 2022-01-08 06:11:10 +0000 Commit: Peter Holm CommitDate: 2022-01-08 06:11:10 +0000 stress2: Aded two msdos FS fuzzer tests --- tools/test/stress2/misc/msdos15.sh | 90 ++++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/msdos16.sh | 87 ++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) diff --git a/tools/test/stress2/misc/msdos15.sh b/tools/test/stress2/misc/msdos15.sh new file mode 100755 index 000000000000..79e60972e34b --- /dev/null +++ b/tools/test/stress2/misc/msdos15.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2022 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. +# + +# msdosfs disk image fuzz test. + +# "panic: wrong dirclust" seen: +# https://people.freebsd.org/~pho/stress/log/log0206.txt + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 + +set -e +u1=$mdstart +u2=$((mdstart + 1)) +mp1=${mntpoint}$u1 +mp2=${mntpoint}$u2 +mkdir -p $mp1 $mp2 +log=$mp1/msdos15.sh.log +diskimage=$mp1/msdos15.sh.diskimage +cap=$((32 * 1024)) # Only fuzz the first 32k +max=$((10 * 1024 * 1024)) # dos disk size + +set +e +mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 +[ -c /dev/md$u1 ] && mdconfig -d -u $u1 +mdconfig -a -t swap -s 1g -u $u1 +newfs -U /dev/md$u1 > /dev/null +mount /dev/md$u1 $mp1 + +[ -c /dev/md$u2 ] && mdconfig -d -u $u2 +dd if=/dev/zero of=$diskimage bs=$max count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $u2 +newfs_msdos /dev/md$u2 > /dev/null 2>&1 # FAT12 +mount -t msdosfs /dev/md$u2 $mp2 +[ -d /usr/include/sys ] && cp -r /usr/include/sys $mp2 +umount $mp2 + +cd $mp1 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 60 ]; do + mount -t msdosfs /dev/md$u2 $mp2 2>/dev/null || break + ls -lR $mp2 > /dev/null 2>&1 || break + rm -rf $mp2/* > /dev/null 2>&1 || break + touch $mp2/`jot -rc 8 a z | tr -d '\n'` || break + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + sync + mdconfig -d -u $u2 + /tmp/flip -n 10 -s $cap $diskimage + sync + mdconfig -a -t vnode -f $diskimage -u $u2 +done +mount | grep -q "on $mp2 " && umount $mp2 +mdconfig -d -u $u2 || exit 1 + +echo * | grep -q core && { ls -l *.core; cp $log /tmp; exit 106; } || +cd /tmp +umount $mp1 +mdconfig -d -u $u1 +rm -f /tmp/flip +exit 0 diff --git a/tools/test/stress2/misc/msdos16.sh b/tools/test/stress2/misc/msdos16.sh new file mode 100755 index 000000000000..e188795e1851 --- /dev/null +++ b/tools/test/stress2/misc/msdos16.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2022 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. +# + +# msdosfs disk image fuzz test. +# FAT32 version of msdos15.sh + +. ../default.cfg + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 + +set -e +u1=$mdstart +u2=$((mdstart + 1)) +mp1=${mntpoint}$u1 +mp2=${mntpoint}$u2 +mkdir -p $mp1 $mp2 +log=$mp1/msdos16.sh.log +diskimage=$mp1/msdos16.sh.diskimage +cap=$((32 * 1024)) # Only fuzz the first 32k + +set +e +mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 +[ -c /dev/md$u1 ] && mdconfig -d -u $u1 +mdconfig -a -t swap -s 2g -u $u1 +newfs -U /dev/md$u1 > /dev/null +mount /dev/md$u1 $mp1 + +[ -c /dev/md$u2 ] && mdconfig -d -u $u2 +dd if=/dev/zero of=$diskimage bs=1g count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $u2 +newfs_msdos -F 32 -b 8192 /dev/md$u2 > /dev/null +mount -t msdosfs /dev/md$u2 $mp2 +[ -d /usr/include/sys ] && cp -r /usr/include/sys $mp2 +umount $mp2 + +cd $mp1 +start=`date +%s` +while [ $((`date +%s` - start)) -lt 60 ]; do + mount -t msdosfs /dev/md$u2 $mp2 2>/dev/null || break + ls -lR $mp2 > /dev/null 2>&1 || break + rm -rf $mp2/* > /dev/null 2>&1 || break + touch $mp2/`jot -rc 8 a z | tr -d '\n'` || break + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + sync + mdconfig -d -u $u2 + /tmp/flip -n 10 -s $cap $diskimage + sync + mdconfig -a -t vnode -f $diskimage -u $u2 +done +mount | grep -q "on $mp2 " && umount $mp2 +mdconfig -d -u $u2 || exit 1 + +echo * | grep -q core && { ls -l *.core; cp $log /tmp; exit 106; } || +cd /tmp +umount $mp1 +mdconfig -d -u $u1 +rm -f /tmp/flip +exit 0