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


Groups > linux.kernel > #1741292

Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the direct mapping section for SGI UV system

From Baoquan He <bhe@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the direct mapping section for SGI UV system
Date 2017-09-28 10:40 +0200
Message-ID <uuCwr-6Fg-35@gated-at.bofh.it> (permalink)
References <umZJw-5lZ-13@gated-at.bofh.it> <umZJx-5lZ-19@gated-at.bofh.it> <uuBTI-6bp-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Ingo,

On 09/28/17 at 09:56am, Ingo Molnar wrote:
> > diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c
> > index af599167fe3c..4d68c08df82d 100644
> > --- a/arch/x86/mm/kaslr.c
> > +++ b/arch/x86/mm/kaslr.c
> > @@ -27,6 +27,7 @@
> >  #include <asm/pgtable.h>
> >  #include <asm/setup.h>
> >  #include <asm/kaslr.h>
> > +#include <asm/uv/uv.h>
> >  
> >  #include "mm_internal.h"
> >  
> > @@ -123,7 +124,7 @@ void __init kernel_randomize_memory(void)
> >  		CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING;
> >  
> >  	/* Adapt phyiscal memory region size based on available memory */
> > -	if (memory_tb < kaslr_regions[0].size_tb)
> > +	if (memory_tb < kaslr_regions[0].size_tb && !is_early_uv_system())
> >  		kaslr_regions[0].size_tb = memory_tb;
> This is really an ugly hack. Is kaslr_regions[] incorrect? If so then it should be 
> corrected instead of uglifying the code that uses it...

Thanks for looking into this!

If on SGI UV system, the kaslr_regions[0].size_tb, namely the size of
the direct mapping section, is incorrect. 

Its direct mapping size includes two parts:
#1 RAM size of system
#2 MMIOH region size which only SGI UV system has.

However, the #2 can only be got till uv_system_init() is called in
native_smp_prepare_cpus(). That is too late for mm KASLR calculation.
That's why I made this hack.

I checked uv_system_init() code, seems not easy to know the size of
MMIOH region before or inside kernel_randomize_memory(). I have CCed UV
devel experts, not sure if they have any idea about this. Otherwise,
this patch could be the only way I can think of.

Hi Mike and Russ,

Is there any chance we can get the size of MMIOH region before mm KASLR
code, namely before we call kernel_randomize_memory()?

Thanks
Baoquan

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


Thread

Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the  direct mapping section for SGI UV system Ingo Molnar <mingo@kernel.org> - 2017-09-28 10:00 +0200
  Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the  direct mapping section for SGI UV system Baoquan He <bhe@redhat.com> - 2017-09-28 10:40 +0200
    Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the  direct mapping section for SGI UV system Ingo Molnar <mingo@kernel.org> - 2017-09-28 11:10 +0200
      Re: [PATCH v2 RESEND 2/2] x86/mm/KASLR: Do not adapt the size of the  direct mapping section for SGI UV system Baoquan He <bhe@redhat.com> - 2017-09-30 13:30 +0200

csiph-web