alistair23-linux/arch/x86/boot
Yinghai Lu 2d3862d26e lib/decompressors: use real out buf size for gunzip with kernel
When loading x86 64bit kernel above 4GiB with patched grub2, got kernel
gunzip error.

| early console in decompress_kernel
| decompress_kernel:
|       input: [0x807f2143b4-0x807ff61aee]
|      output: [0x807cc00000-0x807f3ea29b] 0x027ea29c: output_len
| boot via startup_64
| KASLR using RDTSC...
|  new output: [0x46fe000000-0x470138cfff] 0x0338d000: output_run_size
|  decompress: [0x46fe000000-0x47007ea29b] <=== [0x807f2143b4-0x807ff61aee]
|
| Decompressing Linux... gz...
|
| uncompression error
|
| -- System halted

the new buffer is at 0x46fe000000ULL, decompressor_gzip is using
0xffffffb901ffffff as out_len.  gunzip in lib/zlib_inflate/inflate.c cap
that len to 0x01ffffff and decompress fails later.

We could hit this problem with crashkernel booting that uses kexec loading
kernel above 4GiB.

We have decompress_* support:
    1. inbuf[]/outbuf[] for kernel preboot.
    2. inbuf[]/flush() for initramfs
    3. fill()/flush() for initrd.
This bug only affect kernel preboot path that use outbuf[].

Add __decompress and take real out_buf_len for gunzip instead of guessing
wrong buf size.

Fixes: 1431574a1c (lib/decompressors: fix "no limit" output buffer length)
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-10 13:29:01 -07:00
..
compressed lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
tools x86/efi: Include a .bss section within the PE/COFF headers 2014-07-10 14:21:39 +01:00
.gitignore
a20.c
apm.c
bioscall.S x86, boot: Move intcall() to the .inittext section 2014-01-04 14:29:08 -08:00
bitops.h
boot.h x86/boot: Obsolete the MCA sys_desc_table 2015-07-21 10:55:11 +02:00
cmdline.c
code16gcc.h x86, build: Change code16gcc.h from a C header to an assembly header 2014-06-04 13:16:48 -07:00
copy.S x86, boot: Use .code16 instead of .code16gcc 2014-01-04 13:59:06 -08:00
cpu.c x86: Support compiling out human-friendly processor feature names 2014-08-17 15:54:00 -07:00
cpucheck.c Merge branch 'x86/boot' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-04-02 12:23:49 -07:00
cpuflags.c x86, boot: Fix word-size assumptions in has_eflag() inline asm 2014-01-30 08:04:32 -08:00
cpuflags.h x86, boot: Rename get_flags() and check_flags() to *_cpuflags() 2013-10-13 04:08:56 -07:00
ctype.h x86, setup: Rename BOOT_ISDIGIT_H to BOOT_CTYPE_H 2015-01-13 11:59:04 +01:00
early_serial_console.c x86, early_serial_console: Remove unnecessary check 2015-01-13 12:14:44 +01:00
edd.c x86, boot: Create a separate string.h file to provide standard string functions 2014-03-19 15:43:45 -07:00
header.S kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00
install.sh
main.c x86/boot: Obsolete the MCA sys_desc_table 2015-07-21 10:55:11 +02:00
Makefile x86/boot: Obsolete the MCA sys_desc_table 2015-07-21 10:55:11 +02:00
memory.c
mkcpustr.c x86: Introduce disabled-features 2014-09-11 14:30:02 -07:00
mtools.conf.in
pm.c
pmjump.S
printf.c x86/boot: Fix a sanity check in printf.c 2013-08-14 11:48:41 +02:00
regs.c x86, boot: Create a separate string.h file to provide standard string functions 2014-03-19 15:43:45 -07:00
setup.ld
string.c x86/boot: Standardize strcmp() 2015-03-23 10:24:12 +01:00
string.h x86, boot: Move memcmp() into string.h and string.c 2014-03-19 15:44:04 -07:00
tty.c
version.c
vesa.h
video-bios.c
video-mode.c x86/boot/video: Move the 'video_segment' variable to video.c 2015-02-19 00:25:05 +01:00
video-vesa.c x86, boot: Create a separate string.h file to provide standard string functions 2014-03-19 15:43:45 -07:00
video-vga.c
video.c x86/boot/video: Move the 'video_segment' variable to video.c 2015-02-19 00:25:05 +01:00
video.h x86/boot/video: Move the 'video_segment' variable to video.c 2015-02-19 00:25:05 +01:00