Re: Crash on kvm_iommu_map_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 01, 2010 at 09:25:00AM -0400, Jan Kiszka wrote:
> Am 01.11.2010 14:21, Roedel, Joerg wrote:
> > The registers rax and rbx contain non-canonical addresses (if
> > interpreted as pointers). The instruction where this happens is a mov so
> > I guess that the #GP is because of an non-canonical address.
> > Can you find out the code-line where this happens and the exact
> > assembler instruction? (haven't managed to decode the registers used).
> 
> In pfn_to_dma_pte, line 710:
> 
>                 if (!dma_pte_present(pte)) {
> ffffffff8121de8c:       f6 03 03                testb  $0x3,(%rbx)
> ffffffff8121de8f:       0f 85 d8 00 00 00       jne    ffffffff8121df6d <pfn_to_dma_pte+0x154>
> 
> The first instruction raises the fault.

Ok, so it seems that my understanding of the Code: field in the
crash-message was wrong :)
Anyway, the testb uses rbx as an address which has a non-canonical
value. This means the the address of 'pte' is invalid. Since rax also
contains a wrong address the 'parent' variable probably already contains
the wrong address. Does the attached patch help?

diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 5619f85..ca46f24 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -6,7 +6,7 @@
  */
 #define VTD_PAGE_SHIFT		(12)
 #define VTD_PAGE_SIZE		(1UL << VTD_PAGE_SHIFT)
-#define VTD_PAGE_MASK		(((u64)-1) << VTD_PAGE_SHIFT)
+#define VTD_PAGE_MASK		((((u64)-1) << VTD_PAGE_SHIFT) & ((1ULL << 52) - 1))
 #define VTD_PAGE_ALIGN(addr)	(((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
 
 #define DMA_PTE_READ (1)

-- 
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux