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

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