android_kernel_lge_bullhead/arch/x86
Yinghai Lu 6ccec4ea9c 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: 1431574a1c4 (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>
2019-08-26 17:03:29 +02:00
..
boot lib/decompressors: use real out buf size for gunzip with kernel 2019-08-26 17:03:29 +02:00
configs bludgeon the qualcomm kernel until it builds on i386 for qemu testing 2015-06-15 15:10:00 -07:00
crypto crypto: xts - consolidate sanity check for keys 2019-08-26 16:59:13 +02:00
ia32 This is the 3.10.100 stable release 2018-01-25 17:22:43 -07:00
include This is the 3.10.108 stable release 2018-01-25 17:57:49 -07:00
kernel This is the 3.10.108 stable release 2018-01-25 17:57:49 -07:00
kvm KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit 2017-11-02 10:46:03 +01:00
lguest Merge branch 'x86-paravirt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-04-30 08:41:21 -07:00
lib x86, smap: Handle csum_partial_copy_*_user() 2013-09-26 17:18:13 -07:00
math-emu
mm This is the 3.10.108 stable release 2018-01-25 17:57:49 -07:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-10-01 12:07:34 +02:00
oprofile
pci x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F 2017-06-20 14:04:07 +02:00
platform This is the 3.10.106 stable release 2018-01-25 17:54:29 -07:00
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
realmode x86, build: Pass in additional -mno-mmx, -mno-sse options 2013-12-20 07:45:10 -08:00
syscalls BACKPORT: random: introduce getrandom(2) system call 2017-01-25 19:06:23 -08:00
tools x86, relocs: Move __vvar_page from S_ABS to S_REL 2013-06-12 15:14:57 -07:00
um This is the 3.10.105 stable release 2018-01-25 17:45:32 -07:00
vdso x86/vdso: Fix the build on GCC5 2015-03-26 15:01:00 +01:00
video
xen xen/x86: don't lose event interrupts 2017-06-20 14:04:52 +02:00
.gitignore
Kbuild
Kconfig arm: add support for LZ4-compressed kernel 2019-08-26 17:03:22 +02:00
Kconfig.cpu
Kconfig.debug Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2013-04-30 17:04:09 -07:00
Makefile stackprotector: Unify the HAVE_CC_STACKPROTECTOR logic between architectures 2014-07-25 13:08:41 -07:00
Makefile.um
Makefile_32.cpu