Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
qemu-linux-user
0389-ppc-add-host-serial-and-host-model-.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0389-ppc-add-host-serial-and-host-model-.patch of Package qemu-linux-user
From: Jose R Ziviani <jose.ziviani@suse.com> Date: Fri, 7 May 2021 13:11:16 -0600 Subject: 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 Git-commit: 27461d69a0f108dea756419251acc3ea65198f1b Git-commit: 0a794529bd1109aeea0c407784b40a2605e808b9 References: bsc#1126455 CVE-2019-8934 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> Signed-off-by: Jose R Ziviani <jose.ziviani@suse.com> --- hw/ppc/spapr.c | 55 ++++++++++++++++++++++++++++++++++++++++-- include/hw/ppc/spapr.h | 3 +++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6a8fca5b19309e42e2912b46977c..d52421e9f253817b05d4a31e53fc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -321,6 +321,9 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, uint32_t epow_irq) { void *fdt; + sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine()); + MachineState *machine = MACHINE(qdev_get_machine()); + sPAPRMachineState *spapr = SPAPR_MACHINE(machine); uint32_t start_prop = cpu_to_be32(initrd_base); uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size); GString *hypertas = g_string_sized_new(256); @@ -362,11 +365,16 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, * 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)) { + if (spapr->host_model) { + _FDT((fdt_property_string(fdt, "host-model", spapr->host_model))); + } else if (smc->broken_host_serial_model && kvmppc_get_host_model(&buf)) { _FDT((fdt_property_string(fdt, "host-model", buf))); g_free(buf); } - if (kvmppc_get_host_serial(&buf)) { + + if (spapr->host_serial) { + _FDT((fdt_property_string(fdt, "host-serial", spapr->host_serial))); + } else if (smc->broken_host_serial_model && kvmppc_get_host_serial(&buf)) { _FDT((fdt_property_string(fdt, "host-serial", buf))); g_free(buf); } @@ -2087,6 +2095,37 @@ static void spapr_set_kvm_type(Object *obj, const char *value, Error **errp) spapr->kvm_type = g_strdup(value); } +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_machine_initfn(Object *obj) { sPAPRMachineState *spapr = SPAPR_MACHINE(obj); @@ -2097,6 +2136,17 @@ static void spapr_machine_initfn(Object *obj) object_property_set_description(obj, "kvm-type", "Specifies the KVM virtualization mode (HV, PR)", 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", + "Host model to advertise in guest device tree", &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", + "Host serial number to advertise in guest device tree", &error_abort); } static void spapr_machine_finalizefn(Object *obj) @@ -2378,6 +2428,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) spapr_machine_2_6_class_options(mc); smc->use_ohci_by_default = true; + smc->broken_host_serial_model = true; SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_5); } diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 815d5eec45d1f5a44d893502dc04..bca6b5f80e225b5647d4cb9d85c0 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -37,6 +37,7 @@ struct sPAPRMachineClass { /*< public >*/ bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */ bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */ + bool broken_host_serial_model; /* present real host info to the guest */ }; /** @@ -78,6 +79,8 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; + char *host_model; + char *host_serial; MemoryHotplugState hotplug_memory; };
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor