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

From: Kees Cook
Date: Wed Feb 06 2019 - 10:29:37 EST


On Wed, Feb 6, 2019 at 2:18 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> 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,
> apparently:
>
> 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.

Originally, there weren't a lot of things that needed to be avoided
and physical memory was relatively consecutive, so adding complexity
here didn't make sense.

I'm fine adjusting all this to do things better. Ultimately, we're
still walking two lists to process their intersection.

> > 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?

Eh, it's just in the boot stub. ;)

--
Kees Cook