android_kernel_lge_bullhead/arch/s390
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
..
appldata arch: s390: appldata: using strncpy() and strnlen() instead of sprintf() 2013-05-28 10:35:28 +02:00
boot lib/decompressors: use real out buf size for gunzip with kernel 2019-08-26 17:03:29 +02:00
crypto crypto: xts - fix compile errors 2019-08-26 16:59:14 +02:00
hypfs aio: don't include aio.h in sched.h 2013-05-07 20:16:25 -07:00
include This is the 3.10.107 stable release 2018-01-25 17:57:41 -07:00
kernel This is the 3.10.86 stable release 2018-01-25 17:00:15 -07:00
kvm KVM: s390: Zero out current VMDB of STSI before including level3 data. 2015-05-06 21:56:21 +02:00
lib s390/uaccess: add missing page table walk range check 2013-12-04 10:57:16 -08:00
math-emu s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
mm This is the 3.10.107 stable release 2018-01-25 17:57:41 -07:00
net s390/bpf,jit: initialize A register if 1st insn is BPF_S_LDX_B_MSH 2014-05-13 13:59:42 +02:00
oprofile s390: add support for IBM zBC12 machine 2013-08-11 18:35:25 -07:00
pci s390/pci: fix use after free in dma_init 2017-06-20 14:04:33 +02:00
Kbuild s390/pci: base support 2012-11-30 15:40:45 +01:00
Kconfig Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-08-15 11:41:43 -07:00
Kconfig.debug Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 2013-04-30 17:04:09 -07:00
Makefile s390: remove small stack config option 2013-04-26 09:07:08 +02:00
defconfig s390: update defconfig 2012-09-26 15:45:29 +02:00