[libvirt] [PATCH] storage: Properly terminate secrets
by Michal Privoznik
The virSecretGetSecretString() helper looks up a secret for given
pool and returns its value in @secret_value and its length in
@secret_value_size. However, the trailing '\0' is not included in
either of the variables. This is because usually the value of the
secret is passed to some encoder (usually base64 encoder) where
the trailing zero must not be accounted for.
However, in two places we actually want the string as we don't
process is any further.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
I wonder if putting this realloc into virSecretGetSecretString() would
be a better fix or not. I mean, without changing @secret_size. Opinions?
src/storage/storage_backend_iscsi.c | 5 +++++
src/storage/storage_backend_iscsi_direct.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 6242cd0fac..55fe47f5e1 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -303,6 +303,11 @@ virStorageBackendISCSISetAuth(const char *portal,
&secret_value, &secret_size) < 0)
goto cleanup;
+ if (VIR_REALLOC_N(secret_value, secret_size + 1) < 0)
+ goto cleanup;
+
+ secret_value[secret_size] = '\0';
+
if (virISCSINodeUpdate(portal,
source->devices[0].path,
"node.session.auth.authmethod",
diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
index 1624066e9c..0d7d6ba9c3 100644
--- a/src/storage/storage_backend_iscsi_direct.c
+++ b/src/storage/storage_backend_iscsi_direct.c
@@ -115,6 +115,11 @@ virStorageBackendISCSIDirectSetAuth(struct iscsi_context *iscsi,
&secret_value, &secret_size) < 0)
goto cleanup;
+ if (VIR_REALLOC_N(secret_value, secret_size + 1) < 0)
+ goto cleanup;
+
+ secret_value[secret_size] = '\0';
+
if (iscsi_set_initiator_username_pwd(iscsi,
authdef->username,
(const char *)secret_value) < 0) {
--
2.16.4
6 years, 3 months
[libvirt] [PATCH v3 0/3] Don't touch user data from tests
by Michal Privoznik
v3 of:
https://www.redhat.com/archives/libvir-list/2018-July/msg00747.html
diff to v2:
- pushed some already ACKed patches
- dropped controversial line from 1/3 that turned off error reporting
Michal Prívozník (3):
qemuxml2argvtest: Set more fake drivers
check-file-access: Allow specifying action
virtestmock: Track action
tests/check-file-access.pl | 32 +++++++++++++++++++++++++++-----
tests/file_access_whitelist.txt | 15 ++++++++++-----
tests/qemuxml2argvtest.c | 4 ++++
tests/virtestmock.c | 39 ++++++++++++++++++++++-----------------
4 files changed, 63 insertions(+), 27 deletions(-)
--
2.16.4
6 years, 3 months
[libvirt] [PATCH] rpc: Initialize a worker pool for max_workers=0 as well
by Marc Hartmayer
Semantically, there is no difference between an uninitialized worker
pool and an initialized worker pool with zero workers. Let's allow the
worker pool to be initialized for max_workers=0 as well then which
makes the API more symmetric and simplifies code. Validity of the
worker pool is delegated to virThreadPoolGetMaxWorkers instead.
This patch fixes segmentation faults in
virNetServerGetThreadPoolParameters and
virNetServerSetThreadPoolParameters for the case when no worker pool
is actually initialized (max_workers=0).
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
---
src/rpc/virnetserver.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index c26637ed031d..b4461b3803cf 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -205,7 +205,7 @@ virNetServerDispatchNewMessage(virNetServerClientPtr client,
virObjectRef(srv);
virObjectUnlock(srv);
- if (srv->workers) {
+ if (virThreadPoolGetMaxWorkers(srv->workers) > 0) {
virNetServerJobPtr job;
if (VIR_ALLOC(job) < 0)
@@ -367,8 +367,7 @@ virNetServerPtr virNetServerNew(const char *name,
if (!(srv = virObjectLockableNew(virNetServerClass)))
return NULL;
- if (max_workers &&
- !(srv->workers = virThreadPoolNew(min_workers, max_workers,
+ if (!(srv->workers = virThreadPoolNew(min_workers, max_workers,
priority_workers,
virNetServerHandleJob,
srv)))
@@ -579,21 +578,18 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
goto error;
if (virJSONValueObjectAppendNumberUint(object, "min_workers",
- srv->workers == NULL ? 0 :
virThreadPoolGetMinWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set min_workers data in JSON document"));
goto error;
}
if (virJSONValueObjectAppendNumberUint(object, "max_workers",
- srv->workers == NULL ? 0 :
virThreadPoolGetMaxWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set max_workers data in JSON document"));
goto error;
}
if (virJSONValueObjectAppendNumberUint(object, "priority_workers",
- srv->workers == NULL ? 0 :
virThreadPoolGetPriorityWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set priority_workers data in JSON document"));
--
2.13.4
6 years, 3 months
[libvirt] [PATCH 0/2] esx: Fix {g,s}et vcpus
by Marcos Paulo de Souza
Hi guys,
while checking my ESXi 6.5, and trying to query and change vcpus values, I
discovered this was not working. So, these two patches aim to fix the problem. I
checked some docs[1].
Let me know if there are points where it can be improved.
Thanks,
[1] https://www.vmware.com/support/orchestrator/doc/vco_vsphere55_api/html/Vc...
Marcos Paulo de Souza (2):
esx: Make esxDomainGetVcpusFlags return vcpus again
esx:Fix esxDomainGetMaxVcpus to return correct vcpus
src/esx/esx_driver.c | 72 +++++++++++++++++++++++++++-----------------
1 file changed, 45 insertions(+), 27 deletions(-)
--
2.17.1
6 years, 3 months
[libvirt] [PATCH 00/11] More virAuthGet* cleanups
by John Ferlan
In a case of review collision, Michal pushed Marcos Paulo de Souza's
series after I had reviewed, but before seeing my review (oh well):
https://www.redhat.com/archives/libvir-list/2018-August/msg00874.html
Rather than worry about it, here's a series of changes that I
described in my review:
https://www.redhat.com/archives/libvir-list/2018-August/msg00860.html
based on top of Marcos' now pushed weries.
The only thing I didn't cover in this was my comment regarding
xenapiUtil_RequestPassword - I just left it as is.
John Ferlan (11):
util: Alter virAuthGet*Path API to check valid parameters
util: Alter virAuthGet*Path API to check valid callback
util: Remove invalid parameter checks from
virAuthGet{Username|Password}
util: Alter virAuthGet*Path API return processing
util: Alter virAuthGet*Path API to generate auth->cb error
esx: Don't overwrite virAuthGet{Username|Password} errors
hyperv: Don't overwrite virAuthGet{Username|Password} errors
phyp: Don't overwrite virAuthGet{Username|Password} errors
xenapi: Don't overwrite virAuthGet{Username|Password} errors
test: Don't overwrite virAuthGet{Username|Password} errors
rpc: Don't overwrite virAuthGet{Username|Password}Path errors
src/esx/esx_driver.c | 27 ++++------------
src/hyperv/hyperv_driver.c | 16 +++------
src/phyp/phyp_driver.c | 16 +++------
src/rpc/virnetlibsshsession.c | 2 --
src/rpc/virnetsshsession.c | 5 +--
src/test/test_driver.c | 15 +++------
src/util/virauth.c | 61 ++++++++++++++++++++++++-----------
src/xenapi/xenapi_driver.c | 16 +++------
8 files changed, 67 insertions(+), 91 deletions(-)
--
2.17.1
6 years, 3 months
[libvirt] [PATCH 0/5] Unify check for auth and auth->cb
by Marcos Paulo de Souza
Hi guys,
in some drivers, auth and auth->cb are checked in connectOpen function, while in xenapi,
only auth is checked, which that could lead to a problem if cb if invalid. In
phyp, auth and auth->cb are checked twice, in getUser and getPassword.
So, this patchset adds the check for auth and auth->cb inside
virAuthGetUsername and virAuthGetPassword, making it safer for all drivers that
rely in auth callbacks.
Marcos Paulo de Souza (5):
virauth.c: Check for valid auth callback
esx: Drop check for auth and auth->cb
hyperv: Drop check for auth and auth->cb
phyp: Drop check for auth and auth->cb
xenapi: Drop check for auth
src/esx/esx_driver.c | 7 -------
src/hyperv/hyperv_driver.c | 7 -------
src/phyp/phyp_driver.c | 11 -----------
src/util/virauth.c | 12 ++++++++++++
src/xenapi/xenapi_driver.c | 6 ------
5 files changed, 12 insertions(+), 31 deletions(-)
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] news: Add support for MBA (Memory Bandwidth Allocation)
by bing.niu@intel.com
From: Bing Niu <bing.niu(a)intel.com>
Signed-off-by: Bing Niu <bing.niu(a)intel.com>
---
docs/news.xml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 2f0c010..c6d03f5 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -44,6 +44,15 @@
iscsiadm. It support basic pool operations: checkPool and refreshPool.
</description>
</change>
+ <change>
+ <summary>
+ Add support for MBA (Memory Bandwidth Allocation technology)
+ </summary>
+ <description>
+ Domain vCPU threads can now have allocated some parts of host memory
+ bandwidth by using the <code>memorytune</code> element in <code>cputune</code>.
+ </description>
+ </change>
</section>
<section title="Improvements">
<change>
--
2.7.4
6 years, 3 months
[libvirt] [dbus PATCH 0/3] Fix and improve syntax-check
by Andrea Bolognani
Andrea Bolognani (3):
tests: Point flake8 to the files it needs to check
configure: Detect flake8 automatically
configure: Find flake8 on FreeBSD
Makefile.am | 2 +-
configure.ac | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
--
2.17.1
6 years, 3 months
[libvirt] [dbus PATCH 0/2] configure: Various fixes
by Andrea Bolognani
Andrea Bolognani (2):
configure: Fix quoting
configure: Call PKG_CHECK_MODULES() correctly
configure.ac | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
--
2.17.1
6 years, 3 months