Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-08 Thread Baoquan He
On 04/06/19 at 06:43am, Borislav Petkov wrote: > On Sat, Apr 06, 2019 at 09:51:19AM +0800, Baoquan He wrote: > > It's KASLR happened in kernel_randomize_memory() of arch/x86/mm/kaslr.c . > > What is "KASLR happened in"? This doesn't make any sense. When you look > at that function, there's a comme

Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-05 Thread Borislav Petkov
On Sat, Apr 06, 2019 at 09:51:19AM +0800, Baoquan He wrote: > It's KASLR happened in kernel_randomize_memory() of arch/x86/mm/kaslr.c . What is "KASLR happened in"? This doesn't make any sense. When you look at that function, there's a comment above it: /* Initialize base and padding for each mem

Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-05 Thread Baoquan He
On 04/05/19 at 07:22pm, Thomas Gleixner wrote: > On Fri, 5 Apr 2019, Borislav Petkov wrote: > > On Thu, Apr 04, 2019 at 10:03:13AM +0800, Baoquan He wrote: > > > In memory region KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate > > > > What is "memory region KASLR"? > > > > > the initial size o

Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-05 Thread Baoquan He
On 04/05/19 at 06:58pm, Borislav Petkov wrote: > On Thu, Apr 04, 2019 at 10:03:13AM +0800, Baoquan He wrote: > > In memory region KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate > > What is "memory region KASLR"? It's KASLR happened in kernel_randomize_memory() of arch/x86/mm/kaslr.c . In fact

Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-05 Thread Thomas Gleixner
On Fri, 5 Apr 2019, Borislav Petkov wrote: > On Thu, Apr 04, 2019 at 10:03:13AM +0800, Baoquan He wrote: > > In memory region KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate > > What is "memory region KASLR"? > > > the initial size of the direct mapping region. This is correct in > > the old c

Re: [PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-05 Thread Borislav Petkov
On Thu, Apr 04, 2019 at 10:03:13AM +0800, Baoquan He wrote: > In memory region KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate What is "memory region KASLR"? > the initial size of the direct mapping region. This is correct in > the old code where __PHYSICAL_MASK_SHIFT was equal to MAX_PHYSMEM_

[PATCH 1/2] x86/mm/KASLR: Fix the wrong calculation of memory region initial size

2019-04-03 Thread Baoquan He
In memory region KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate the initial size of the direct mapping region. This is correct in the old code where __PHYSICAL_MASK_SHIFT was equal to MAX_PHYSMEM_BITS, 46 bits, and only 4-level mode was supported. Later, in commit: b83ce5ee91471d ("x86/mm/64: