ARM: Fix uvtop conversion on LPAE

Currently arm_uvtop() calls arm_lpae_vtop() with the LPAE and it can
use LPAE_VTOP() also for a user virtual address.  Without this patch,
commands that use uvtop conversion such as "ps -a", "gcore" fail as
readmem() for a uvaddr returns a seek error:

  crash> ps -a 357
  ...
  ps: cannot access user stack address: bef2f97c
  crash> gcore
  gcore: seek error: physical address: 7ec56eab  type: "fill_psinfo: pr_psargs"
  Failed.

Fixes: https://github.com/crash-utility/crash-extensions/issues/2
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
This commit is contained in:
Kazuhito Hagio 2021-04-16 09:35:34 +09:00
parent b440dc57c6
commit c32abbf89d
1 changed files with 10 additions and 9 deletions

19
arm.c
View File

@ -1125,17 +1125,18 @@ arm_lpae_vtop(ulong vaddr, ulong *pgd, physaddr_t *paddr, int verbose)
pmd_t pmd_pte;
pte_t pte;
if (!vt->vmalloc_start) {
*paddr = LPAE_VTOP(vaddr);
return TRUE;
}
if (!IS_VMALLOC_ADDR(vaddr)) {
*paddr = LPAE_VTOP(vaddr);
if (!verbose)
if (IS_KVADDR(vaddr)) {
if (!vt->vmalloc_start) {
*paddr = LPAE_VTOP(vaddr);
return TRUE;
}
}
if (!IS_VMALLOC_ADDR(vaddr)) {
*paddr = LPAE_VTOP(vaddr);
if (!verbose)
return TRUE;
}
}
if (verbose)
fprintf(fp, "PAGE DIRECTORY: %lx\n", (ulong)pgd);