[PATCH v2 0/8] x86/kaslr: Cleanup and small bugfixes

From: Arvind Sankar
Date: Mon Jul 27 2020 - 19:08:06 EST


The first 7 patches are cleanup and minor bugfixes on the x86 KASLR
code.

The last one is a bit of an RFC. The memory regions used for KASLR are
stored as 64-bit even on a 32-bit kernel. However there are still a few
local variables that are 32-bit, but should be ok as far as I can see
because they are assigned values that have been already limited to
32-bit. It does make it a little harder to verify that the code is
correct. Since KASLR cannot actually use 64-bit regions for the 32-bit
kernel, the patch reduces regions to their below-4G segment when
creating them, making the actual variables 32-bit. Alternatively, the
few local variables could be upgraded to 64-bit.

v1->v2:
- Fix a bug in the bugfix 5/8: overlap.start can be smaller than
region.start, so shouldn't subtract before comparing.

Arvind Sankar (8):
x86/kaslr: Make command line handling safer
x86/kaslr: Remove bogus warning and unnecessary goto
x86/kaslr: Fix process_efi_entries comment
x86/kaslr: Initialize mem_limit to the real maximum address
x86/kaslr: Simplify __process_mem_region
x86/kaslr: Simplify process_gb_huge_pages
x86/kaslr: Clean up slot handling
x86/kaslr: Don't use 64-bit mem_vector for 32-bit kernel

arch/x86/boot/compressed/acpi.c | 7 +-
arch/x86/boot/compressed/kaslr.c | 228 ++++++++++++-------------------
arch/x86/boot/compressed/misc.h | 19 ++-
3 files changed, 111 insertions(+), 143 deletions(-)

--
2.26.2