]> git.baikalelectronics.ru Git - kernel.git/commit
x86/boot/KASLR: Add checking for the offset of kernel virtual address randomization
authorBaoquan He <bhe@redhat.com>
Tue, 27 Jun 2017 12:39:05 +0000 (20:39 +0800)
committerIngo Molnar <mingo@kernel.org>
Fri, 30 Jun 2017 06:53:14 +0000 (08:53 +0200)
commit46478c1485ddbfd077010ada0c12a95857b8e8cb
tree31b01dbb7af587f6901862e071336f43a6a46c10
parent2bf6b41ddc35e609eb819043e68c2908dc325216
x86/boot/KASLR: Add checking for the offset of kernel virtual address randomization

For kernel text KASLR, the virtual address is confined to area of 1G,
[0xffffffff80000000, 0xffffffffc0000000). For the implemenataion of
virtual address randomization, we only randomize to get an offset
between 16M and 1G, then add this offset to the starting address,
0xffffffff80000000. Here 16M is the offset which is decided at linking
stage. So the amount of the local variable 'virt_addr' which respresents
the offset plus the kernel output size can not exceed KERNEL_IMAGE_SIZE.

Add a debug check for the offset. If out of bounds, print error
message and hang there.

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1498567146-11990-2-git-send-email-bhe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/boot/compressed/misc.c