Re: [PATCH v4 4/4] x86/boot/KASLR: Limit kaslr to choosing the immovable memory

From: Dou Liyang
Date: Thu Aug 02 2018 - 12:02:08 EST




At 08/02/2018 02:00 PM, Chao Fan wrote:
On Thu, Aug 02, 2018 at 01:46:29PM +0800, Dou Liyang wrote:
Hi Fan,

At 07/23/2018 05:29 PM, Chao Fan wrote:
If 'CONFIG_MEMORY_HOTREMOVE' specified and the account of immovable
memory regions is not zero. Calculate the intersection between memory
regions from e820/efi memory table and immovable memory regions.
Or go on the old code.

Rename process_mem_region to slots_count to match slots_fetch_random,
and name new function as process_mem_region.

Signed-off-by: Chao Fan <fanc.fnst@xxxxxxxxxxxxxx>
---
arch/x86/boot/compressed/kaslr.c | 66 ++++++++++++++++++++++++++------
1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 4705682caf1f..10bda3a1fcaa 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -631,9 +631,9 @@ static unsigned long slots_fetch_random(void)
return 0;
}
-static void process_mem_region(struct mem_vector *entry,
- unsigned long minimum,
- unsigned long image_size)
+static void slots_count(struct mem_vector *entry,
^^^^^^^^^^^
is not suitable.
IMO, how about process_mem_slots() or you may have a better name, it's
up to you.

It's from Kees Cook's advise, he wants to ues slots_count() to match
slots_fetch_random() in my old PATCH long long ago.
Since the method of handling this part is not changed a lot, so I keep
this name.


Okay! ;-)


dou