linux-brain/arch/mips
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
..
alchemy Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
ar7 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
ath25 Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-07-01 15:19:35 -07:00
ath79 MIPS: ath79: Move the GPIO driver to drivers/gpio 2015-09-03 12:08:02 +02:00
bcm47xx Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
bcm63xx MIPS: bcm63xx: Use irq_set_handler_locked() 2015-08-26 15:23:29 +02:00
bmips mips/irq: prepare for drivers/irqchip/irqchip.h removal 2015-07-31 20:51:21 +02:00
boot lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
cavium-octeon MIPS: Octeon: Fix management port MII address on Kontron S1901 2015-09-03 12:08:11 +02:00
cobalt MIPS: Cobalt Don't use module_init in non-modular MTD registration. 2015-06-21 22:14:30 +02:00
configs Yama: remove needless CONFIG_SECURITY_YAMA_STACKED 2015-07-28 13:18:19 +10:00
dec MIPS: DEC: Do not set up the FPU interrupt if no FPU 2015-04-08 01:10:46 +02:00
emma MIPS: Remove panic_timeout settings 2013-11-26 12:12:27 +01:00
fw MIPS: ARC: Use __noreturn / unreachable in ARC termination functions. 2015-01-13 16:04:27 +01:00
include Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
jazz MIPS: Jazz: Migrate to new 'set-state' interface 2015-09-03 12:07:50 +02:00
jz4740 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
kernel Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
kvm The bulk of the changes here is for x86. And for once it's not 2015-06-24 09:36:49 -07:00
lantiq MIPS: Export get_c0_perfcount_int() 2015-08-03 09:25:18 +02:00
lasat MIPS: Lasat: Move from deprecated __initcall to arch_initcall. 2015-09-03 12:07:49 +02:00
lib MIPS: Rearrange ENTRYLO field definitions 2015-09-03 12:07:48 +02:00
loongson32 MIPS: loongsoon32: Migrate to new 'set-state' interface 2015-09-03 12:07:53 +02:00
loongson64 MIPS: loongson64/timer: Migrate to new 'set-state' interface 2015-09-03 12:07:53 +02:00
math-emu MIPS: math-emu: Remove unused handle_dsemul function declaration 2015-09-03 12:08:15 +02:00
mm MIPS: Set trap_no field in thread_struct on exception. 2015-09-03 12:08:04 +02:00
mti-malta MIPS: malta: Use generic platform_maar_init 2015-09-03 12:07:41 +02:00
mti-sead3 MIPS: Export get_c0_perfcount_int() 2015-08-03 09:25:18 +02:00
net MIPS: BPF: Introduce BPF ASM helpers 2015-06-21 21:54:25 +02:00
netlogic MIPS: Netlogic: Fix 0x0x prefixes. 2015-09-03 12:08:05 +02:00
oprofile MIPS: Add cases for CPU_I6400 2015-08-26 15:23:03 +02:00
paravirt MIPS: SMP: Don't increment irq_count multiple times for call function IPIs 2015-08-03 09:25:12 +02:00
pci Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-09-03 16:55:55 -07:00
pistachio MIPS: pistachio: Allow to enable the external timer based clocksource 2015-09-03 12:08:07 +02:00
pmcs-msp71xx MIPS: irq: Use access helper irq_data_get_affinity_mask() 2015-08-26 15:23:28 +02:00
pnx833x MIPS: PNX833x: Remove checks for CONFIG_I2C_PNX0105 2014-05-23 15:12:39 +02:00
power MIPS: Hibernate: flush TLB entries earlier 2015-04-10 15:41:52 +02:00
ralink MIPS: rt3352: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
rb532 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
sgi-ip22 MIPS: ip22-gio: Remove legacy suspend/resume support 2015-02-20 13:30:55 +01:00
sgi-ip27 MIPS: IP27: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
sgi-ip32 MIPS: IP32: Fix build errors in reset code in DS1685 platform hook. 2015-05-13 00:01:41 +02:00
sibyte MIPS: Sibyte: Move bus watcher from deprecated __initcall to device_initcall 2015-09-03 12:07:49 +02:00
sni MIPS: sni: Migrate to new 'set-state' interface 2015-09-03 12:07:54 +02:00
txx9 MIPS: Remove all the uses of custom gpio.h 2015-09-03 12:08:02 +02:00
vr41xx MIPS/IRQCHIP: Move irq_chip from arch/mips to drivers/irqchip. 2015-06-21 21:52:50 +02:00
Kbuild MIPS: net: Add BPF JIT 2014-05-30 16:10:20 +02:00
Kbuild.platforms MIPS: Loongson: Naming style cleanup and rework 2015-06-21 21:53:59 +02:00
Kconfig kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00
Kconfig.debug MIPS: Drop CONFIG_RUNTIME_DEBUG & debug.h 2015-08-26 15:23:36 +02:00
Makefile MIPS: SB1: Remove support for Pass 1 parts. 2015-07-14 21:47:34 +02:00