[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728105926.GD222284@gmail.com>
Date: Tue, 28 Jul 2020 12:59:26 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Kees Cook <keescook@...omium.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/8] x86/kaslr: Clean up slot handling
* Arvind Sankar <nivedita@...m.mit.edu> wrote:
> The number of slots and slot areas can be unsigned int, since on 64-bit,
> the maximum amount of memory is 2^52, the minimum alignment is 2^21, so
> the slot number cannot be greater than 2^31. The slot areas are limited
> by MAX_SLOT_AREA, currently 100. Replace the type used for slot number,
> which is currently a mix of int and unsigned long, with unsigned int
> consistently.
>
> Drop unnecessary check that number of slots is not zero in
> store_slot_info, it's guaranteed to be at least 1 by the calculation.
>
> Drop unnecessary alignment of image_size to CONFIG_PHYSICAL_ALIGN in
> find_random_virt_addr, it cannot change the result: the largest valid
> slot is the largest n that satisfies
>
> minimum + n * CONFIG_PHYSICAL_ALIGN + image_size <= KERNEL_IMAGE_SIZE
>
> (since minimum is already aligned) and so n is equal to
>
> (KERNEL_IMAGE_SIZE - minimum - image_size) / CONFIG_PHYSICAL_ALIGN
>
> even if image_size is not aligned to CONFIG_PHYSICAL_ALIGN.
Please split this up into a couple of easily bisectable patches as
well:
- first one harmonizes the integer types used
- patch that drops the unnecessary check
- patch that drops the unnecessary alignment operation
Thanks,
Ingo
Powered by blists - more mailing lists