Re: [PATCH v2 RESEND 1/2] x86/mm/KASLR: Fix the size of the direct mapping section

From: Baoquan He
Date: Wed Apr 17 2019 - 04:35:45 EST


On 04/15/19 at 08:53pm, Borislav Petkov wrote:
> Now, lemme make sure I understand exactly what you're fixing here:
> you're fixing the case where CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING is
> not 0. Which is the case when CONFIG_MEMORY_HOTPLUG is enabled.
>
> Yes, no?

Yes, the padding is reserved specifically for possible furture memory
hotplugging.
>
> If so, please extend the commit message with that fact because it is
> crucial and the last missing piece in the explanation.
>
> Otherwise, when the padding is 0, the clamping:
>
> /* Adapt phyiscal memory region size based on available memory */
> if (memory_tb < kaslr_regions[0].size_tb)
> kaslr_regions[0].size_tb = memory_tb;
>
> will "fix" the direct mapping section size.

I made a new one to add this fact, I can repost if it's OK to you.
Thanks.