Blame SOURCES/libvirt-api-disallow-virConnect-HypervisorCPU-on-read-only-connections.patch

0a7476
From f97144b76b3452e69c14834d1ecc69dbf802ac12 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <f97144b76b3452e69c14834d1ecc69dbf802ac12@dist-git>
e53605
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
e53605
Date: Tue, 18 Jun 2019 13:30:02 +0200
e53605
Subject: [PATCH] api: disallow virConnect*HypervisorCPU on read-only
e53605
 connections
e53605
MIME-Version: 1.0
e53605
Content-Type: text/plain; charset=UTF-8
e53605
Content-Transfer-Encoding: 8bit
e53605
e53605
These APIs can be used to execute arbitrary emulators.
e53605
Forbid them on read-only connections.
e53605
e53605
Fixes: CVE-2019-10168
e53605
Signed-off-by: Ján Tomko <jtomko@redhat.com>
e53605
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
e53605
Signed-off-by: Ján Tomko <jtomko@redhat.com>
e53605
Message-Id: <470651092e7d6a4ba5875cf8885fd3714d5ea189.1560857354.git.jtomko@redhat.com>
e53605
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
e53605
---
e53605
 src/libvirt-host.c | 2 ++
e53605
 1 file changed, 2 insertions(+)
e53605
e53605
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
e53605
index e20d6ee250..2978825d22 100644
e53605
--- a/src/libvirt-host.c
e53605
+++ b/src/libvirt-host.c
e53605
@@ -1041,6 +1041,7 @@ virConnectCompareHypervisorCPU(virConnectPtr conn,
e53605
 
e53605
     virCheckConnectReturn(conn, VIR_CPU_COMPARE_ERROR);
e53605
     virCheckNonNullArgGoto(xmlCPU, error);
e53605
+    virCheckReadOnlyGoto(conn->flags, error);
e53605
 
e53605
     if (conn->driver->connectCompareHypervisorCPU) {
e53605
         int ret;
e53605
@@ -1234,6 +1235,7 @@ virConnectBaselineHypervisorCPU(virConnectPtr conn,
e53605
 
e53605
     virCheckConnectReturn(conn, NULL);
e53605
     virCheckNonNullArgGoto(xmlCPUs, error);
e53605
+    virCheckReadOnlyGoto(conn->flags, error);
e53605
 
e53605
     if (conn->driver->connectBaselineHypervisorCPU) {
e53605
         char *cpu;
e53605
-- 
e53605
2.22.0
e53605