[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/28] export/fuse: Pass default_permissions for mount
From: |
Kevin Wolf |
Subject: |
[PULL 10/28] export/fuse: Pass default_permissions for mount |
Date: |
Fri, 9 Jul 2021 14:50:17 +0200 |
From: Max Reitz <mreitz@redhat.com>
We do not do any permission checks in fuse_open(), so let the kernel do
them. We already let fuse_getattr() report the proper UNIX permissions,
so this should work the way we want.
This causes a change in 308's reference output, because now opening a
non-writable export with O_RDWR fails already, instead of only actually
attempting to write to it. (That is an improvement.)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210625142317.271673-2-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/export/fuse.c | 8 ++++++--
tests/qemu-iotests/308 | 3 ++-
tests/qemu-iotests/308.out | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/block/export/fuse.c b/block/export/fuse.c
index 38f74c94da..d0b88e8f80 100644
--- a/block/export/fuse.c
+++ b/block/export/fuse.c
@@ -153,8 +153,12 @@ static int setup_fuse_export(FuseExport *exp, const char
*mountpoint,
struct fuse_args fuse_args;
int ret;
- /* Needs to match what fuse_init() sets. Only max_read must be supplied.
*/
- mount_opts = g_strdup_printf("max_read=%zu", FUSE_MAX_BOUNCE_BYTES);
+ /*
+ * max_read needs to match what fuse_init() sets.
+ * max_write need not be supplied.
+ */
+ mount_opts = g_strdup_printf("max_read=%zu,default_permissions",
+ FUSE_MAX_BOUNCE_BYTES);
fuse_argv[0] = ""; /* Dummy program name */
fuse_argv[1] = "-o";
diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308
index f122065d0f..11c28a75f2 100755
--- a/tests/qemu-iotests/308
+++ b/tests/qemu-iotests/308
@@ -215,7 +215,8 @@ echo '=== Writable export ==='
fuse_export_add 'export-mp' "'mountpoint': '$EXT_MP', 'writable': true"
# Check that writing to the read-only export fails
-$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$TEST_IMG" | _filter_qemu_io
+$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$TEST_IMG" 2>&1 \
+ | _filter_qemu_io | _filter_testdir | _filter_imgfmt
# But here it should work
$QEMU_IO -f raw -c 'write -P 42 1M 64k' "$EXT_MP" | _filter_qemu_io
diff --git a/tests/qemu-iotests/308.out b/tests/qemu-iotests/308.out
index 466e7e0267..0e9420645f 100644
--- a/tests/qemu-iotests/308.out
+++ b/tests/qemu-iotests/308.out
@@ -91,7 +91,7 @@ virtual size: 0 B (0 bytes)
'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true
} }
{"return": {}}
-write failed: Permission denied
+qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open
'TEST_DIR/t.IMGFMT': Permission denied
wrote 65536/65536 bytes at offset 1048576
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 65536/65536 bytes at offset 1048576
--
2.31.1
- [PULL 00/28] Block layer patches, Kevin Wolf, 2021/07/09
- [PULL 01/28] MAINTAINERS: update block/rbd.c maintainer, Kevin Wolf, 2021/07/09
- [PULL 02/28] block/rbd: Add support for rbd image encryption, Kevin Wolf, 2021/07/09
- [PULL 04/28] block/rbd: store object_size in BDRVRBDState, Kevin Wolf, 2021/07/09
- [PULL 03/28] block/rbd: bump librbd requirement to luminous release, Kevin Wolf, 2021/07/09
- [PULL 05/28] block/rbd: update s->image_size in qemu_rbd_getlength, Kevin Wolf, 2021/07/09
- [PULL 06/28] block/rbd: migrate from aio to coroutines, Kevin Wolf, 2021/07/09
- [PULL 07/28] block/rbd: add write zeroes support, Kevin Wolf, 2021/07/09
- [PULL 09/28] util/uri: do not check argument of uri_free(), Kevin Wolf, 2021/07/09
- [PULL 08/28] block/rbd: drop qemu_rbd_refresh_limits, Kevin Wolf, 2021/07/09
- [PULL 10/28] export/fuse: Pass default_permissions for mount,
Kevin Wolf <=
- [PULL 11/28] export/fuse: Add allow-other option, Kevin Wolf, 2021/07/09
- [PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch, Kevin Wolf, 2021/07/09
- [PULL 13/28] export/fuse: Let permissions be adjustable, Kevin Wolf, 2021/07/09
- [PULL 14/28] iotests/308: Test +w on read-only FUSE exports, Kevin Wolf, 2021/07/09
- [PULL 15/28] iotests/fuse-allow-other: Test allow-other, Kevin Wolf, 2021/07/09
- [PULL 17/28] MAINTAINERS: add block/rbd.c reviewer, Kevin Wolf, 2021/07/09
- [PULL 16/28] block/rbd: fix type of task->complete, Kevin Wolf, 2021/07/09
- [PULL 18/28] vhost-user: Fix backends without multiqueue support, Kevin Wolf, 2021/07/09
- [PULL 19/28] blockdev: fix drive-backup transaction endless drained section, Kevin Wolf, 2021/07/09
- [PULL 20/28] qcow2: Prohibit backing file changes in 'qemu-img amend', Kevin Wolf, 2021/07/09