render / rpms / libvirt

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