]> git.baikalelectronics.ru Git - kernel.git/commit
x86/boot/compressed/64: Set up GOT for paging_prepare() and cleanup_trampoline()
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 16 May 2018 08:01:28 +0000 (11:01 +0300)
committerIngo Molnar <mingo@kernel.org>
Wed, 16 May 2018 10:15:13 +0000 (12:15 +0200)
commit9ec32eeaa829d0314492ebb22c2f22820221f8fe
tree42aa65ef4c13221b669153cd743c9346f9042b1a
parent390cd81c8cbe58e07d453d23014adaae97697cf9
x86/boot/compressed/64: Set up GOT for paging_prepare() and cleanup_trampoline()

Eric and Hugh have reported instant reboot due to my recent changes in
decompression code.

The root cause is that I didn't realize that we need to adjust GOT to be
able to run C code that early.

The problem is only visible with an older toolchain. Binutils >= 2.24 is
able to eliminate GOT references by replacing them with RIP-relative
address loads:

  https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=80d873266dec

We need to adjust GOT two times:

 - before calling paging_prepare() using the initial load address
 - before calling C code from the relocated kernel

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: e44c480b044b ("x86/boot/compressed/64: Handle 5-level paging boot if kernel is above 4G")
Link: http://lkml.kernel.org/r/20180516080131.27913-2-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/boot/compressed/head_64.S