|
|
51d9a2 |
From abda9a653cdb9ae482b7122e091c73c2df18f9e2 Mon Sep 17 00:00:00 2001
|
|
|
51d9a2 |
Message-Id: <abda9a653cdb9ae482b7122e091c73c2df18f9e2@dist-git>
|
|
|
51d9a2 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
51d9a2 |
Date: Wed, 25 Jul 2018 08:27:09 +0200
|
|
|
51d9a2 |
Subject: [PATCH] qemu: Remove unused bypassSecurityDriver from qemuOpenFileAs
|
|
|
51d9a2 |
MIME-Version: 1.0
|
|
|
51d9a2 |
Content-Type: text/plain; charset=UTF-8
|
|
|
51d9a2 |
Content-Transfer-Encoding: 8bit
|
|
|
51d9a2 |
|
|
|
51d9a2 |
https://bugzilla.redhat.com/show_bug.cgi?id=1589115
|
|
|
51d9a2 |
|
|
|
51d9a2 |
This argument is not used anymore. The only function that is
|
|
|
51d9a2 |
passing non-NULL (qemuDomainSaveMemory) does not actually care
|
|
|
51d9a2 |
for the value (after 23087cfdb) and every other caller just
|
|
|
51d9a2 |
passes NULL anyway.
|
|
|
51d9a2 |
|
|
|
51d9a2 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
51d9a2 |
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
|
|
51d9a2 |
(cherry picked from commit 8677a476c7e5cbf7b344329d54d0b1a2d666ffc3)
|
|
|
51d9a2 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
51d9a2 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
51d9a2 |
---
|
|
|
51d9a2 |
src/qemu/qemu_driver.c | 32 +++++++++-----------------------
|
|
|
51d9a2 |
1 file changed, 9 insertions(+), 23 deletions(-)
|
|
|
51d9a2 |
|
|
|
51d9a2 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
51d9a2 |
index 62deae4b98..efd0a05c90 100644
|
|
|
51d9a2 |
--- a/src/qemu/qemu_driver.c
|
|
|
51d9a2 |
+++ b/src/qemu/qemu_driver.c
|
|
|
51d9a2 |
@@ -152,7 +152,7 @@ static int qemuDomainManagedSaveLoad(virDomainObjPtr vm,
|
|
|
51d9a2 |
static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
|
|
|
51d9a2 |
bool dynamicOwnership,
|
|
|
51d9a2 |
const char *path, int oflags,
|
|
|
51d9a2 |
- bool *needUnlink, bool *bypassSecurityDriver);
|
|
|
51d9a2 |
+ bool *needUnlink);
|
|
|
51d9a2 |
|
|
|
51d9a2 |
static int qemuGetDHCPInterfaces(virDomainPtr dom,
|
|
|
51d9a2 |
virDomainObjPtr vm,
|
|
|
51d9a2 |
@@ -2984,9 +2984,6 @@ qemuCompressGetCommand(virQEMUSaveFormat compression)
|
|
|
51d9a2 |
* @path: path to file to open
|
|
|
51d9a2 |
* @oflags: flags for opening/creation of the file
|
|
|
51d9a2 |
* @needUnlink: set to true if file was created by this function
|
|
|
51d9a2 |
- * @bypassSecurityDriver: optional pointer to a boolean that will be set to true
|
|
|
51d9a2 |
- * if security driver operations are pointless (due to
|
|
|
51d9a2 |
- * NFS mount)
|
|
|
51d9a2 |
*
|
|
|
51d9a2 |
* Internal function to properly create or open existing files, with
|
|
|
51d9a2 |
* ownership affected by qemu driver setup and domain DAC label.
|
|
|
51d9a2 |
@@ -3001,8 +2998,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
virDomainObjPtr vm,
|
|
|
51d9a2 |
const char *path,
|
|
|
51d9a2 |
int oflags,
|
|
|
51d9a2 |
- bool *needUnlink,
|
|
|
51d9a2 |
- bool *bypassSecurityDriver)
|
|
|
51d9a2 |
+ bool *needUnlink)
|
|
|
51d9a2 |
{
|
|
|
51d9a2 |
int ret = -1;
|
|
|
51d9a2 |
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
|
|
51d9a2 |
@@ -3021,7 +3017,7 @@ qemuOpenFile(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
ret = qemuOpenFileAs(user, group, dynamicOwnership,
|
|
|
51d9a2 |
- path, oflags, needUnlink, bypassSecurityDriver);
|
|
|
51d9a2 |
+ path, oflags, needUnlink);
|
|
|
51d9a2 |
|
|
|
51d9a2 |
cleanup:
|
|
|
51d9a2 |
return ret;
|
|
|
51d9a2 |
@@ -3031,12 +3027,11 @@ static int
|
|
|
51d9a2 |
qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
|
|
|
51d9a2 |
bool dynamicOwnership,
|
|
|
51d9a2 |
const char *path, int oflags,
|
|
|
51d9a2 |
- bool *needUnlink, bool *bypassSecurityDriver)
|
|
|
51d9a2 |
+ bool *needUnlink)
|
|
|
51d9a2 |
{
|
|
|
51d9a2 |
struct stat sb;
|
|
|
51d9a2 |
bool is_reg = true;
|
|
|
51d9a2 |
bool need_unlink = false;
|
|
|
51d9a2 |
- bool bypass_security = false;
|
|
|
51d9a2 |
unsigned int vfoflags = 0;
|
|
|
51d9a2 |
int fd = -1;
|
|
|
51d9a2 |
int path_shared = virFileIsSharedFS(path);
|
|
|
51d9a2 |
@@ -3134,19 +3129,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
|
|
|
51d9a2 |
path);
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
}
|
|
|
51d9a2 |
-
|
|
|
51d9a2 |
- /* Since we had to setuid to create the file, and the fstype
|
|
|
51d9a2 |
- is NFS, we assume it's a root-squashing NFS share, and that
|
|
|
51d9a2 |
- the security driver stuff would have failed anyway */
|
|
|
51d9a2 |
-
|
|
|
51d9a2 |
- bypass_security = true;
|
|
|
51d9a2 |
}
|
|
|
51d9a2 |
}
|
|
|
51d9a2 |
cleanup:
|
|
|
51d9a2 |
if (needUnlink)
|
|
|
51d9a2 |
*needUnlink = need_unlink;
|
|
|
51d9a2 |
- if (bypassSecurityDriver)
|
|
|
51d9a2 |
- *bypassSecurityDriver = bypass_security;
|
|
|
51d9a2 |
return fd;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
error:
|
|
|
51d9a2 |
@@ -3198,7 +3185,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
unsigned int flags,
|
|
|
51d9a2 |
qemuDomainAsyncJob asyncJob)
|
|
|
51d9a2 |
{
|
|
|
51d9a2 |
- bool bypassSecurityDriver = false;
|
|
|
51d9a2 |
bool needUnlink = false;
|
|
|
51d9a2 |
int ret = -1;
|
|
|
51d9a2 |
int fd = -1;
|
|
|
51d9a2 |
@@ -3218,7 +3204,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
}
|
|
|
51d9a2 |
fd = qemuOpenFile(driver, vm, path,
|
|
|
51d9a2 |
O_WRONLY | O_TRUNC | O_CREAT | directFlag,
|
|
|
51d9a2 |
- &needUnlink, &bypassSecurityDriver);
|
|
|
51d9a2 |
+ &needUnlink);
|
|
|
51d9a2 |
if (fd < 0)
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
@@ -3249,7 +3235,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
if (qemuFileWrapperFDClose(vm, wrapperFd) < 0)
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
- if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0 ||
|
|
|
51d9a2 |
+ if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL)) < 0 ||
|
|
|
51d9a2 |
virQEMUSaveDataFinish(data, &fd, path) < 0)
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
@@ -3809,7 +3795,7 @@ doCoreDump(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
* created. */
|
|
|
51d9a2 |
if ((fd = qemuOpenFile(driver, vm, path,
|
|
|
51d9a2 |
O_CREAT | O_TRUNC | O_WRONLY | directFlag,
|
|
|
51d9a2 |
- NULL, NULL)) < 0)
|
|
|
51d9a2 |
+ NULL)) < 0)
|
|
|
51d9a2 |
goto cleanup;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
if (!(wrapperFd = virFileWrapperFdNew(&fd, path, flags)))
|
|
|
51d9a2 |
@@ -6434,7 +6420,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
|
|
51d9a2 |
goto error;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
- if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL, NULL)) < 0)
|
|
|
51d9a2 |
+ if ((fd = qemuOpenFile(driver, NULL, path, oflags, NULL)) < 0)
|
|
|
51d9a2 |
goto error;
|
|
|
51d9a2 |
if (bypass_cache &&
|
|
|
51d9a2 |
!(*wrapperFd = virFileWrapperFdNew(&fd, path,
|
|
|
51d9a2 |
@@ -11878,7 +11864,7 @@ qemuDomainStorageOpenStat(virQEMUDriverPtr driver,
|
|
|
51d9a2 |
{
|
|
|
51d9a2 |
if (virStorageSourceIsLocalStorage(src)) {
|
|
|
51d9a2 |
if ((*ret_fd = qemuOpenFile(driver, vm, src->path, O_RDONLY,
|
|
|
51d9a2 |
- NULL, NULL)) < 0)
|
|
|
51d9a2 |
+ NULL)) < 0)
|
|
|
51d9a2 |
return -1;
|
|
|
51d9a2 |
|
|
|
51d9a2 |
if (fstat(*ret_fd, ret_sb) < 0) {
|
|
|
51d9a2 |
--
|
|
|
51d9a2 |
2.18.0
|
|
|
51d9a2 |
|