Skip to content

x86/boot/KASLR: Code bug fix about kernel virtual address randomization

Baoquan He lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 1 replyIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/boot/KASLR: Add checking for the offset of kernel virtual address randomizationarch/x86/boot/compressed/misc.c+2 -00 replies
2/2x86/boot/KASLR: Fix the wrong assignment to 'virt_addr'arch/x86/boot/compressed/kaslr.c arch/x86/boot/compressed/misc.c arch/x86/boot/compressed/misc.h+2 -70 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchDave Young
1/2
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] x86/boot/KASLR: Code bug fix about kernel virtual address randomization

People complained that crashkernel high doesn't work when kaslr code compiled in but add 'nokaslr' to diable it. Kexec has the same phenomenon.

The root cause is a code bug which assigned the original loading address of kernel to the local variable 'virt_addr' which represents the offset of kernel virtual address randmoization. As we know, kernel can be loaded to anywhere under 64T physically, this wrong assignment could cause kernel relocation handling of x86 64 error if no kaslr is taken.

The v1 post can be found here:
x86/boot/KASLR: Skip relocation handling in no kaslr case
https://patchwork.kernel.org/patch/9807789/

In v2, Ingo suggested that we should add a judgement to check if 'virt_addr' is randomized to make kernel beyond the kernel mapping area. This checking can let us know the error but not reset to firmware quietly as it does now.

Baoquan He (2):
x86/boot/KASLR: Add checking for the offset of kernel virtual address
randomization
x86/boot/KASLR: Fix the wrong assignment to 'virt_addr'

 arch/x86/boot/compressed/kaslr.c | 3 ---
 arch/x86/boot/compressed/misc.c  | 6 ++++--
 arch/x86/boot/compressed/misc.h  | 2 --
 3 files changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
2.5.5