lkml.org 
[lkml]   [2018]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v14 5/5] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

* Chao Fan <fanc.fnst@cn.fujitsu.com> wrote:

> KASLR randomly chooses some positions which may locate in movable
> memory regions. It will break memory hotplug feature and make the
> movable memory chosen by KASLR practically immovable.
>
> The solution is to limit KASLR to choose memory regions in immovable
> node according to SRAT tables.
> When CONFIG_EARLY_PARSE_RSDP is enabled, walk through SRAT to get the
> information of immovable memory so that KASLR knows where should be
> chosen for randomization.
>
> Rename process_mem_region() as __process_mem_region() and name new
> function as process_mem_region().
>
> Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
> ---
> arch/x86/boot/compressed/kaslr.c | 75 +++++++++++++++++++++++++++-----
> 1 file changed, 64 insertions(+), 11 deletions(-)

Ok, I like this basic approach of automatically detecing memory areas we
should not KASLR into - it's far better than earlier iterations.

> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -97,6 +97,11 @@ static bool memmap_too_large;
> /* Store memory limit specified by "mem=nn[KMG]" or "memmap=nn[KMG]" */
> static unsigned long long mem_limit = ULLONG_MAX;
>
> +#ifdef CONFIG_EARLY_SRAT_PARSE
> +/* The immovable memory regions */
> +extern struct mem_vector immovable_mem[MAX_NUMNODES*2];
> +#endif

What logic is the maximum size of this array based on?

Thanks,

Ingo

\
 
 \ /
  Last update: 2018-12-17 18:43    [W:0.134 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site