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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 24 Aug 2012 23:25:48 -0500
From:	Jacob Shin <jacob.shin@....com>
To:	Yinghai Lu <yinghai@...nel.org>
CC:	X86-ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>, Tejun Heo <tj@...nel.org>,
	Dave Young <dyoung@...hat.com>,
	Chao Wang <chaowang@...hat.com>,
	Vivek Goyal <vgoyal@...hat.com>,
	Andreas Herrmann <andreas.herrmann3@....com>,
	Borislav Petkov <borislav.petkov@....com>
Subject: Re: [PATCH 5/5] x86: if kernel .text .data .bss are not marked as
 E820_RAM, complain and fix

On Fri, Aug 24, 2012 at 06:23:48PM -0700, Yinghai Lu wrote:
> On Fri, Aug 24, 2012 at 4:55 PM, Jacob Shin <jacob.shin@....com> wrote:
> > There could be cases where user supplied memmap=exactmap memory
> > mappings do not mark the region where the kernel .text .data and
> > .bss reside as E820_RAM as reported here:
> >
> > https://lkml.org/lkml/2012/8/14/86
> >
> > Handle it by complaining, and adding the range back into the e820.
> >
> > Signed-off-by: Jacob Shin <jacob.shin@....com>
> > ---
> >  arch/x86/kernel/setup.c |   15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> > index 4217fb4..b84aceb5 100644
> > --- a/arch/x86/kernel/setup.c
> > +++ b/arch/x86/kernel/setup.c
> > @@ -926,6 +926,21 @@ void __init setup_arch(char **cmdline_p)
> >         insert_resource(&iomem_resource, &data_resource);
> >         insert_resource(&iomem_resource, &bss_resource);
> >
> > +       /*
> > +        * Complain if .text .data and .bss are not marked as E820_RAM and
> > +        * attempt to fix it by adding the range. We may have a confused BIOS,
> > +        * or the user may have incorrectly supplied it via memmap=exactmap. If
> > +        * we really are running on top non-RAM, we will crash later anyways.
> > +        */
> > +       if (!e820_all_mapped(code_resource.start, bss_resource.end, E820_RAM)) {
> > +               pr_warn(".text .data .bss are not marked as E820_RAM!\n");
> > +
> > +               e820_add_region(code_resource.start,
> > +                               bss_resource.end - code_resource.start + 1,
> > +                               E820_RAM);
> > +               sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
> 
>            this sanitze_e820_map could be spared. trim_bios_range will
> that always.

Ah. okay

> 
> > +       }
> > +
> >         trim_bios_range();
> >  #ifdef CONFIG_X86_32
> >         if (ppro_with_ram_bug()) {
> 
> also should use brk_limit instead of bss_resource.end. aka need to
> keep the map for brk area.

Okay.. will fix on Monday

> 
> Thanks
> 
> Yinghai
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ