Re: [kernel-hardening] [PATCH v4] scripts: add leaking_addresses.pl

From: Petr Mladek
Date: Mon Nov 20 2017 - 10:40:06 EST


On Mon 2017-11-13 11:16:28, kaiwan.billimoria@xxxxxxxxx wrote:
> On Mon, 2017-11-13 at 09:21 +1100, Tobin C. Harding wrote:
> > On Fri, Nov 10, 2017 at 07:26:34PM +0530, kaiwan.billimoria@xxxxxxxxx
> > > - it currently hard-codes a global 'PAGE_OFFSET_32BIT=0xc0000000'
> > > , just
> > > so I can test quickly; must figure whether to query it or pass it;
> > > Suggestions?
> >
> > Perhaps we should have a command line option for this.
> >
> > --kernel-base-address
>
> Why not just detect it programatically? We could devise a series of
> fallbacks; something like:
> - if .config exists in the kernel source tree root, grep it for
> PAGE_OFFSET
> - if not, grep the arch-specific (arch/<arch>/configs/<config-file>)
> for the same
> - if for some reason we don't have enough info regarding specific
> platform and thus the defconfig filename (could happen for ARM, PPC?),
> we then fail and request the user to pass it as a parameter.

You might also check /proc/config.gz.

Best Regards,
Petr