Xen Security Advisory 129 (CVE-2015-4104) - PCI MSI mask bits inadvertently exposed to guests
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Xen Security Advisory CVE-2015-4104 / XSA-129
version 2
PCI MSI mask bits inadvertently exposed to guests
UPDATES IN VERSION 2
====================
Public release.
CVE assigned.
ISSUE DESCRIPTION
=================
The mask bits optionally available in the PCI MSI capability structure are used by the hypervisor to occasionally suppress interrupt delivery. Unprivileged guests were, however, nevertheless allowed direct control of these bits.
IMPACT
======
Interrupts may be observed by Xen at unexpected times, which may lead to a host crash and therefore a Denial of Service.
VULNERABLE SYSTEMS
==================
Xen versions 3.3 and onwards are vulnerable due to supporting PCI pass-through.
Only x86 systems are vulnerable. ARM systems are not vulnerable.
Only HVM guests with their device model run in Dom0 can take advantage of this vulnerability.
Only HVM guests which have been granted access to physical PCI devices (`PCI passthrough') can take advantage of this vulnerability.
Furthermore, the vulnerability is only applicable when the passed-through PCI devices are MSI-capable. (Most modern devices are.)
MITIGATION
==========
This issue can be avoided by not assigning MSI capable PCI devices to untrusted HVM guests.
This issue can also be avoided by only using PV guests.
It can also be avoided by configuring HVM guests with their device model run in a separate (stub) domain. (When using xl, this can be requested with "device_model_stubdomain_override=1" in the domain configuration file.)
CREDITS
=======
This issue was discovered by Jan Beulich of SUSE.
RESOLUTION
==========
Applying the appropriate attached patch resolves this issue.
xsa129-qemuu.patch qemu-upstream-unstable, Xen 4.5.x, Xen 4.4.x xsa129-qemuu-4.3.patch Xen 4.3.x xsa129-qemut.patch qemu-xen-unstable, Xen 4.5.x, Xen 4.4.x, Xen 4.3.x, Xen 4.2.x
$ sha256sum xsa129*.patch 3c6b5a085eec3a528b18207ca65222300911fd25501a9ffaffa76a5d85d23992 xsa129-qemut.patch 314808fbaa97d06bc4bb6cb6644dca1ae2da55534661c662c6e442d5b91e6061 xsa129-qemuu-4.3.patch 9f0658e197c539306118723d63b468d09fe3a1d9f9364f6d06e53b7be8268bdc xsa129-qemuu.patch $
DEPLOYMENT DURING EMBARGO
=========================
Deployment of patches or migitations is NOT permitted (except on systems used and administered only by organisations which are members of the Xen Project Security Issues Predisclosure List). Specifically, deployent on public cloud systems is NOT permitted.
This is because the altered PCI config space access behavior is visible to guests.
Deployment is permitted only AFTER the embargo ends.
(Note: this during-embargo deployment notice is retained in post-embargo publicly released Xen Project advisories, even though it is then no longer applicable. This is to enable the community to have oversight of the Xen Project Security Team's decisionmaking.)
For more information about permissible uses of embargoed information, consult the Xen Project community's agreed Security Policy:
http://www.xenproject.org/security-policy.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEcBAEBAgAGBQJVbbdRAAoJEIP+FMlX6CvZe+4H/RcQcEsggqHg5eK/9yowQV1c erLWwpP18+v1pSRKqC+In/snL4g6H1DiC7ezwEbyQzOA8GGgiikTHqyTyFATvEHN hCwMgYW4ZYcR/euqJ7kgi7q368+39sM6ZzEnKCwr4GUeWLtBh+6ABeih5XlfjyfS 0HWuw+NBkT7IcIR/KaQwa17or3fZ2cZKq1NU4EksFjuD+ucMS7a4sPs1SztoSbXc Qf5TZn0XsDWoAodX/EmI4xRubpKL6Ae6noOCkBDelssvwzIhR1rZfFL8qALy+axf vb4le4Woy7USkWssOURSvkY8iMio25qvwGFxORzI9x4ImMU+XC+r6QSCLER202Q= =VQRQ
-----END PGP SIGNATURE-----
xen: don't allow guest to control MSI mask register
It's being used by the hypervisor. For now simply mimic a device not capable of masking, and fully emulate any accesses a guest may issue nevertheless as simple reads/writes without side effects.
This is XSA-129.
hw/pass-through.c +85 -1
@@ -147,6 +147,10 @@ static uint32_t pt_msgaddr64_reg_init(st struct pt_reg_info_tbl *reg, uint32_t real_offset);static uint32_t pt_msgdata_reg_init (struct pt_dev *ptdev,struct pt_reg_info_tbl *reg,uint32_t real_offset); +static uint32_t pt_mask_reg_init (struct pt_dev *ptdev, +struct pt_reg_info_tbl *reg,uint32_t real_offset); +static uint32_t pt_pending_reg_init (struct pt_dev *ptdev, +struct pt_reg_info_tbl *reg,uint32_t real_offset);static uint32_t pt_msixctrl_reg_init (struct pt_dev *ptdev,struct pt_reg_info_tbl *reg,uint32_t real_offset); static uint32_t pt_header_type_reg_init(struct pt_dev *ptdev,
@@ -644,7 +648,7 @@ static struct pt_reg_info_tbl pt_emu_reg .size = 2, .init_val = 0x0000, .ro_mask = 0xFF8E, - .emu_mask = 0x007F, + .emu_mask = 0x017F, .init = pt_msgctrl_reg_init, .u.w.read = pt_word_reg_read, .u.w.write = pt_msgctrl_reg_write,
@@ -698,6 +702,50 @@ static struct pt_reg_info_tbl pt_emu_reg .u.w.write = pt_msgdata_reg_write, .u.w.restore = NULL, }, +/* Mask reg (if PCI_MSI_FLAGS_MASK_BIT set, for 32-bit devices) */ + { + .offset = PCI_MSI_MASK_32, + .size = 4, + .init_val = 0x00000000, + .ro_mask = 0xFFFFFFFF, + .emu_mask = 0xFFFFFFFF, + .init = pt_mask_reg_init, + .u.dw.read = pt_long_reg_read, + .u.dw.write = pt_long_reg_write, + }, + /* Mask reg (if PCI_MSI_FLAGS_MASK_BIT set, for 64-bit devices) */ + { + .offset = PCI_MSI_MASK_64, + .size = 4, + .init_val = 0x00000000, + .ro_mask = 0xFFFFFFFF, + .emu_mask = 0xFFFFFFFF, + .init = pt_mask_reg_init, + .u.dw.read = pt_long_reg_read, + .u.dw.write = pt_long_reg_write, + }, + /* Pending reg (if PCI_MSI_FLAGS_MASK_BIT set, for 32-bit devices) */ + { + .offset = PCI_MSI_MASK_32 + 4, + .size = 4, + .init_val = 0x00000000, + .ro_mask = 0xFFFFFFFF, + .emu_mask = 0x00000000, + .init = pt_pending_reg_init, + .u.dw.read = pt_long_reg_read, + .u.dw.write = pt_long_reg_write, + }, + /* Pending reg (if PCI_MSI_FLAGS_MASK_BIT set, for 64-bit devices) */ + { + .offset = PCI_MSI_MASK_64 + 4, + .size = 4, + .init_val = 0x00000000, + .ro_mask = 0xFFFFFFFF, + .emu_mask = 0x00000000, + .init = pt_pending_reg_init, + .u.dw.read = pt_long_reg_read, + .u.dw.write = pt_long_reg_write, + }, { .size = 0, },
@@ -3023,6 +3071,42 @@ static uint32_t pt_msgdata_reg_init(strureturn PT_INVALID_REG ; } +/* this function will be called twice (for 32 bit and 64 bit type) */ +/* initialize Mask register */ +static uint32_t pt_mask_reg_init (struct pt_dev *ptdev, +struct pt_reg_info_tbl *reg,uint32_t real_offset) +{ +uint32_t flags = ptdev->msi->flags; +uint32_t offset = reg->offset; + +if (!(flags &PCI_MSI_FLAGS_MASK_BIT )) +return PT_INVALID_REG ; + +if (offset == (flags &PCI_MSI_FLAGS_64BIT ? +PCI_MSI_MASK_64 :PCI_MSI_MASK_32 )) +return reg->init_val; + +return PT_INVALID_REG ; +} + +/* this function will be called twice (for 32 bit and 64 bit type) */ +/* initialize Pending register */ +static uint32_t pt_pending_reg_init (struct pt_dev *ptdev, +struct pt_reg_info_tbl *reg,uint32_t real_offset) +{ +uint32_t flags = ptdev->msi->flags; +uint32_t offset = reg->offset; + +if (!(flags &PCI_MSI_FLAGS_MASK_BIT )) +return PT_INVALID_REG ; + +if (offset == (flags &PCI_MSI_FLAGS_64BIT ? +PCI_MSI_MASK_64 +4 :PCI_MSI_MASK_32 +4 )) +return reg->init_val; + +return PT_INVALID_REG ; +} +/* initialize Message Control register for MSI-X */ static uint32_t pt_msixctrl_reg_init (struct pt_dev *ptdev,struct pt_reg_info_tbl *reg,uint32_t real_offset)
hw/pass-through.h +6 -0
@@ -84,6 +84,12 @@#define PCI_MSI_FLAGS_MASK_BIT 0x0100#endif +#ifndef PCI_MSI_MASK_32 +/* interrupt masking register */ +#define PCI_MSI_MASK_32 12 +#define PCI_MSI_MASK_64 16 +#endif +#ifndef PCI_EXP_TYPE_PCIE_BRIDGE /* PCI/PCI-X to PCIE Bridge */ #define PCI_EXP_TYPE_PCIE_BRIDGE 0x8
xen: don't allow guest to control MSI mask register
It's being used by the hypervisor. For now simply mimic a device not capable of masking, and fully emulate any accesses a guest may issue nevertheless as simple reads/writes without side effects.
This is XSA-129.
hw/msi.c +0 -4
@@ -21,10 +21,6 @@#include "msi.h" #include "range.h" -/* Eventually those constants should go to Linux pci_regs.h */ -#define PCI_MSI_PENDING_32 0x10 -#define PCI_MSI_PENDING_64 0x14 -/* PCI_MSI_ADDRESS_LO */ #define PCI_MSI_ADDRESS_LO_MASK (~0x3)
hw/xen_pt_config_init.c +88 -10
128 lines not on this page · raw message
hw/pci_regs.h +2 -0
@@ -298,8 +298,10 @@#define PCI_MSI_ADDRESS_HI 8/* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8/* 16 bits of data for 32-bit devices */ #define PCI_MSI_MASK_32 12/* Mask bits register for 32-bit devices */ +#define PCI_MSI_PENDING_32 16/* Pending bits register for 32-bit devices */ #define PCI_MSI_DATA_64 12/* 16 bits of data for 64-bit devices */ #define PCI_MSI_MASK_64 16/* Mask bits register for 64-bit devices */ +#define PCI_MSI_PENDING_64 20/* Pending bits register for 32-bit devices */ /* MSI-X registers */ #define PCI_MSIX_FLAGS 2
xen: don't allow guest to control MSI mask register
It's being used by the hypervisor. For now simply mimic a device not capable of masking, and fully emulate any accesses a guest may issue nevertheless as simple reads/writes without side effects.
This is XSA-129.
hw/pci/msi.c +0 -4
@@ -21,10 +21,6 @@#include "hw/pci/msi.h" #include "qemu/range.h" -/* Eventually those constants should go to Linux pci_regs.h */ -#define PCI_MSI_PENDING_32 0x10 -#define PCI_MSI_PENDING_64 0x14 -/* PCI_MSI_ADDRESS_LO */ #define PCI_MSI_ADDRESS_LO_MASK (~0x3)
hw/xen/xen_pt_config_init.c +88 -10
128 lines not on this page · raw message
include/hw/pci/pci_regs.h +2 -0
@@ -298,8 +298,10 @@#define PCI_MSI_ADDRESS_HI 8/* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ #define PCI_MSI_DATA_32 8/* 16 bits of data for 32-bit devices */ #define PCI_MSI_MASK_32 12/* Mask bits register for 32-bit devices */ +#define PCI_MSI_PENDING_32 16/* Pending bits register for 32-bit devices */ #define PCI_MSI_DATA_64 12/* 16 bits of data for 64-bit devices */ #define PCI_MSI_MASK_64 16/* Mask bits register for 64-bit devices */ +#define PCI_MSI_PENDING_64 20/* Pending bits register for 32-bit devices */ /* MSI-X registers */ #define PCI_MSIX_FLAGS 2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel