[Crash-utility] [PATCH] arm64: incorrect translation, physical address include flags

Erlandsson, Johan Johan.Erlandsson at sonymobile.com
Tue Sep 8 10:30:47 UTC 2015


Hi

We have seen a problem when translating virtual to physical
addresses. It appears that upper flags are not cleared.

Example below, observe that physical address is incorrect for 'PAGE:',
it include flags in upper bits. This value is also returned from
arm64_vtop_3level_4k().

crash> vtop ffffffc081000000
VIRTUAL           PHYSICAL
ffffffc081000000  81000000

PAGE DIRECTORY: ffffffc00007d000
   PGD: ffffffc00007d810 => 61fe003
   PMD: ffffffc0061fe040 => 20000081000711
  PAGE: 20000081000000  (2MB)

     PTE        PHYSICAL  FLAGS
20000081000711  81000000  (VALID|SHARED|AF|PXN)

vtop: WARNING: sparsemem: invalid section number: 8388610
---
 arm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arm64.c b/arm64.c
index d1d75c4..2320df9 100644
--- a/arm64.c
+++ b/arm64.c
@@ -802,6 +802,7 @@ arm64_vtop_3level_4k(ulong pgd, ulong vaddr, physaddr_t *paddr, int verbose)
 
 	if ((pmd_val & PMD_TYPE_MASK) == PMD_TYPE_SECT) {
 		ulong sectionbase = pmd_val & SECTION_PAGE_MASK_2MB;
+		sectionbase &= PHYS_MASK;
 		if (verbose) {
 			fprintf(fp, "  PAGE: %lx  (2MB)\n\n", sectionbase);
 			arm64_translate_pte(pmd_val, 0, 0);
-- 
1.9.1




More information about the Crash-utility mailing list