|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2] nestedsvm: Fix multi-byte IO port intercept check
For multi-byte IO port accesses, the APM says that SVM should intercept
if any of the corresponding permission bits are set. However, the code
has this backwards and only intercepts if all the permission bits are
set. Fix this and at the same time, make things safer by handling
mapping failures as intercepted. Also rename the 'enabled' variable to
make it clearer what it does.
This affects Hyper-V since it does not generally set all the permission
bits of the multi-byte ports it allows its root partition to access.
This results in an L2 root partition that cannot do PCI config space
accesses and therefore cannot access its NVMe disk to continue booting.
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
In v2:
* Intercept if mapping fails
* Rename "enabled" variable
xen/arch/x86/hvm/svm/nestedsvm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 5adb1bd72c4d..8885916399b4 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -830,7 +830,7 @@ nsvm_vmcb_guest_intercepts_ioio(paddr_t iopm_pa, uint64_t
exitinfo1)
ioio_info_t ioinfo;
uint16_t port;
unsigned int size;
- bool enabled;
+ bool intercepted;
ioinfo.bytes = exitinfo1;
port = ioinfo.fields.port;
@@ -851,8 +851,8 @@ nsvm_vmcb_guest_intercepts_ioio(paddr_t iopm_pa, uint64_t
exitinfo1)
for ( io_bitmap = hvm_map_guest_frame_ro(gfn, 0); ; )
{
- enabled = io_bitmap && test_bit(port, io_bitmap);
- if ( !enabled || !--size )
+ intercepted = !io_bitmap || test_bit(port, io_bitmap);
+ if ( intercepted || !--size )
break;
if ( unlikely(++port == 8 * PAGE_SIZE) )
{
@@ -863,7 +863,7 @@ nsvm_vmcb_guest_intercepts_ioio(paddr_t iopm_pa, uint64_t
exitinfo1)
}
hvm_unmap_guest_frame(io_bitmap, 0);
- if ( !enabled )
+ if ( !intercepted )
return NESTEDHVM_VMEXIT_HOST;
return NESTEDHVM_VMEXIT_INJECT;
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |