Re: [PATCH v3] ptdump: add intermediate directory support

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

 



On Wed, May 08, 2024 at 12:20:41PM GMT, Catalin Marinas wrote:
> On Tue, Apr 30, 2024 at 11:05:01AM -0500, Maxwell Bland wrote:
> > -ptdump is a debugfs interface that provides a detailed dump of the

Hi Catalin! Apologies for the delayed response to this review, life got
in the way. A version 4 that addresses your comments is available here:

https://lore.kernel.org/all/aw675dhrbplkitj3szjut2vyidsxokogkjj3vi76wl2x4wybtg@5rhk5ca5zpmv/

> > +Assessing these attributes can assist in understanding the memory layout,
> > +access patterns and security characteristics of the kernel pages.
> 
> I presume there's some new text here.

Yes. Though after having a bit of time to think on it, I just reworked
the presentation altogether for version 4.

> 
> >  	}, {
> >  		.mask	= PTE_UXN,
> >  		.val	= PTE_UXN,
> 
> Since you are adding a separate pmd_bits[] array, I think we could get
> rid of the PTE_TABLE_BIT entry. It doesn't make sense for ptes anyway.

Done! Sweet.

> > +static const struct prot_bits pud_bits[] = {
> [...]
> > +};
> 
> Do we need pud_bits[] as well? Can we not just use pmd_bits[]? Call it
> pxd_bits if you want, the format is the same for all p*d entries.

Thanks, done!

> 
> Please separate the alignment changes into a different patch

Done! 

> > +			delta = (addr - st->start_address);
> 
> What's this supposed to show? In your example, it's strange that the PGD
> is shown as 128 bytes:

This was a bug due to my misunderstanding of what we were going for
here. Thank you for pointing it out, as it made it easy to notice and
patch.

> >  	if (pgd_leaf(val)) {
> >  		st->note_page(st, addr, 0, pgd_val(val));
> >  		walk->action = ACTION_CONTINUE;
> 
> Is the difference between leaf and non-leaf calls only the walk->action?
> We could have a single call to st->note_page() and keep the walk->action
> setting separately. Do we also need to set ACTION_SUBTREE in case the
> entry is a table entry? Or is it done in the caller somewhere? I could
> not figure out.

ACTION_SUBTREE is the default walk action, so it is implicitly set for
table descriptors.

> 
> An alternative would be to have an ARCH_WANT_NON_LEAF_PTDUMP Kconfig
> option instead of a bool note_non_leaf in struct ptdump_state. This
> option seems to be entirely static, not sure it's worth a struct member
> for it. You'd use IS_ENABLED() above instead of st->note_non_leaf.

This was an excellent idea, thank you. Incorporated.

BRs and thanks again for your help on this,
Maxwell Bland




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux