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

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