mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
root_squash: virFileOperation may fail with EPERM too
Over root-squashing nfs, when virFileOperation() is called as uid==0, it may fail with EACCES, but also with EPERM, due to virFileOperationNoFork()'s failed attemp to chown a writable file. qemudDomainSaveFlag() should expect this case, too.
This commit is contained in:
parent
b7bd75c4c0
commit
b2c9a87940
@ -5402,13 +5402,13 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
|
|||||||
qemudDomainSaveFileOpHook, &hdata,
|
qemudDomainSaveFileOpHook, &hdata,
|
||||||
0)) < 0) {
|
0)) < 0) {
|
||||||
/* If we failed as root, and the error was permission-denied
|
/* If we failed as root, and the error was permission-denied
|
||||||
(EACCES), assume it's on a network-connected share where
|
(EACCES or EPERM), assume it's on a network-connected share
|
||||||
root access is restricted (eg, root-squashed NFS). If the
|
where root access is restricted (eg, root-squashed NFS). If the
|
||||||
qemu user (driver->user) is non-root, just set a flag to
|
qemu user (driver->user) is non-root, just set a flag to
|
||||||
bypass security driver shenanigans, and retry the operation
|
bypass security driver shenanigans, and retry the operation
|
||||||
after doing setuid to qemu user */
|
after doing setuid to qemu user */
|
||||||
|
|
||||||
if ((rc != -EACCES) ||
|
if (((rc != -EACCES) && (rc != -EPERM)) ||
|
||||||
driver->user == getuid()) {
|
driver->user == getuid()) {
|
||||||
virReportSystemError(-rc, _("Failed to create domain save file '%s'"),
|
virReportSystemError(-rc, _("Failed to create domain save file '%s'"),
|
||||||
path);
|
path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user