Page MenuHomeFreeBSD

pjdfstest: better handle filesystems mounted with -o noexec
ClosedPublic

Authored by ngie on Mar 12 2016, 6:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 3:18 PM
Unknown Object (File)
Wed, Apr 24, 3:13 PM
Unknown Object (File)
Wed, Apr 24, 3:13 PM
Unknown Object (File)
Wed, Apr 24, 11:06 AM
Unknown Object (File)
Wed, Apr 24, 8:02 AM
Unknown Object (File)
Mar 10 2024, 1:05 PM
Unknown Object (File)
Mar 10 2024, 1:01 PM
Unknown Object (File)
Mar 10 2024, 1:01 PM

Details

Reviewers
markj
Summary

Better handle filesystems mounted with -o noexec

ftruncate/11, open/20, and truncate/11 all copy sleep(1) to a temporary file on
the target filesystem, execute the binary, then expect a result. This doesn't
work with scenarios where the target binary cannot be executed, e.g. the filesystem
was mounted with -o noexec.

Ensure the filesystem hasn't been mounted with -o noexec for the testcases before
executing them.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

Test Plan

As root, execute the following commands:

set -e
mdmfs -s 20m md /mnt/reg
for mount_option in noatime noexec nosuid; do
mkdir -p /mnt/$mount_option
mdmfs -s 20m md /mnt/$mount_option
done
for i in /mnt/reg /mnt/noatime /mnt/noexec /mnt/nosuid; do
env PJDFSTEST_TEST_PATH=$i kyua test
done

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 2881
Build 2905: arc lint + arc unit

Event Timeline

ngie retitled this revision from to pjdfstest: better handle testcases that assume filesystems mounted with -o noexec.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added a reviewer: markj.
ngie added subscribers: pjd, bdrewery.

Moved the logic from tests/sys/pjdfstest/conf to contrib/pjdfstest/tests/misc.sh

ngie retitled this revision from pjdfstest: better handle testcases that assume filesystems mounted with -o noexec to pjdfstest: better handle filesystems mounted with -o noexec.Mar 12 2016, 6:02 PM
ngie updated this object.
ngie added a subscriber: tests.
markj edited edge metadata.

Thanks!

contrib/pjdfstest/tests/misc.sh
251

I find something like "filesystem mounted with -o noexec" easier to parse.

This revision is now accepted and ready to land.Mar 12 2016, 7:16 PM
contrib/pjdfstest/tests/misc.sh
239

Hm, where is mountpoint defined?

ngie marked an inline comment as done.Mar 12 2016, 7:26 PM
ngie added inline comments.
contrib/pjdfstest/tests/misc.sh
239

It's defined in tests/sys/pjdfstest/tests/conf:

 1 #!/bin/sh
 2 #
 3 # $FreeBSD: head/tests/sys/pjdfstest/tests/conf 274016 2014-11-03 07:18:42Z ngie $
 4 
 5 : ${PJDFSTEST_TEST_PATH=.}
 6 if ! cd ${PJDFSTEST_TEST_PATH}/; then
 7         echo 'Please set PJDFSTEST_TEST_PATH to a valid filesystem path'
 8         echo 'Bail out!'
 9         exit 1
10 fi
11 
12 GREP=grep
13 mountpoint=$(df . | tail -1 | awk '{print $6}')
14 fs=$(mount -p | awk '$2 == "'$mountpoint'" { print toupper($3) }')
15 os=FreeBSD

I should probably rename it as MOUNTPOINT so the fact that it's a global's clearer.

ngie marked 2 inline comments as done.Mar 12 2016, 7:40 PM
ngie added inline comments.
contrib/pjdfstest/tests/misc.sh
239

I added an XXX comment to note where the variable is defined for clarity.

ngie marked 2 inline comments as done.Mar 12 2016, 7:41 PM