-----Original Message-----
----- Original Message -----
> 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
>
> --
> Crash-utility mailing list
> Crash-utility(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/crash-utility
Hi Johan,
I also see it with 64k pages when the referenced memory is in the high
ranges.
But there are actually two issues here, because the
SECTION_PAGE_MASK_2MB and SECTION_PAGE_MASK_512MB macros are
incorrectly being defined as 32-bit values.
How does this patch work for you?:
--- a/arm64.c
+++ b/arm64.c
@@ -702,8 +702,8 @@ arm64_uvtop(struct task_context *tc, ulong uvaddr,
physaddr_t *paddr, int verbos
#define PMD_TYPE_MASK 3
#define PMD_TYPE_SECT 1
#define PMD_TYPE_TABLE 2
-#define SECTION_PAGE_MASK_2MB (~((MEGABYTES(2))-1))
-#define SECTION_PAGE_MASK_512MB (~((MEGABYTES(512))-1))
+#define SECTION_PAGE_MASK_2MB ((long)(~((MEGABYTES(2))-1)))
+#define SECTION_PAGE_MASK_512MB ((long)(~((MEGABYTES(512))-1)))
static int
arm64_vtop_2level_64k(ulong pgd, ulong vaddr, physaddr_t *paddr, int
verbose) @@ -729,7 +729,7 @@ arm64_vtop_2level_64k(ulong pgd, ulong
vaddr, physaddr_t *paddr, int verbose)
*/
if ((pgd_val & PMD_TYPE_MASK) == PMD_TYPE_SECT) {
- ulong sectionbase = pgd_val & SECTION_PAGE_MASK_512MB;
+ ulong sectionbase = (pgd_val & SECTION_PAGE_MASK_512MB)
+ & PHYS_MASK;
if (verbose) {
fprintf(fp, " PAGE: %lx (512MB)\n\n",
sectionbase);
arm64_translate_pte(pgd_val, 0, 0); @@ -801,7
+801,7 @@ arm64_vtop_3level_4k(ulong pgd, ulong vaddr, physaddr_t
*paddr, int verbose)
goto no_page;
if ((pmd_val & PMD_TYPE_MASK) == PMD_TYPE_SECT) {
- ulong sectionbase = pmd_val & SECTION_PAGE_MASK_2MB;
+ ulong sectionbase = (pmd_val & SECTION_PAGE_MASK_2MB) &
+ PHYS_MASK;
if (verbose) {
fprintf(fp, " PAGE: %lx (2MB)\n\n",
sectionbase);
arm64_translate_pte(pmd_val, 0, 0);