Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550369

Re: [PATCH] x86: fix kaslr and memmap collision

From Baoquan He <bhe@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] x86: fix kaslr and memmap collision
Date 2017-01-04 03:00 +0100
Message-ID <sVJ1T-6fS-9@gated-at.bofh.it> (permalink)
References (1 earlier) <sGeW5-4Pc-15@gated-at.bofh.it> <sGnd0-1Py-13@gated-at.bofh.it> <sVsNr-3qW-5@gated-at.bofh.it> <sVC0p-1Og-17@gated-at.bofh.it> <sVDIR-30E-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/03/17 at 01:15pm, Dave Jiang wrote:
> 
> 
> On 01/03/2017 11:24 AM, Dan Williams wrote:
> > On Tue, Jan 3, 2017 at 12:31 AM, Baoquan He <bhe@redhat.com> wrote:
> >> Hi Dan,
> >>
> >> On 11/22/16 at 09:26am, Dan Williams wrote:
> >>> [ replying for Dave since he's offline today and tomorrow ]
> >>>
> >>> On Tue, Nov 22, 2016 at 12:47 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >>>>
> >>>> * Dave Jiang <dave.jiang@intel.com> wrote:
> >>>>
> >>>>> CONFIG_RANDOMIZE_BASE relocates the kernel to a random base address.
> >>>>> However it does not take into account the memmap= parameter passed in from
> >>>>> the kernel commandline.
> >>>>
> >>>> memmap= parameters are often used as a list.
> >>>>
> >>>>> [...] This results in the kernel sometimes being put in the middle of the user
> >>>>> memmap. [...]
> >>>>
> >>>> What does this mean? If memmap= is used to re-define the memory map then the
> >>>> kernel getting in the middle of a RAM area is what we want, isn't it? What we
> >>>> don't want is for the kernel to get into reserved areas, right?
> >>>
> >>> Right, this is about teaching kaslr to not land the kernel in newly
> >>> defined reserved regions that were not marked reserved in the initial
> >>> e820 map from platform firmware.
> >>
> >> If only tell kaslr to not land kernel in newly defined reserved regions,
> >> memory added by "memmap=nn[KMG]@ss[KMG]" should not be avoided since
> >> it's usable memory. Kernel randomized into this region is also what we
> >> want. Not sure if I understand it right.
> > 
> > You're right, this is supposed to be for memmap=nn!ss cases which
> > defines reserved persistent memory ranges, not memmap=nn@ss which
> > defines usable memory.
> > 
> > We need to fix mem_avoid_memmap() to only skip memmap= statements that
> > specify reserved memory.

Thanks for confirmation, Dan!

> > 
> 
> I think nn@ss is the only one that we should skip over, otherwise
> everything else looks like should be avoided. I'll update.
Hi Dave,

I guess your purpose is to avoid the user defined reserved memory and
pmem which I am not very sure about since kaslr won't stamp on ACPI
region reported by BIOS. Seems OK to avoid them all except of nn@ss.

I have other concerns, will directly comment in your v4 post.

Thanks
Baoquan

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH] x86: fix kaslr and memmap collision Baoquan He <bhe@redhat.com> - 2017-01-03 09:40 +0100
  Re: [PATCH] x86: fix kaslr and memmap collision Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-01-03 17:30 +0100
  Re: [PATCH] x86: fix kaslr and memmap collision Dan Williams <dan.j.williams@intel.com> - 2017-01-03 19:30 +0100
    Re: [PATCH] x86: fix kaslr and memmap collision Dave Jiang <dave.jiang@intel.com> - 2017-01-03 21:20 +0100
      Re: [PATCH] x86: fix kaslr and memmap collision Baoquan He <bhe@redhat.com> - 2017-01-04 03:00 +0100

csiph-web