3.14-stable review patch. If anyone has any objections, please let me know.
------------------ From: Kees Cook <keesc...@chromium.org> commit f285f4a21c3253887caceed493089ece17579d59 upstream. On 64-bit, relocation is not required unless the load address gets changed. Without this, relocations do unexpected things when the kernel is above 4G. Reported-by: Baoquan He <b...@redhat.com> Signed-off-by: Kees Cook <keesc...@chromium.org> Tested-by: Thomas D. <whi...@whissi.de> Cc: Vivek Goyal <vgo...@redhat.com> Cc: Jan Beulich <jbeul...@suse.com> Cc: Junjie Mao <eternal....@gmail.com> Cc: Andi Kleen <a...@linux.intel.com> Link: http://lkml.kernel.org/r/20150116005146.ga4...@www.outflux.net Signed-off-by: Thomas Gleixner <t...@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- arch/x86/boot/compressed/misc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -396,6 +396,8 @@ asmlinkage void *decompress_kernel(void unsigned long output_len, unsigned long run_size) { + unsigned char *output_orig = output; + real_mode = rmode; sanitize_boot_params(real_mode); @@ -444,7 +446,12 @@ asmlinkage void *decompress_kernel(void debug_putstr("\nDecompressing Linux... "); decompress(input_data, input_len, NULL, NULL, output, NULL, error); parse_elf(output); - handle_relocations(output, output_len); + /* + * 32-bit always performs relocations. 64-bit relocations are only + * needed if kASLR has chosen a different load address. + */ + if (!IS_ENABLED(CONFIG_X86_64) || output != output_orig) + handle_relocations(output, output_len); debug_putstr("done.\nBooting the kernel.\n"); return output; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/