linux/drivers/firmware
Ard Biesheuvel 4d83245917 efi: Avoid cold plugged memory for placing the kernel
commit ba69e0750b upstream.

UEFI 2.11 introduced EFI_MEMORY_HOT_PLUGGABLE to annotate system memory
regions that are 'cold plugged' at boot, i.e., hot pluggable memory that
is available from early boot, and described as system RAM by the
firmware.

Existing loaders and EFI applications running in the boot context will
happily use this memory for allocating data structures that cannot be
freed or moved at runtime, and this prevents the memory from being
unplugged. Going forward, the new EFI_MEMORY_HOT_PLUGGABLE attribute
should be tested, and memory annotated as such should be avoided for
such allocations.

In the EFI stub, there are a couple of occurrences where, instead of the
high-level AllocatePages() UEFI boot service, a low-level code sequence
is used that traverses the EFI memory map and carves out the requested
number of pages from a free region. This is needed, e.g., for allocating
as low as possible, or for allocating pages at random.

While AllocatePages() should presumably avoid special purpose memory and
cold plugged regions, this manual approach needs to incorporate this
logic itself, in order to prevent the kernel itself from ending up in a
hot unpluggable region, preventing it from being unplugged.

So add the EFI_MEMORY_HOTPLUGGABLE macro definition, and check for it
where appropriate.

Cc: stable@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-03-13 12:50:40 +01:00
..
arm_ffa firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device 2023-11-20 11:08:21 +01:00
arm_scmi firmware: arm_scmi: Check mailbox/SMT channel for consistency 2024-02-23 08:54:32 +01:00
broadcom firmware: tee_bnxt: Release TEE shm, session, and context during kexec 2021-07-21 07:55:50 +02:00
efi efi: Avoid cold plugged memory for placing the kernel 2025-03-13 12:50:40 +01:00
google firmware: google: Unregister driver_info on failure 2024-12-14 19:50:44 +01:00
imx firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels() 2023-11-08 17:26:37 +01:00
meson firmware: meson_sm: populate platform devices from sm device tree data 2024-01-25 14:52:36 -08:00
psci firmware/psci: fix application of sizeof to pointer 2021-11-18 19:15:53 +01:00
smccc arm64: smccc: Remove broken support for SMCCCv1.3 SVE discard hint 2024-12-14 19:51:46 +01:00
tegra firmware: tegra: bpmp: Drop unused mbox_client_to_bpmp() 2024-10-17 15:11:35 +02:00
xilinx firmware: xilinx: don't make a sleepable memory allocation from an atomic context 2023-03-22 13:31:32 +01:00
arm_scpi.c firmware: arm_scpi: Check the DVFS OPP count returned by the firmware 2024-12-14 19:50:50 +01:00
arm_sdei.c firmware: arm_sdei: Fix the input parameter of cpuhp_remove_state() 2024-11-08 16:25:53 +01:00
dmi-id.c firmware: dmi-id: add a release callback function 2024-06-16 13:39:34 +02:00
dmi-sysfs.c firmware: dmi-sysfs: Fix null-ptr-deref in dmi_sysfs_register_handle 2023-03-10 09:39:39 +01:00
dmi_scan.c firmware: dmi: Stop decoding on broken entry 2024-07-18 13:07:28 +02:00
edd.c edd: Use scnprintf() for avoiding potential buffer overflow 2020-04-02 20:42:29 +02:00
iscsi_ibft.c iscsi_ibft: Fix isa_bus_to_virt not working under ARM 2021-09-02 16:22:00 -04:00
iscsi_ibft_find.c iscsi_ibft: fix warning in reserve_ibft_region() 2021-08-05 19:47:57 -04:00
Kconfig firmware: iscsi_ibft: fix ISCSI_IBFT Kconfig entry 2025-03-13 12:50:21 +01:00
Makefile ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
memmap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 287 2019-06-05 17:36:37 +02:00
pcdp.c efi/ia64: Move HCDP and MPS table handling into IA64 arch code 2020-02-23 21:59:42 +01:00
pcdp.h firmware: pcdp: Replace zero-length array with flexible-array 2020-06-15 23:08:32 -05:00
qcom_scm-legacy.c firmware: qcom_scm: Fix kernel-doc function names to match 2021-04-06 21:25:49 -05:00
qcom_scm-smc.c firmware: qcom_scm: Reduce locking section for __get_convention() 2021-04-06 21:25:23 -05:00
qcom_scm.c firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit 2023-11-28 16:56:29 +00:00
qcom_scm.h firmware: qcom_scm: Introduce SCM calls to access LMh 2021-08-18 09:31:53 +02:00
qemu_fw_cfg.c firmware: qemu_fw_cfg: fix kobject leak in probe error path 2022-01-20 09:13:15 +01:00
raspberrypi.c firmware: raspberrypi: Use correct device for DMA mappings 2024-06-16 13:39:16 +02:00
scpi_pm_domain.c firmware: arm_scpi: Fix string overflow in SCPI genpd driver 2021-12-22 09:32:35 +01:00
stratix10-rsu.c firmware: stratix10-rsu: fix warnings 2020-07-02 14:48:48 +02:00
stratix10-svc.c firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe 2023-09-06 21:28:39 +01:00
sysfb.c efi: sysfb_efi: Fix DMI quirks not working for simpledrm 2023-03-30 12:47:55 +02:00
sysfb_simplefb.c efi: sysfb_efi: Fix DMI quirks not working for simpledrm 2023-03-30 12:47:55 +02:00
ti_sci.c firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() 2024-01-25 14:52:36 -08:00
ti_sci.h firmware: ti_sci: rm: Add new ops for ring configuration 2020-11-01 19:38:02 -08:00
trusted_foundations.c firmware: tf: Different way of L2 cache enabling after LP2 suspend 2020-05-06 18:27:26 +02:00
turris-mox-rwtm.c firmware: turris-mox-rwtm: Initialize completion before mailbox 2024-08-19 05:44:55 +02:00