qemu-iotests 232 fails when running the test as root user
Hi,
I am seeing a failure of the qemu-iotest number 232 when running the test as a root user. Is this the expected behavior?
Here is the output of the failure:
sudo ./check -qcow2 232
QEMU -- "/home/alifm/kvmdev/qemu/tests/qemu-iotests/../../x86_64-softmmu/qemu-system-x86_64" -nodefaults -machine accel=qtest QEMU_IMG -- "/home/alifm/kvmdev/qemu/tests/qemu-iotests/../../qemu-img" QEMU_IO -- "/home/alifm/kvmdev/qemu/tests/qemu-iotests/../../qemu-io" --cache writeback -f qcow2 QEMU_NBD -- "/home/alifm/kvmdev/qemu/tests/qemu-iotests/../../qemu-nbd" IMGFMT -- qcow2 (compat=1.1) IMGPROTO -- file PLATFORM -- Linux/x86_64 alifm-ThinkPad-T470p 4.10.0-40-generic TEST_DIR -- /home/alifm/kvmdev/qemu/tests/qemu-iotests/scratch
SOCKET_SCM_HELPER -- /home/alifm/kvmdev/qemu/tests/qemu-iotests/socket_scm_helper
232 1s ... - output mismatch (see 232.out.bad)
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +7 -7
@@ -21,13 +21,13 @@ NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) - -QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) +NODE_NAME: TEST_DIR/t.IMGFMT (file) +NODE_NAME: TEST_DIR/t.IMGFMT (file) +NODE_NAME: TEST_DIR/t.IMGFMT (file) + +NODE_NAME: TEST_DIR/t.IMGFMT (file) +NODE_NAME: TEST_DIR/t.IMGFMT (file) +NODE_NAME: TEST_DIR/t.IMGFMT (file) === -blockdev with read-write image: read-only/auto-read-only
combinations ===
@@ -49,11 +49,11 @@
node0: TEST_DIR/t.IMGFMT (file, read-only)
node0: TEST_DIR/t.IMGFMT (file, read-only)
-QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied -node0: TEST_DIR/t.IMGFMT (file, read-only)
-QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied +node0: TEST_DIR/t.IMGFMT (file)
+node0: TEST_DIR/t.IMGFMT (file)
+node0: TEST_DIR/t.IMGFMT (file)
-QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied -node0: TEST_DIR/t.IMGFMT (file, read-only)
-QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0: Could not open 'TEST_DIR/t.IMGFMT': Permission denied +node0: TEST_DIR/t.IMGFMT (file)
+node0: TEST_DIR/t.IMGFMT (file)
+node0: TEST_DIR/t.IMGFMT (file)
*** done
Failures: 232
Failed 1 of 1 tests
Thank you
Farhan
Quoted 14 lines · Farhan Ali
Hi,
I am seeing a failure of the qemu-iotest number 232 when running the test as a root user. Is this the expected behavior?
Here is the output of the failure:
-QEMU_PROG: -drive
driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission deniedhome/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +0
-4-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) - -QEMU_PROG: -drivedriver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad line 24
Quoted 3 lines
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +1
-2-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) +NODE_NAME: TEST_DIR/t.IMGFMT (file)
Not entirely unexpected (since root can read what are otherwise read-only files), but obviously unexpected by the test. The test should probably refuse to run as root.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 8 lines · Eric Blake
Quoted 6 lines · Farhan Ali
Hi,
I am seeing a failure of the qemu-iotest number 232 when running the test as a root user. Is this the expected behavior?
Here is the output of the failure:
Quoted 13 lines
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad line 24
Quoted 10 lines
-QEMU_PROG: -drive
driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission deniedhome/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +0
-4-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) - -QEMU_PROG: -drivedriver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +1
-2-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) +NODE_NAME: TEST_DIR/t.IMGFMT (file)Not entirely unexpected (since root can read what are otherwise read-only files), but obviously unexpected by the test. The test should probably refuse to run as root.
Yes, I believe it would be better if there was a check to prevent running this test as root.
Thanks
Farhan
Quoted 9 lines · Eric Blake
Quoted 7 lines · Farhan Ali
Hi,
I am seeing a failure of the qemu-iotest number 232 when running the test as a root user. Is this the expected behavior?
Here is the output of the failure:
Quoted 15 lines
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad line 24
Quoted 11 lines
-QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off:
Could not open 'TEST_DIR/t.IMGFMT': Permission deniedhome/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +0
-4-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) - -QEMU_PROG: -drivedriver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out.bad renamed from home/alifm/kvmdev/qemu/tests/qemu-iotests/232.out +1
-2-NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) -NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only) +NODE_NAME: TEST_DIR/t.IMGFMT (file)Not entirely unexpected (since root can read what are otherwise read-only files), but obviously unexpected by the test. The test should probably refuse to run as root.
I'd suggest that *all* our tests shoudl refuse to run as root as a matter of principal. The risk of them doing damage is way too high and there is no good reason why anyone should be building & testing QEMU as root rather than an unprivileged user.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|