2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00
linux-next/arch/arm
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
..
boot lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
common Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-09-03 16:27:01 -07:00
configs ARM: config: Switch PXA27x platforms to use PXA RTC driver 2015-09-05 19:37:18 +02:00
crypto
firmware
include libnvdimm for 4.3: 2015-09-08 14:35:59 -07:00
kernel Merge branch 'nmi' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-09-08 12:28:10 -07:00
kvm
lib Merge branches 'cleanup', 'fixes', 'misc', 'omap-barrier' and 'uaccess' into for-linus 2015-09-03 15:28:37 +01:00
mach-alpine
mach-asm9260
mach-at91 genalloc: add name arg to gen_pool_get() and devm_gen_pool_create() 2015-09-04 16:54:41 -07:00
mach-axxia
mach-bcm ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-berlin
mach-clps711x libnvdimm for 4.3: 2015-09-08 14:35:59 -07:00
mach-cns3xxx ARM: appropriate __init annotation for const data 2015-07-28 13:55:27 +02:00
mach-davinci ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-digicolor ARM: appropriate __init annotation for const data 2015-07-28 13:55:27 +02:00
mach-dove Merge branch 'queue/irq/arm' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next/cleanup 2015-08-05 17:24:11 +02:00
mach-ebsa110 ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-efm32
mach-ep93xx ARM/fb: ep93xx: switch framebuffer to use modedb only 2015-08-13 12:25:44 +02:00
mach-exynos ARM: SoC cleanups for v4.3 2015-09-01 12:10:20 -07:00
mach-footbridge ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-gemini ARM: gemini: Setup timer3 as free running timer 2015-08-13 11:41:52 +02:00
mach-highbank ARM: migrate to common PSCI client code 2015-08-03 15:38:39 +01:00
mach-hisi
mach-imx genalloc: add name arg to gen_pool_get() and devm_gen_pool_create() 2015-09-04 16:54:41 -07:00
mach-integrator
mach-iop13xx ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-iop32x ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-iop33x ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-ixp4xx ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-keystone
mach-ks8695 ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-lpc18xx
mach-lpc32xx Merge branch 'queue/irq/arm' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next/cleanup 2015-08-05 17:24:11 +02:00
mach-mediatek
mach-meson
mach-mmp ARM: mmp: remove unused RTC register definitions 2015-09-05 19:37:17 +02:00
mach-moxart
mach-mv78xx0
mach-mvebu ARM: SoC driver updates for v4.3 2015-09-01 13:00:04 -07:00
mach-mxs ARM: appropriate __init annotation for const data 2015-07-28 13:55:27 +02:00
mach-netx ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-nomadik ARM: nomadik: move l2x0 setup to device tree 2015-08-11 15:29:59 +02:00
mach-nspire
mach-omap1 ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-omap2 Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-09-03 16:27:01 -07:00
mach-orion5x ARM: DT updates for v4.3 2015-09-01 13:09:20 -07:00
mach-picoxcell
mach-prima2 Merge branches 'cleanup', 'fixes', 'misc', 'omap-barrier' and 'uaccess' into for-linus 2015-09-03 15:28:37 +01:00
mach-pxa ARM: pxa: add memory resource to SA1100 RTC device 2015-09-05 19:37:16 +02:00
mach-qcom
mach-realview ARM: appropriate __init annotation for const data 2015-07-28 13:55:27 +02:00
mach-rockchip ARM: rockchip: pm: Fix PTR_ERR() argument 2015-08-24 12:39:14 +02:00
mach-rpc ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-s3c24xx Samsung cleanup for v4.3 2015-08-11 14:59:02 +02:00
mach-s3c64xx ARM: SoC cleanups for v4.3 2015-09-01 12:10:20 -07:00
mach-s5pv210
mach-sa1100 ARM: sa1100: remove unused RTC register definitions 2015-09-05 19:37:17 +02:00
mach-shmobile libnvdimm for 4.3: 2015-09-08 14:35:59 -07:00
mach-socfpga genalloc: add name arg to gen_pool_get() and devm_gen_pool_create() 2015-09-04 16:54:41 -07:00
mach-spear ARM: SoC cleanups for v4.3 2015-09-01 12:10:20 -07:00
mach-sti ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-stm32
mach-sunxi
mach-tegra ARM: SoC driver updates for v4.3 2015-09-01 13:00:04 -07:00
mach-u300
mach-uniphier ARM: uniphier: drop v7_invalidate_l1 call at secondary entry 2015-08-13 12:12:10 +02:00
mach-ux500 Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-09-03 16:27:01 -07:00
mach-versatile
mach-vexpress irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance 2015-08-04 14:14:06 +02:00
mach-vt8500
mach-w90x900 ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
mach-zx ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-zynq Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:33:35 -07:00
mm Merge branch 'for-linus' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2015-09-03 16:27:01 -07:00
net ARM: net: add support for BPF_ANC | SKF_AD_HATYPE in ARM JIT. 2015-07-27 14:57:41 -07:00
nwfpe
oprofile
plat-iop
plat-omap
plat-orion Merge branch 'queue/irq/arm' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next/cleanup 2015-08-05 17:24:11 +02:00
plat-pxa
plat-samsung ARM: SAMSUNG: remove keypad-core header in plat-samsung 2015-07-30 02:02:06 +09:00
plat-versatile
probes
tools
vdso ARM: 8405/1: VDSO: fix regression with toolchains lacking ld.bfd executable 2015-07-31 18:54:45 +01:00
vfp
xen arm/xen: Drop the definition of xen_pci_platform_unplug 2015-08-20 12:24:16 +01:00
Kconfig kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00
Kconfig-nommu
Kconfig.debug The i.MX SoC changes for 4.3: 2015-08-18 13:10:05 -07:00
Makefile ARM: 8418/1: add boot image dependencies to not generate invalid images 2015-08-18 13:59:59 +01:00