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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > + */
> > +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);
> > +       pmd_idx = pmd_index(__START_KERNEL_map);
> > +       pte_idx = pte_index(__START_KERNEL_map);
> > +
> > +       for (; pgd_idx < PTRS_PER_PGD; pgd_idx++) {
> > +               pgd_pte = ULONG(machdep->pgd + pgd_idx * sizeof(uint64_t));
> 
> machdep->pgd is not guaranteed to be aligned by PAGE_SIZE.
> This could refer to the pgd for userland that resides in the next page.
> I guess it's necessary to get the 1st pgd entry in the page machdep->pgd belongs to.
> Like this?
> 
>     pgd_pte = ULONG((machdep->pgd & PHYSICAL_PAGE_MASK) + pgd_idx * sizeof(uint64_t));

Please ignore this comment. I was confused with `pgd` here.

Thanks.
HATAYAMA, Daisuke




--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux