|
|
147b37 |
From d25881180ef0b8b11bb5a51317cb49a194e37a76 Mon Sep 17 00:00:00 2001
|
|
|
147b37 |
Message-Id: <d25881180ef0b8b11bb5a51317cb49a194e37a76@dist-git>
|
|
|
147b37 |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
147b37 |
Date: Mon, 9 Apr 2018 15:46:47 +0200
|
|
|
147b37 |
Subject: [PATCH] qemu_cgroup: Fix 'rc' argument on virDomainAuditCgroupPath()
|
|
|
147b37 |
calls
|
|
|
147b37 |
MIME-Version: 1.0
|
|
|
147b37 |
Content-Type: text/plain; charset=UTF-8
|
|
|
147b37 |
Content-Transfer-Encoding: 8bit
|
|
|
147b37 |
|
|
|
147b37 |
https://bugzilla.redhat.com/show_bug.cgi?id=1564996
|
|
|
147b37 |
|
|
|
147b37 |
All calls to virDomainAuditCgroupPath() were passing 'rc == 0' as
|
|
|
147b37 |
argument, when it was supposed to pass the 'rc' value directly.
|
|
|
147b37 |
|
|
|
147b37 |
As a consequence, the audit events that were supposed to be
|
|
|
147b37 |
logged (actual cgroup changes) were never being logged, and bogus
|
|
|
147b37 |
audit events were logged when using regular files as disk image.
|
|
|
147b37 |
|
|
|
147b37 |
Fix all calls to use the return value of
|
|
|
147b37 |
virCgroup{Allow,Deny}Device*() directly as the 'rc' argument.
|
|
|
147b37 |
|
|
|
147b37 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
147b37 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
147b37 |
(cherry picked from commit 9a22251bbe6a4ff8dab90da53a1c0df82d8d29fc)
|
|
|
147b37 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
147b37 |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
147b37 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
147b37 |
---
|
|
|
147b37 |
src/qemu/qemu_cgroup.c | 28 ++++++++++++++--------------
|
|
|
147b37 |
1 file changed, 14 insertions(+), 14 deletions(-)
|
|
|
147b37 |
|
|
|
147b37 |
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
|
|
|
147b37 |
index 41e27c21e2..b604edb31c 100644
|
|
|
147b37 |
--- a/src/qemu/qemu_cgroup.c
|
|
|
147b37 |
+++ b/src/qemu/qemu_cgroup.c
|
|
|
147b37 |
@@ -75,7 +75,7 @@ qemuSetupImagePathCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path,
|
|
|
147b37 |
virCgroupGetDevicePermsString(perms),
|
|
|
147b37 |
- ret == 0);
|
|
|
147b37 |
+ ret);
|
|
|
147b37 |
|
|
|
147b37 |
return ret;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -129,7 +129,7 @@ qemuTeardownImageCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
ret = virCgroupDenyDevicePath(priv->cgroup, src->path, perms, true);
|
|
|
147b37 |
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "deny", src->path,
|
|
|
147b37 |
- virCgroupGetDevicePermsString(perms), ret == 0);
|
|
|
147b37 |
+ virCgroupGetDevicePermsString(perms), ret);
|
|
|
147b37 |
|
|
|
147b37 |
return ret;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -187,7 +187,7 @@ qemuSetupChrSourceCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
ret = virCgroupAllowDevicePath(priv->cgroup, source->data.file.path,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
|
|
|
147b37 |
- source->data.file.path, "rw", ret == 0);
|
|
|
147b37 |
+ source->data.file.path, "rw", ret);
|
|
|
147b37 |
|
|
|
147b37 |
return ret;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -211,7 +211,7 @@ qemuTeardownChrSourceCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
ret = virCgroupDenyDevicePath(priv->cgroup, source->data.file.path,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
|
|
|
147b37 |
- source->data.file.path, "rw", ret == 0);
|
|
|
147b37 |
+ source->data.file.path, "rw", ret);
|
|
|
147b37 |
|
|
|
147b37 |
return ret;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -261,7 +261,7 @@ qemuSetupInputCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
VIR_DEBUG("Process path '%s' for input device", dev->source.evdev);
|
|
|
147b37 |
ret = virCgroupAllowDevicePath(priv->cgroup, dev->source.evdev,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
- virDomainAuditCgroupPath(vm, priv->cgroup, "allow", dev->source.evdev, "rw", ret == 0);
|
|
|
147b37 |
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow", dev->source.evdev, "rw", ret);
|
|
|
147b37 |
break;
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
@@ -284,7 +284,7 @@ qemuTeardownInputCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
VIR_DEBUG("Process path '%s' for input device", dev->source.evdev);
|
|
|
147b37 |
ret = virCgroupDenyDevicePath(priv->cgroup, dev->source.evdev,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RWM, false);
|
|
|
147b37 |
- virDomainAuditCgroupPath(vm, priv->cgroup, "deny", dev->source.evdev, "rwm", ret == 0);
|
|
|
147b37 |
+ virDomainAuditCgroupPath(vm, priv->cgroup, "deny", dev->source.evdev, "rwm", ret);
|
|
|
147b37 |
break;
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
@@ -313,7 +313,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
rv = virCgroupAllowDevicePath(priv->cgroup, path[i], perms[i], false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path[i],
|
|
|
147b37 |
virCgroupGetDevicePermsString(perms[i]),
|
|
|
147b37 |
- ret == 0);
|
|
|
147b37 |
+ rv);
|
|
|
147b37 |
if (rv < 0)
|
|
|
147b37 |
goto cleanup;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -357,7 +357,7 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
rv = virCgroupDenyDevicePath(priv->cgroup, path[i],
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RWM, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup,
|
|
|
147b37 |
- "deny", path[i], "rwm", rv == 0);
|
|
|
147b37 |
+ "deny", path[i], "rwm", rv);
|
|
|
147b37 |
if (rv < 0)
|
|
|
147b37 |
goto cleanup;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -388,7 +388,7 @@ qemuSetupMemoryDevicesCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
rv = virCgroupAllowDevicePath(priv->cgroup, mem->nvdimmPath,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
|
|
|
147b37 |
- mem->nvdimmPath, "rw", rv == 0);
|
|
|
147b37 |
+ mem->nvdimmPath, "rw", rv);
|
|
|
147b37 |
|
|
|
147b37 |
return rv;
|
|
|
147b37 |
}
|
|
|
147b37 |
@@ -410,7 +410,7 @@ qemuTeardownMemoryDevicesCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
rv = virCgroupDenyDevicePath(priv->cgroup, mem->nvdimmPath,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RWM, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup,
|
|
|
147b37 |
- "deny", mem->nvdimmPath, "rwm", rv == 0);
|
|
|
147b37 |
+ "deny", mem->nvdimmPath, "rwm", rv);
|
|
|
147b37 |
return rv;
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
@@ -434,7 +434,7 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
ret = virCgroupAllowDevicePath(priv->cgroup, rendernode,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow", rendernode,
|
|
|
147b37 |
- "rw", ret == 0);
|
|
|
147b37 |
+ "rw", ret);
|
|
|
147b37 |
return ret;
|
|
|
147b37 |
}
|
|
|
147b37 |
|
|
|
147b37 |
@@ -573,7 +573,7 @@ qemuSetupRNGCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
|
|
|
147b37 |
rng->source.file,
|
|
|
147b37 |
- "rw", rv == 0);
|
|
|
147b37 |
+ "rw", rv);
|
|
|
147b37 |
if (rv < 0 &&
|
|
|
147b37 |
!virLastErrorIsSystemErrno(ENOENT))
|
|
|
147b37 |
return -1;
|
|
|
147b37 |
@@ -600,7 +600,7 @@ qemuTeardownRNGCgroup(virDomainObjPtr vm,
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
virDomainAuditCgroupPath(vm, priv->cgroup, "deny",
|
|
|
147b37 |
rng->source.file,
|
|
|
147b37 |
- "rw", rv == 0);
|
|
|
147b37 |
+ "rw", rv);
|
|
|
147b37 |
if (rv < 0 &&
|
|
|
147b37 |
!virLastErrorIsSystemErrno(ENOENT))
|
|
|
147b37 |
return -1;
|
|
|
147b37 |
@@ -693,7 +693,7 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
|
|
|
147b37 |
|
|
|
147b37 |
rv = virCgroupAllowDevicePath(priv->cgroup, deviceACL[i],
|
|
|
147b37 |
VIR_CGROUP_DEVICE_RW, false);
|
|
|
147b37 |
- virDomainAuditCgroupPath(vm, priv->cgroup, "allow", deviceACL[i], "rw", rv == 0);
|
|
|
147b37 |
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow", deviceACL[i], "rw", rv);
|
|
|
147b37 |
if (rv < 0 &&
|
|
|
147b37 |
!virLastErrorIsSystemErrno(ENOENT))
|
|
|
147b37 |
goto cleanup;
|
|
|
147b37 |
--
|
|
|
147b37 |
2.17.0
|
|
|
147b37 |
|