a2479f
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
a2479f
Date: Fri, 14 Jun 2019 09:17:39 +0200
a2479f
Subject: [PATCH] api: disallow virConnect*HypervisorCPU on read-only
a2479f
 connections
a2479f
MIME-Version: 1.0
a2479f
Content-Type: text/plain; charset=UTF-8
a2479f
Content-Transfer-Encoding: 8bit
a2479f
a2479f
These APIs can be used to execute arbitrary emulators.
a2479f
Forbid them on read-only connections.
a2479f
a2479f
Fixes: CVE-2019-10168
a2479f
Signed-off-by: Ján Tomko <jtomko@redhat.com>
a2479f
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
a2479f
(cherry picked from commit bf6c2830b6c338b1f5699b095df36f374777b291)
a2479f
---
a2479f
 src/libvirt-host.c | 2 ++
a2479f
 1 file changed, 2 insertions(+)
a2479f
a2479f
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
a2479f
index e20d6ee250..2978825d22 100644
a2479f
--- a/src/libvirt-host.c
a2479f
+++ b/src/libvirt-host.c
a2479f
@@ -1041,6 +1041,7 @@ virConnectCompareHypervisorCPU(virConnectPtr conn,
a2479f
 
a2479f
     virCheckConnectReturn(conn, VIR_CPU_COMPARE_ERROR);
a2479f
     virCheckNonNullArgGoto(xmlCPU, error);
a2479f
+    virCheckReadOnlyGoto(conn->flags, error);
a2479f
 
a2479f
     if (conn->driver->connectCompareHypervisorCPU) {
a2479f
         int ret;
a2479f
@@ -1234,6 +1235,7 @@ virConnectBaselineHypervisorCPU(virConnectPtr conn,
a2479f
 
a2479f
     virCheckConnectReturn(conn, NULL);
a2479f
     virCheckNonNullArgGoto(xmlCPUs, error);
a2479f
+    virCheckReadOnlyGoto(conn->flags, error);
a2479f
 
a2479f
     if (conn->driver->connectBaselineHypervisorCPU) {
a2479f
         char *cpu;