On Mon, Jun 28, 2021 at 06:30:24AM +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
> 
> -----Original Message-----
> > At present, we have the following important changes for arm64 memory
> > layout:
> > 
> > -1. redesigned ARM64 kernel virtual memory layout and associated KASLR
> >     support that was introduced in Linux 4.6. And NEW_VMEMMAP is used to
> >     flag it.
> > -2. memory layout flipped just right before introducing 52-bits kernel.
> > -3. introducing of vabits_actual and phyvirt_offset in kernel
> > -4. removing phyvirt_offset.
> > 
> > These changes have effects on PTOV()/VTOP() formula. So introducing a
> > dedicate field mmlayout_flags to record it.
> > 
> > Among above, 2 and 3 are introduced closely, and are not distinguished
> > in current implement. And this patch also keep this practice and use
> > vabits_actual as a hint to flag mem flipped.
> > 
> > Signed-off-by: Pingfan Liu <[email protected]>
> > Cc: HAGIO KAZUHITO <[email protected]>
> > Cc: Lianbo Jiang <[email protected]>
> > Cc: Bhupesh Sharma <[email protected]>
> > To: [email protected]
> > ---
> >  arm64.c | 11 +++++++++++
> >  defs.h  |  3 +++
> >  2 files changed, 14 insertions(+)
> > 
> > diff --git a/arm64.c b/arm64.c
> > index 8934961..98138b2 100644
> > --- a/arm64.c
> > +++ b/arm64.c
> > @@ -560,6 +560,10 @@ arm64_dump_machdep_table(ulong arg)
> >             fprintf(fp, "%sMACHDEP_BT_TEXT", others++ ? "|" : "");
> >     if (machdep->flags & NEW_VMEMMAP)
> >             fprintf(fp, "%sNEW_VMEMMAP", others++ ? "|" : "");
> > +   if (machdep->flags & FLIPPED_VM)
> > +           fprintf(fp, "%sFLIPPED_VM", others++ ? "|" : "");
> > +   if (machdep->flags & HAS_PHYSVIRT_OFFSET)
> > +           fprintf(fp, "%sHAS_PHYSVIRT_OFFSET", others++ ? "|" : "");
> >     fprintf(fp, ")\n");
> > 
> >     fprintf(fp, "              kvbase: %lx\n", machdep->kvbase);
> > @@ -994,6 +998,7 @@ arm64_calc_physvirt_offset(void)
> >             if (READMEM(pc->mfd, &physvirt_offset, sizeof(physvirt_offset),
> >                     sp->value, sp->value -
> >                     machdep->machspec->kimage_voffset) > 0) {
> > +                           machdep->flags |= HAS_PHYSVIRT_OFFSET;
> >                             ms->physvirt_offset = physvirt_offset;
> >             }
> >     }
> 
> > @@ -3923,6 +3928,7 @@ arm64_calc_VA_BITS(void)
> >     if (kernel_symbol_exists("vabits_actual")) {
> >             if (pc->flags & PROC_KCORE) {
> >                     vabits_actual = 
> > symbol_value_from_proc_kallsyms("vabits_actual");
> > +                   machdep->flags |= FLIPPED_VM;
> >                     if ((vabits_actual != BADVAL) && (READMEM(pc->mfd, 
> > &value, sizeof(ulong),
> >                         vabits_actual, KCORE_USE_VADDR) > 0)) {
> >                             if (CRASHDEBUG(1))
> > @@ -3953,6 +3959,11 @@ arm64_calc_VA_BITS(void)
> >                             machdep->machspec->VA_BITS_ACTUAL = value;
> >                             machdep->machspec->VA_BITS = value;
> >                             machdep->machspec->VA_START = 
> > _VA_START(machdep->machspec->VA_BITS_ACTUAL);
> > +                           /*
> > +                            * The mm flip commit is introduced before 
> > 52-bits VA, which is before the
> > +                            * commit to export NUMBER(TCR_EL1_T1SZ)
> > +                            */
> > +                           machdep->flags |= FLIPPED_VM;
> >                     } else if (machdep->machspec->VA_BITS_ACTUAL) {
> 
> This "else if" is for "--machdep vabits_actual=" option for Linux 5.4 and
> later not having the NUMBER(TCR_EL1_T1SZ), those also should have flipped VM.
> 
> So we can simply add the following at the beginning or the end of the
> "if vabits_actual exists" block like this?
> 
> --- a/arm64.c
> +++ b/arm64.c
> @@ -3960,6 +3960,7 @@ arm64_calc_VA_BITS(void)
>                                 error(FATAL, "cannot determine 
> VA_BITS_ACTUAL\n");
>                 }
>  
> +               machdep->flags |= FLIPPED_VM;
>                 return;
>         }
> 
Adopt,

Thanks

--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility

Reply via email to