hypervisor/ivshmem: Add check to prevent malicious BAR0 opts
The ivshmem spec define the BAR0 offset > 16 are reserved. So ACRN need ignore all operation when offset out of range. Tracked-On: #8487 Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
45382dca4b
commit
c6eda313f9
|
@ -198,7 +198,9 @@ static int32_t ivshmem_mmio_handler(struct io_request *io_req, void *data)
|
|||
struct ivshmem_device *ivs_dev = (struct ivshmem_device *) vdev->priv_data;
|
||||
uint64_t offset = mmio->address - vdev->vbars[IVSHMEM_MMIO_BAR].base_gpa;
|
||||
|
||||
if ((mmio->size == 4U) && ((offset & 0x3U) == 0U)) {
|
||||
/* ivshmem spec define the BAR0 offset > 16 are reserved */
|
||||
if ((mmio->size == 4U) && ((offset & 0x3U) == 0U) &&
|
||||
(offset < sizeof(ivs_dev->mmio))) {
|
||||
/*
|
||||
* IVSHMEM_IRQ_MASK_REG and IVSHMEM_IRQ_STA_REG are R/W registers
|
||||
* they are useless for ivshmem Rev.1.
|
||||
|
|
Loading…
Reference in New Issue