|
@@ -0,0 +1,215 @@
|
|
|
|
+From 13e153f01b4f2a3e199202b34a247d83c176f21a Mon Sep 17 00:00:00 2001
|
|
|
|
+From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
|
+Date: Mon, 18 Feb 2019 23:43:49 +0530
|
|
|
|
+Subject: [PATCH] ppc: add host-serial and host-model machine attributes
|
|
|
|
+ (CVE-2019-8934)
|
|
|
|
+MIME-Version: 1.0
|
|
|
|
+Content-Type: text/plain; charset=UTF-8
|
|
|
|
+Content-Transfer-Encoding: 8bit
|
|
|
|
+
|
|
|
|
+On ppc hosts, hypervisor shares following system attributes
|
|
|
|
+
|
|
|
|
+ - /proc/device-tree/system-id
|
|
|
|
+ - /proc/device-tree/model
|
|
|
|
+
|
|
|
|
+with a guest. This could lead to information leakage and misuse.[*]
|
|
|
|
+Add machine attributes to control such system information exposure
|
|
|
|
+to a guest.
|
|
|
|
+
|
|
|
|
+[*] https://wiki.openstack.org/wiki/OSSN/OSSN-0028
|
|
|
|
+
|
|
|
|
+Reported-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
+Fix-suggested-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
+Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
|
+Message-Id: <20190218181349.23885-1-ppandit@redhat.com>
|
|
|
|
+Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
+Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
|
+Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
|
+
|
|
|
|
+CVE: CVE-2019-8934
|
|
|
|
+Upstream-Status: Backport
|
|
|
|
+[https://github.com/qemu/qemu/commit/27461d69a0f108dea756419251acc3ea65198f1b]
|
|
|
|
+
|
|
|
|
+Signed-off-by: Dan Tran <dantran@microsoft.com>
|
|
|
|
+---
|
|
|
|
+ hw/ppc/spapr.c | 128 ++++++++++++++++++++++++++++++++++++++---
|
|
|
|
+ include/hw/ppc/spapr.h | 2 +
|
|
|
|
+ 2 files changed, 123 insertions(+), 7 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
|
|
|
+index 421b2dd09b..069d678ee0 100644
|
|
|
|
+--- a/hw/ppc/spapr.c
|
|
|
|
++++ b/hw/ppc/spapr.c
|
|
|
|
+@@ -1266,13 +1266,30 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
|
|
|
|
+ * Add info to guest to indentify which host is it being run on
|
|
|
|
+ * and what is the uuid of the guest
|
|
|
|
+ */
|
|
|
|
+- if (kvmppc_get_host_model(&buf)) {
|
|
|
|
+- _FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
|
|
|
|
+- g_free(buf);
|
|
|
|
++ if (spapr->host_model && !g_str_equal(spapr->host_model, "none")) {
|
|
|
|
++ if (g_str_equal(spapr->host_model, "passthrough")) {
|
|
|
|
++ /* -M host-model=passthrough */
|
|
|
|
++ if (kvmppc_get_host_model(&buf)) {
|
|
|
|
++ _FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
|
|
|
|
++ g_free(buf);
|
|
|
|
++ }
|
|
|
|
++ } else {
|
|
|
|
++ /* -M host-model=<user-string> */
|
|
|
|
++ _FDT(fdt_setprop_string(fdt, 0, "host-model", spapr->host_model));
|
|
|
|
++ }
|
|
|
|
+ }
|
|
|
|
+- if (kvmppc_get_host_serial(&buf)) {
|
|
|
|
+- _FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
|
|
|
|
+- g_free(buf);
|
|
|
|
++
|
|
|
|
++ if (spapr->host_serial && !g_str_equal(spapr->host_serial, "none")) {
|
|
|
|
++ if (g_str_equal(spapr->host_serial, "passthrough")) {
|
|
|
|
++ /* -M host-serial=passthrough */
|
|
|
|
++ if (kvmppc_get_host_serial(&buf)) {
|
|
|
|
++ _FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
|
|
|
|
++ g_free(buf);
|
|
|
|
++ }
|
|
|
|
++ } else {
|
|
|
|
++ /* -M host-serial=<user-string> */
|
|
|
|
++ _FDT(fdt_setprop_string(fdt, 0, "host-serial", spapr->host_serial));
|
|
|
|
++ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ buf = qemu_uuid_unparse_strdup(&qemu_uuid);
|
|
|
|
+@@ -3027,6 +3044,73 @@ static void spapr_set_vsmt(Object *obj, Visitor *v, const char *name,
|
|
|
|
+ visit_type_uint32(v, name, (uint32_t *)opaque, errp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
++static char *spapr_get_ic_mode(Object *obj, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ if (spapr->irq == &spapr_irq_xics_legacy) {
|
|
|
|
++ return g_strdup("legacy");
|
|
|
|
++ } else if (spapr->irq == &spapr_irq_xics) {
|
|
|
|
++ return g_strdup("xics");
|
|
|
|
++ } else if (spapr->irq == &spapr_irq_xive) {
|
|
|
|
++ return g_strdup("xive");
|
|
|
|
++ } else if (spapr->irq == &spapr_irq_dual) {
|
|
|
|
++ return g_strdup("dual");
|
|
|
|
++ }
|
|
|
|
++ g_assert_not_reached();
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
++static void spapr_set_ic_mode(Object *obj, const char *value, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
|
|
|
|
++ error_setg(errp, "This machine only uses the legacy XICS backend, don't pass ic-mode");
|
|
|
|
++ return;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ /* The legacy IRQ backend can not be set */
|
|
|
|
++ if (strcmp(value, "xics") == 0) {
|
|
|
|
++ spapr->irq = &spapr_irq_xics;
|
|
|
|
++ } else if (strcmp(value, "xive") == 0) {
|
|
|
|
++ spapr->irq = &spapr_irq_xive;
|
|
|
|
++ } else if (strcmp(value, "dual") == 0) {
|
|
|
|
++ spapr->irq = &spapr_irq_dual;
|
|
|
|
++ } else {
|
|
|
|
++ error_setg(errp, "Bad value for \"ic-mode\" property");
|
|
|
|
++ }
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
++static char *spapr_get_host_model(Object *obj, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ return g_strdup(spapr->host_model);
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
++static void spapr_set_host_model(Object *obj, const char *value, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ g_free(spapr->host_model);
|
|
|
|
++ spapr->host_model = g_strdup(value);
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
++static char *spapr_get_host_serial(Object *obj, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ return g_strdup(spapr->host_serial);
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
++static void spapr_set_host_serial(Object *obj, const char *value, Error **errp)
|
|
|
|
++{
|
|
|
|
++ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
++
|
|
|
|
++ g_free(spapr->host_serial);
|
|
|
|
++ spapr->host_serial = g_strdup(value);
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
+ static void spapr_instance_init(Object *obj)
|
|
|
|
+ {
|
|
|
|
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
|
|
|
+@@ -3063,6 +3147,25 @@ static void spapr_instance_init(Object *obj)
|
|
|
|
+ " the host's SMT mode", &error_abort);
|
|
|
|
+ object_property_add_bool(obj, "vfio-no-msix-emulation",
|
|
|
|
+ spapr_get_msix_emulation, NULL, NULL);
|
|
|
|
++
|
|
|
|
++ /* The machine class defines the default interrupt controller mode */
|
|
|
|
++ spapr->irq = smc->irq;
|
|
|
|
++ object_property_add_str(obj, "ic-mode", spapr_get_ic_mode,
|
|
|
|
++ spapr_set_ic_mode, NULL);
|
|
|
|
++ object_property_set_description(obj, "ic-mode",
|
|
|
|
++ "Specifies the interrupt controller mode (xics, xive, dual)",
|
|
|
|
++ NULL);
|
|
|
|
++
|
|
|
|
++ object_property_add_str(obj, "host-model",
|
|
|
|
++ spapr_get_host_model, spapr_set_host_model,
|
|
|
|
++ &error_abort);
|
|
|
|
++ object_property_set_description(obj, "host-model",
|
|
|
|
++ "Set host's model-id to use - none|passthrough|string", &error_abort);
|
|
|
|
++ object_property_add_str(obj, "host-serial",
|
|
|
|
++ spapr_get_host_serial, spapr_set_host_serial,
|
|
|
|
++ &error_abort);
|
|
|
|
++ object_property_set_description(obj, "host-serial",
|
|
|
|
++ "Set host's system-id to use - none|passthrough|string", &error_abort);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void spapr_machine_finalizefn(Object *obj)
|
|
|
|
+@@ -4067,7 +4170,18 @@ static void spapr_machine_3_0_instance_options(MachineState *machine)
|
|
|
|
+
|
|
|
|
+ static void spapr_machine_3_0_class_options(MachineClass *mc)
|
|
|
|
+ {
|
|
|
|
+- /* Defaults for the latest behaviour inherited from the base class */
|
|
|
|
++ sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
|
|
|
++ static GlobalProperty compat[] = {
|
|
|
|
++ { TYPE_SPAPR_MACHINE, "host-model", "passthrough" },
|
|
|
|
++ { TYPE_SPAPR_MACHINE, "host-serial", "passthrough" },
|
|
|
|
++ };
|
|
|
|
++
|
|
|
|
++ spapr_machine_4_0_class_options(mc);
|
|
|
|
++ compat_props_add(mc->compat_props, hw_compat_3_1, hw_compat_3_1_len);
|
|
|
|
++ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
|
|
|
|
++
|
|
|
|
++ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
|
|
|
|
++ smc->update_dt_enabled = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DEFINE_SPAPR_MACHINE(3_0, "3.0", true);
|
|
|
|
+diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
|
|
|
+index 7e5de1a6fd..4c69a55374 100644
|
|
|
|
+--- a/include/hw/ppc/spapr.h
|
|
|
|
++++ b/include/hw/ppc/spapr.h
|
|
|
|
+@@ -165,6 +165,8 @@ struct sPAPRMachineState {
|
|
|
|
+
|
|
|
|
+ /*< public >*/
|
|
|
|
+ char *kvm_type;
|
|
|
|
++ char *host_model;
|
|
|
|
++ char *host_serial;
|
|
|
|
+
|
|
|
|
+ const char *icp_type;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+2.22.0.vfs.1.1.57.gbaf16c8
|
|
|
|
+
|