Re: [Crash-utility] [PATCH v2 3/3] kaslr: get offset by walking page tree

2020-10-28 Thread d.hatay...@fujitsu.com
> calc_kaslr_offset() already deals with PTI here: > >if (st->pti_init_vmlinux || st->kaiser_init_vmlinux) >pgd = cr3 & ~(CR3_PCID_MASK|PTI_USER_PGTABLE_MASK); >else >pgd = cr3 & ~CR3_PCID_MASK; > > Thus it's OK to think that the CR3 points at the

Re: [Crash-utility] [PATCH v2 3/3] kaslr: get offset by walking page tree

2020-10-28 Thread d.hatay...@fujitsu.com
> > + */ > > +static int > > +find_kernel_start(ulong *va, ulong *pa) > > +{ > > + int i, pgd_idx, pud_idx, pmd_idx, pte_idx; > > + uint64_t pgd_pte, pud_pte, pmd_pte, pte; > > + > > + pgd_idx = pgd_index(__START_KERNEL_map); > > + pud_idx = pud_index(__START_KERNEL_map); >

Re: [Crash-utility] [PATCH v2 3/3] kaslr: get offset by walking page tree

2020-10-28 Thread Alexey Makhalov
Hi Daisuke, On Oct 28, 2020, at 4:37 AM, d.hatay...@fujitsu.com wrote: /* + * Find virtual (VA) and physical (PA) addresses of kernel start + * + * va: + * Actual address of the kernel start (_stext) placed + * randomly by kaslr feature. To be more accurate, +

Re: [Crash-utility] [PATCH v2 3/3] kaslr: get offset by walking page tree

2020-10-28 Thread d.hatay...@fujitsu.com
> /* > + * Find virtual (VA) and physical (PA) addresses of kernel start > + * > + * va: > + * Actual address of the kernel start (_stext) placed > + * randomly by kaslr feature. To be more accurate, > + * VA = _stext(from vmlinux) + kaslr_offset > + * > + * pa: > + * Physical address wher

[Crash-utility] [PATCH v2 3/3] kaslr: get offset by walking page tree

2020-10-26 Thread Alexey Makhalov
This method requires only valid CR3. It walks through page tree starting from __START_KERNEL_map to get real _stext and its physical address. _stext_vmlinux has to be initialized. So, requesting it by "st->_stext_vmlinux = UNINITIALIZED;" for sadump and vmware backends. Other backends may use "--ka