lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20250609110307.17455-2-hans.holmberg@wdc.com> Date: Mon, 9 Jun 2025 11:03:53 +0000 From: Hans Holmberg <Hans.Holmberg@....com> To: Zorro Lang <zlang@...nel.org> CC: hch <hch@....de>, "tytso@....edu" <tytso@....edu>, "djwong@...nel.org" <djwong@...nel.org>, "fstests@...r.kernel.org" <fstests@...r.kernel.org>, "linux-xfs@...r.kernel.org" <linux-xfs@...r.kernel.org>, "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>, Hans Holmberg <Hans.Holmberg@....com> Subject: [PATCH 1/2] xfs: add mount test for read only rt devices Make sure that we can mount rt devices read-only if them themselves are marked as read-only. Also make sure that rw re-mounts are not allowed if the device is marked as read-only. Based on generic/050. Signed-off-by: Hans Holmberg <hans.holmberg@....com> --- tests/xfs/837 | 65 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/837.out | 10 ++++++++ 2 files changed, 75 insertions(+) create mode 100755 tests/xfs/837 create mode 100644 tests/xfs/837.out diff --git a/tests/xfs/837 b/tests/xfs/837 new file mode 100755 index 000000000000..61e51d3a7d0e --- /dev/null +++ b/tests/xfs/837 @@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2009 Christoph Hellwig. +# Copyright (c) 2025 Western Digital Corporation +# +# FS QA Test No. 837 +# +# Check out various mount/remount/unmount scenarious on a read-only rtdev +# Based on generic/050 +# +. ./common/preamble +_begin_fstest mount auto quick + +_cleanup_setrw() +{ + cd / + blockdev --setrw $SCRATCH_RTDEV +} + +# Import common functions. +. ./common/filter + +_fixed_by_kernel_commit bfecc4091e07 \ + "xfs: allow ro mounts if rtdev or logdev are read-only" + +_require_realtime +_require_scratch + +if [ -z "$SCRATCH_RTDEV" ]; then + _notrun "requires external scratch rt device" +else + _require_local_device $SCRATCH_RTDEV +fi + +_register_cleanup "_cleanup_setrw" + +_scratch_mkfs "-d rtinherit" > /dev/null 2>&1 + +# +# Mark the rt device read-only. +# +echo "setting device read-only" +blockdev --setro $SCRATCH_RTDEV + +# +# Mount it and make sure it can't be written to. +# +echo "mounting read-only rt block device:" +_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch +if [ "${PIPESTATUS[0]}" -eq 0 ]; then + echo "writing to file on read-only filesystem:" + dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 oflag=direct 2>&1 | _filter_scratch +else + _fail "failed to mount" +fi + +echo "remounting read-write:" +_scratch_remount rw 2>&1 | _filter_scratch | _filter_ro_mount + +echo "unmounting read-only filesystem" +_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot + +# success, all done +echo "*** done" +status=0 diff --git a/tests/xfs/837.out b/tests/xfs/837.out new file mode 100644 index 000000000000..0a843a0ba398 --- /dev/null +++ b/tests/xfs/837.out @@ -0,0 +1,10 @@ +QA output created by 837 +setting device read-only +mounting read-only rt block device: +mount: device write-protected, mounting read-only +writing to file on read-only filesystem: +dd: failed to open 'SCRATCH_MNT/foo': Read-only file system +remounting read-write: +mount: cannot remount device read-write, is write-protected +unmounting read-only filesystem +*** done -- 2.34.1
Powered by blists - more mailing lists