lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Dec 2016 13:02:37 +0000
From:   James Hogan <james.hogan@...tec.com>
To:     Matt Redfearn <matt.redfearn@...tec.com>
CC:     Serge Semin <fancer.lancer@...il.com>, <ralf@...ux-mips.org>,
        <paul.burton@...tec.com>, <rabinv@...s.com>,
        <alexander.sverdlin@...ia.com>, <robh+dt@...nel.org>,
        <frowand.list@...il.com>, <Sergey.Semin@...latforms.ru>,
        <linux-mips@...ux-mips.org>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 19/21] MIPS memblock: Add print out method of kernel
 virtual memory layout

Hi Matt,

On Mon, Dec 19, 2016 at 12:04:54PM +0000, Matt Redfearn wrote:
> On 19/12/16 02:07, Serge Semin wrote:
> > It's useful to have some printed map of the kernel virtual memory,
> > at least for debugging purpose.
> >
> > Signed-off-by: Serge Semin <fancer.lancer@...il.com>
> > ---

> > @@ -106,6 +107,49 @@ static void __init zone_sizes_init(void)
> >   }
> >   
> >   /*
> > + * Print out kernel memory layout
> > + */
> > +#define MLK(b, t) b, t, ((t) - (b)) >> 10
> > +#define MLM(b, t) b, t, ((t) - (b)) >> 20
> > +#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
> > +static void __init mem_print_kmap_info(void)
> > +{
> > +	pr_notice("Virtual kernel memory layout:\n"
> > +		  "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> > +		  "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> > +#ifdef CONFIG_HIGHMEM
> > +		  "    pkmap   : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> > +#endif
> > +		  "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
> > +		  "      .text : 0x%p" " - 0x%p" "   (%4td kB)\n"
> > +		  "      .data : 0x%p" " - 0x%p" "   (%4td kB)\n"
> > +		  "      .init : 0x%p" " - 0x%p" "   (%4td kB)\n",
> > +		MLM(PAGE_OFFSET, (unsigned long)high_memory),
> > +		MLM(VMALLOC_START, VMALLOC_END),
> > +#ifdef CONFIG_HIGHMEM
> > +		MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE)),
> > +#endif
> > +		MLK(FIXADDR_START, FIXADDR_TOP),
> > +		MLK_ROUNDUP(_text, _etext),
> > +		MLK_ROUNDUP(_sdata, _edata),
> > +		MLK_ROUNDUP(__init_begin, __init_end));
> 
> Please drop printing the kernel addresses, or at least only do it if 
> KASLR is not turned on, otherwise you're removing the advantage of 
> KASLR, that critical kernel addresses cannot be determined easily from 
> userspace.

According to Documentation/printk-formats.txt, this is what %pK is for.
Better to use that instead?

Cheers
James

> 
> It may be better to merge the functionality of show_kernel_relocation
> http://lxr.free-electrons.com/source/arch/mips/kernel/relocate.c#L354
> into this function, but only print it under the same conditions as 
> currently, i.e.
> #if defined(CONFIG_DEBUG_KERNEL) && defined(CONFIG_DEBUG_INFO)
> http://lxr.free-electrons.com/source/arch/mips/kernel/setup.c#L530
> 
> Thanks,
> Matt

Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ