Re: [PATCH v3 2/4] kaslr: calculate the memory region in immovable node

From: Baoquan He
Date: Wed Dec 06 2017 - 04:28:14 EST


On 12/05/17 at 11:40am, Kees Cook wrote:
> On Tue, Dec 5, 2017 at 12:51 AM, Chao Fan <fanc.fnst@xxxxxxxxxxxxxx> wrote:
> > If there is no immovable memory region specified, go on the old code.
> > There are several conditons:
> > 1. CONFIG_MEMORY_HOTPLUG is not specified to y.
> > 2. immovable_mem= is not specified.
> >
> > Otherwise, calculate the intersecting between memmap entry and
> > immovable memory.
>
> Instead of copy/pasting code between process_efi_entries() and
> process_e820_entries(), I'd rather that process_mem_region() is
> modified to deal with immovable regions.

If put it into process_mem_region(), one level of loop is added. How
about changing it like below. If no immovable_mem, just process the
region in process_immovable_mem(). This we don't need to touch
process_mem_region().