Re: [PATCH 2/2] x86/boot: increase maximum number of avoided KASLR regions

From: Borislav Petkov
Date: Wed Feb 06 2019 - 09:18:07 EST

On Wed, Feb 06, 2019 at 01:50:57PM +0100, Julian Stecklina wrote:
> Because at this point, we are not in a good position to handle an
> unlimited amount of regions.

We could save only the regions which are ok to kaslr into. And we do,

static struct slot_area slot_areas[MAX_SLOT_AREA];

but I guess there was a reason to do the mem_avoid thing too instead of
collecting only OK ranges directly. Maybe Kees will know.

> As for the choice of "16", I took our usecase and multiplied it by two.
> FWIW, this could be even larger.

Because our kernel is not fat enough huh?

Btw, you missed a spot:

static unsigned long find_random_phys_addr(unsigned long minimum,
unsigned long image_size)
/* Check if we had too many memmaps. */
if (memmap_too_large) {
debug_putstr("Aborted memory entries scan (more than 4 memmap= args)!\n");

Good mailing practices for 400: avoid top-posting and trim the reply.