aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Holm <pho@FreeBSD.org>2026-07-21 07:53:24 +0000
committerPeter Holm <pho@FreeBSD.org>2026-07-21 07:53:24 +0000
commitff6574d2508d6bc72247993787963dd84c4ff9dd (patch)
treeee557390b1641fd72836c6654b52396dfc5ebf7d
parent4dc01fe70d9204d1cb635c76d59623c9e7c7776e (diff)
stress2: Added a regression test
-rwxr-xr-xtools/test/stress2/misc/nullfs35.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/tools/test/stress2/misc/nullfs35.sh b/tools/test/stress2/misc/nullfs35.sh
new file mode 100755
index 000000000000..9f46cd9316ac
--- /dev/null
+++ b/tools/test/stress2/misc/nullfs35.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2026 Peter Holm <pho@FreeBSD.org>
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+
+# "nullfs mount over a file" scenario, see D58178 and D58191
+
+set -u
+prog=$(basename "$0" .sh)
+
+file=/tmp/$prog.file
+mp=/tmp/$prog.mp
+sleep=/tmp/$prog.sleep
+rm -f $file
+touch $mp
+
+# Mounting and running a program
+cp /bin/date $file
+mount_nullfs $file $mp || exit 1
+$mp
+umount $mp
+
+# Display binary information for the process
+rm -f $file
+cp /bin/sleep $file
+mount_nullfs $file $mp || exit 1
+$mp 60 &
+sleep .2
+# "panic: condition vp->v_type == VDIR || VN_IS_DOOMED(vp) not met at vfs_cache.c:3547 (vn_fullpath_dir)" seen.
+procstat -b $!
+kill $!
+umount $mp
+
+# Mounting a link
+rm $file
+cp /bin/sleep $sleep
+ln $sleep $file
+mount_nullfs $file $mp || exit 1
+$mp 60 &
+sleep .2
+procstat -b $!
+kill $!
+umount $mp
+rm $sleep
+
+# Mounting a symbolic link
+rm $file
+ln -s /bin/sleep $file
+mount_nullfs $file $mp || exit 1
+$mp 60 &
+sleep .2
+procstat -b $!
+kill $!
+umount $mp
+
+# Mounting a fifo must fail
+rm $file
+mkfifo $file
+mount_nullfs $file $mp 2>/dev/null && exit 1
+
+rm -f $file $mp
+exit 0