Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ec55e52

Browse files
committed
ANDROID: KVM: iommu: Fix hyp share check in __pkvm_host_use_dma_page
The hypervisor keeps track of mapped pages in the IOMMU page tables, and checks the ownership of the host overthese pages. There is also a hardening check to prevent mapping a page in the IOMMU that is shared with the hyp, this mainly an extra hardening as there shouldn't be such use case. However, there is a bug in this path where the address passed to the function was the physical address instead of virtual address. As this is a hardening check it should lead to security problems, but only failed IOMMU map pages which should have passed. Bug: 277989609 Bug: 278749606 Change-Id: Ib571e90c358b2ffd9545c83674c407d0ddc11cb2 Signed-off-by: Mostafa Saleh <[email protected]>
1 parent 04469eb commit ec55e52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/kvm/hyp/nvhe/mem_protect.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,8 @@ static int __pkvm_host_use_dma_page(phys_addr_t phys_addr)
24782478
* host shared the page.
24792479
*/
24802480
if (state & PKVM_PAGE_SHARED_BORROWED || state & PKVM_PAGE_SHARED_OWNED) {
2481-
ret = __hyp_check_page_state_range(phys_addr, PAGE_SIZE, PKVM_NOPAGE);
2481+
ret = __hyp_check_page_state_range((u64)hyp_phys_to_virt(phys_addr),
2482+
PAGE_SIZE, PKVM_NOPAGE);
24822483
if (ret)
24832484
return ret;
24842485
}

0 commit comments

Comments
 (0)