[Crash-utility] [PATCH] ARM: Fix uvtop conversion on LPAE

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Mon Apr 19 00:57:11 UTC 2021


-----Original Message-----
> 在 2021年04月16日 08:35, HAGIO KAZUHITO(萩尾 一仁) 写道:
> > Currently arm_uvtop() calls arm_lpae_vtop() with the LPAE and it uses
> > LPAE_VTOP() also for a user virtual address, but it looks incorrect.
> > 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
> 
> The discussion there should be clear. Acked-by: Lianbo Jiang <lijiang at redhat.com>

Thanks, applied:
https://github.com/crash-utility/crash/commit/c32abbf89d93acb8093696adae607f602699a4a1

Kazu

> 
> > Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
> > ---
> >  arm.c | 19 ++++++++++---------
> >  1 file changed, 10 insertions(+), 9 deletions(-)
> >
> > diff --git a/arm.c b/arm.c
> > index e52d29f04015..05324691da17 100644
> > --- a/arm.c
> > +++ b/arm.c
> > @@ -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);
> >





More information about the Crash-utility mailing list