Re: [PATCH v2 1/3] x86/mm/KASLR: Fix the wrong calculation of kalsr region initial size
From: Ingo Molnar
Date: Mon Sep 10 2018 - 02:18:46 EST
* Baoquan He <bhe@xxxxxxxxxx> wrote:
> In memory KASLR, __PHYSICAL_MASK_SHIFT is taken to calculate the
> initial size of the direct mapping region. This is right in the
> old code where __PHYSICAL_MASK_SHIFT was equal to MAX_PHYSMEM_BITS,
> 46bit, and only 4-level mode was supported.
>
> Later, in commit:
> b83ce5ee91471d ("x86/mm/64: Make __PHYSICAL_MASK_SHIFT always 52"),
> __PHYSICAL_MASK_SHIFT was changed to be 52 always, no matter it's
> 5-level or 4-level. This is wrong for 4-level paging. Then when
> adapt phyiscal memory region size based on available memory, it
> will overflow if the amount of system RAM and the padding is bigger
> than 64TB.
>
> In fact, here MAX_PHYSMEM_BITS should be used instead. Fix it by
> replacing __PHYSICAL_MASK_SHIFT with MAX_PHYSMEM_BITS.
>
> Fixes: b83ce5ee9147 ("x86/mm/64: Make __PHYSICAL_MASK_SHIFT always 52")
> Signed-off-by: Baoquan He <bhe@xxxxxxxxxx>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Reviewed-by: Thomas Garnier <thgarnie@xxxxxxxxxx>
So this changelog has a handful of problems:
- there's a typo in the title
- what does 'memory KASLR' mean? All KASLR deals with memory.
- there's a typo in the second paragraph
- Please punctuate more precisely: '64TB' is written as '64 TB' and '46bit' is written as
'46 bits'
- '52 always' is accurate but '52 bits always' would be more useful: write out units where
appropriate to reduce ambiguity and parsing complexity of changelogs. Also, in this
particular sentence it should be 'always 52 bits'.
- s/when adapt
/when we adapt
- s/This is right in the old code
/This is correct in the old code
Thanks,
Ingo