OpenCloudOS-Kernel/drivers/firmware
Ard Biesheuvel f5390cd0b4 efi: runtime: avoid EFIv2 runtime services on Apple x86 machines
Aditya reports [0] that his recent MacbookPro crashes in the firmware
when using the variable services at runtime. The culprit appears to be a
call to QueryVariableInfo(), which we did not use to call on Apple x86
machines in the past as they only upgraded from EFI v1.10 to EFI v2.40
firmware fairly recently, and QueryVariableInfo() (along with
UpdateCapsule() et al) was added in EFI v2.00.

The only runtime service introduced in EFI v2.00 that we actually use in
Linux is QueryVariableInfo(), as the capsule based ones are optional,
generally not used at runtime (all the LVFS/fwupd firmware update
infrastructure uses helper EFI programs that invoke capsule update at
boot time, not runtime), and not implemented by Apple machines in the
first place. QueryVariableInfo() is used to 'safely' set variables,
i.e., only when there is enough space. This prevents machines with buggy
firmwares from corrupting their NVRAMs when they run out of space.

Given that Apple machines have been using EFI v1.10 services only for
the longest time (the EFI v2.0 spec was released in 2006, and Linux
support for the newly introduced runtime services was added in 2011, but
the MacbookPro12,1 released in 2015 still claims to be EFI v1.10 only),
let's avoid the EFI v2.0 ones on all Apple x86 machines.

[0] https://lore.kernel.org/all/6D757C75-65B1-468B-842D-10410081A8E4@live.com/

Cc: <stable@vger.kernel.org>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Reported-by: Aditya Garg <gargaditya08@live.com>
Tested-by: Orlando Chamberlain <redecorating@protonmail.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Aditya Garg <gargaditya08@live.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215277
2022-01-23 10:31:27 +01:00
..
arm_ffa firmware: arm_ffa: Remove unused 'compat_version' variable 2021-10-26 12:46:15 +01:00
arm_scmi virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
broadcom firmware: tee_bnxt: Release TEE shm, session, and context during kexec 2021-07-21 07:55:50 +02:00
cirrus firmware: cs_dsp: Clear core reset for cache 2022-01-05 13:53:53 +00:00
efi efi: runtime: avoid EFIv2 runtime services on Apple x86 machines 2022-01-23 10:31:27 +01:00
google firmware: Update Kconfig help text for Google firmware 2021-12-21 10:12:31 +01:00
imx firmware: imx: scu-pd: add missed ADC1 pd 2021-03-29 09:34:37 +08:00
meson firmware: meson-sm: enable build as module 2020-10-26 13:36:05 -07:00
psci firmware/psci: fix application of sizeof to pointer 2021-10-26 17:40:54 -05:00
smccc firmware: smccc: Fix check for ARCH_SOC_ID not implemented 2021-11-22 11:42:59 +01:00
tegra firmware: tegra: Fix error application of sizeof() to pointer 2021-10-18 16:04:01 +02:00
xilinx Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
Kconfig Linux 5.15-rc6 2021-10-18 13:50:42 +01:00
Makefile firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs 2021-09-27 13:00:42 +01:00
arm_scpi.c ARM SCMI updates for v5.14 2021-06-12 08:42:29 -07:00
arm_sdei.c arm64: sdei: move uaccess logic to arch/arm64/ 2020-12-02 19:46:14 +00:00
dmi-id.c firmware: dmi: Move product_sku info to the end of the modalias 2021-09-02 17:28:53 +02:00
dmi-sysfs.c firmware: dmi-sysfs: use default_groups in kobj_type 2022-01-06 14:28:22 +01:00
dmi_scan.c ASoC: soc-core: fix DMI handling 2021-03-11 13:25:09 +00:00
edd.c firmware: edd: remove empty default_attrs array 2022-01-06 14:28:42 +01: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
memmap.c firmware: memmap: use default_groups in kobj_type 2022-01-05 19:17:29 +01: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 Revert "firmware: qcom: scm: Add support for MC boot address API" 2021-10-27 16:25:07 +02:00
qcom_scm.h Revert "firmware: qcom: scm: Add support for MC boot address API" 2021-10-27 16:25:07 +02:00
qemu_fw_cfg.c firmware: qemu_fw_cfg: remove sysfs entries explicitly 2022-01-14 18:50:52 -05:00
raspberrypi.c firmware: raspberrypi: Fix a leak in 'rpi_firmware_get()' 2021-08-18 16:02:08 +02:00
scpi_pm_domain.c firmware: arm_scpi: Fix string overflow in SCPI genpd driver 2021-12-13 15:17:37 +01:00
stratix10-rsu.c firmware: stratix10-rsu: fix warnings 2020-07-02 14:48:48 +02:00
stratix10-svc.c exit/kthread: Have kernel threads return instead of calling do_exit 2021-10-29 14:31:33 -05:00
sysfb.c drivers/firmware: consolidate EFI framebuffer setup for all arches 2021-07-21 12:04:56 +02:00
sysfb_simplefb.c drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb 2022-01-06 15:47:45 +01:00
ti_sci.c firmware: ti_sci: rm: remove unneeded semicolon 2021-11-22 19:41:36 -06: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 mvebu drivers for 5.14 (part 1) 2021-06-23 18:57:40 -07:00