linux-stable/drivers/firmware
Ard Biesheuvel decd347c2a x86/efistub: Reinstate soft limit for initrd loading
Commit

  8117961d98 ("x86/efi: Disregard setup header of loaded image")

dropped the memcopy of the image's setup header into the boot_params
struct provided to the core kernel, on the basis that EFI boot does not
need it and should rely only on a single protocol to interface with the
boot chain. It is also a prerequisite for being able to increase the
section alignment to 4k, which is needed to enable memory protections
when running in the boot services.

So only the setup_header fields that matter to the core kernel are
populated explicitly, and everything else is ignored. One thing was
overlooked, though: the initrd_addr_max field in the setup_header is not
used by the core kernel, but it is used by the EFI stub itself when it
loads the initrd, where its default value of INT_MAX is used as the soft
limit for memory allocation.

This means that, in the old situation, the initrd was virtually always
loaded in the lower 2G of memory, but now, due to initrd_addr_max being
0x0, the initrd may end up anywhere in memory. This should not be an
issue principle, as most systems can deal with this fine. However, it
does appear to tickle some problems in older UEFI implementations, where
the memory ends up being corrupted, resulting in errors when unpacking
the initramfs.

So set the initrd_addr_max field to INT_MAX like it was before.

Fixes: 8117961d98 ("x86/efi: Disregard setup header of loaded image")
Reported-by: Radek Podgorny <radek@podgorny.cz>
Closes: https://lore.kernel.org/all/a99a831a-8ad5-4cb0-bff9-be637311f771@podgorny.cz
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-03-28 16:19:46 +01:00
..
arm_ffa ARM: SoC drivers for 6.9 2024-03-12 10:35:24 -07:00
arm_scmi ARM cpufreq updates for 6.9 2024-03-15 13:12:26 +01:00
broadcom MIPS: BCM47XX: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:51 -07:00
cirrus firmware: cirrus: cs_dsp: Initialize debugfs_root to invalid 2024-03-07 13:03:54 +00:00
efi x86/efistub: Reinstate soft limit for initrd loading 2024-03-28 16:19:46 +01:00
google firmware: coreboot: Replace tag with id table in driver struct 2024-02-17 08:53:06 +08:00
imx firmware: imx-dsp: Convert to platform remove callback returning void 2024-01-04 17:01:14 +01:00
meson firmware: meson-sm: unmap out_base shmem in error path 2023-11-27 09:17:51 +01:00
microchip RISC-V firmware drivers for v6.9 2024-03-06 07:42:08 +01:00
psci firmware/psci: demote suspend-mode warning to info level 2023-04-14 13:48:56 +02:00
qcom firmware: qcom: qseecom: fix memory leaks in error paths 2023-12-18 21:14:58 -06:00
smccc firmware: smccc: Fix use of uninitialised results structure 2023-07-18 10:08:05 +01:00
tegra firmware: tegra: bpmp: Return directly after a failed kzalloc() in get_filename() 2024-02-21 17:10:32 +01:00
xilinx firmware: xilinx: Add ZynqMP efuse access API 2024-03-07 20:21:53 +00:00
Kconfig video: Add helpers for decoding screen_info 2024-02-14 10:09:13 +01:00
Makefile Core: 2024-01-12 13:54:25 -08:00
arm_scpi.c firmware: arm_scpi: Convert to platform remove callback returning void 2024-01-04 17:01:14 +01:00
arm_sdei.c arm64: sdei: abort running SDEI handlers during crash 2023-08-04 17:35:33 +01:00
dmi-id.c driver core: make struct class.dev_uevent() take a const * 2022-11-24 17:12:15 +01:00
dmi-sysfs.c firmware: dmi-sysfs: handle HAS_IOPORT=n 2023-05-31 19:17:29 +01:00
dmi_scan.c firmware: dmi: Fortify entry point length checks 2022-09-23 14:53:14 +02:00
edd.c edd: make kobj_type structure constant 2023-03-09 18:07:33 +01:00
iscsi_ibft.c
iscsi_ibft_find.c iscsi_ibft: Fix finding the iBFT under Xen Dom 0 2023-06-26 07:47:11 +02:00
memmap.c
mtk-adsp-ipc.c firmware: mtk-adsp-ipc: Convert to platform remove callback returning void 2024-01-04 17:01:14 +01:00
qemu_fw_cfg.c crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
raspberrypi.c firmware: raspberrypi: Convert to platform remove callback returning void 2024-01-04 17:01:15 +01:00
stratix10-rsu.c firmware: stratix10-rsu: Convert to platform remove callback returning void 2024-01-04 17:01:15 +01:00
stratix10-svc.c firmware: stratix10-svc: Convert to platform remove callback returning void 2024-01-04 17:01:15 +01:00
sysfb.c firmware/sysfb: fix an error code in sysfb_init() 2024-02-27 09:21:06 +01:00
sysfb_simplefb.c firmware/sysfb: Set firmware-framebuffer parent device 2024-02-14 10:09:17 +01:00
ti_sci.c firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() 2023-11-24 12:49:08 -06:00
ti_sci.h
trusted_foundations.c
turris-mox-rwtm.c firmware: turris-mox-rwtm: Convert to platform remove callback returning void 2024-01-04 17:01:15 +01:00