linux-stable/drivers/firmware
Ard Biesheuvel f533f211ba efi/x86: Ignore the memory attributes table on i386
[ Upstream commit dd09fad9d2 ]

Commit:

  3a6b6c6fb2 ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE initialization common across all architectures")

moved the call to efi_memattr_init() from ARM specific to the generic
EFI init code, in order to be able to apply the restricted permissions
described in that table on x86 as well.

We never enabled this feature fully on i386, and so mapping and
reserving this table is pointless. However, due to the early call to
memblock_reserve(), the memory bookkeeping gets confused to the point
where it produces the splat below when we try to map the memory later
on:

  ------------[ cut here ]------------
  ioremap on RAM at 0x3f251000 - 0x3fa1afff
  WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:166 __ioremap_caller ...
  Modules linked in:
  CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.20.0 #48
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
  EIP: __ioremap_caller.constprop.0+0x249/0x260
  Code: 90 0f b7 05 4e 38 40 de 09 45 e0 e9 09 ff ff ff 90 8d 45 ec c6 05 ...
  EAX: 00000029 EBX: 00000000 ECX: de59c228 EDX: 00000001
  ESI: 3f250fff EDI: 00000000 EBP: de3edf20 ESP: de3edee0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00200296
  CR0: 80050033 CR2: ffd17000 CR3: 1e58c000 CR4: 00040690
  Call Trace:
   ioremap_cache+0xd/0x10
   ? old_map_region+0x72/0x9d
   old_map_region+0x72/0x9d
   efi_map_region+0x8/0xa
   efi_enter_virtual_mode+0x260/0x43b
   start_kernel+0x329/0x3aa
   i386_start_kernel+0xa7/0xab
   startup_32_smp+0x164/0x168
  ---[ end trace e15ccf6b9f356833 ]---

Let's work around this by disregarding the memory attributes table
altogether on i386, which does not result in a loss of functionality
or protection, given that we never consumed the contents.

Fixes: 3a6b6c6fb2 ("efi: Make EFI_MEMORY_ATTRIBUTES_TABLE ... ")
Tested-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20200304165917.5893-1-ardb@kernel.org
Link: https://lore.kernel.org/r/20200308080859.21568-21-ardb@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-17 10:48:41 +02:00
..
arm_scmi firmware: arm_scmi: update rate_discrete in clock_describe_rates_get 2020-01-27 14:50:54 +01:00
broadcom firmware: bcm47xx_nvram: Support small (0x6000 B) NVRAM partitions 2018-04-23 16:39:35 +01:00
efi efi/x86: Ignore the memory attributes table on i386 2020-04-17 10:48:41 +02:00
google firmware: coreboot: Let OF core populate platform device 2020-01-27 14:49:55 +01:00
meson firmware: meson-sm: rework meson_sm_init to use module_platform_driver_probe 2018-03-07 17:33:52 -08:00
tegra firmware: tegra: adjust tested variable 2018-03-08 14:43:13 +01:00
Kconfig iscsi_ibft: make ISCSI_IBFT dependson ACPI instead of ISCSI_IBFT_FIND 2019-08-16 10:12:45 +02:00
Makefile firmware: arm_scmi: add basic driver infrastructure for SCMI 2018-02-28 16:37:57 +00:00
arm_scpi.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
arm_sdei.c firmware: arm_sdei: fix double-lock on hibernate with shared events 2020-04-17 10:48:39 +02:00
dcdbas.c platform/x86: Fix dell driver init order 2018-03-14 11:05:53 -07:00
dcdbas.h
dell_rbu.c firmware: dell_rbu: Make payload memory uncachable 2019-11-20 18:47:41 +01:00
dmi-id.c firmware: dmi: Add access to the SKU ID string 2018-06-17 14:09:42 +02:00
dmi-sysfs.c firmware: dmi: handle missing DMI data gracefully 2018-02-03 11:25:20 +01:00
dmi_scan.c firmware: dmi: Fix unlikely out-of-bounds read in save_mem_devices 2020-01-27 14:51:19 +01:00
edd.c edd: don't spam log if no EDD information is present 2018-03-27 09:51:23 +02:00
iscsi_ibft.c iscsi_ibft: make ISCSI_IBFT dependson ACPI instead of ISCSI_IBFT_FIND 2019-08-16 10:12:45 +02:00
iscsi_ibft_find.c
memmap.c
pcdp.c
pcdp.h
psci.c firmware/psci: Expose SMCCC version through psci_ops 2018-02-06 22:54:11 +00:00
psci_checker.c firmware/psci: psci_checker: Park kthreads before stopping them 2019-08-06 19:06:48 +02:00
qcom_scm-32.c firmware: qcom: scm: Fix crash in qcom_scm_call_atomic1() 2018-05-24 22:36:45 -05:00
qcom_scm-64.c firmware: qcom: scm: Ensure 'a0' status code is treated as signed 2019-12-17 20:35:42 +01:00
qcom_scm.c firmware: qcom_scm: Use proper types for dma mappings 2019-10-05 13:09:34 +02:00
qcom_scm.h
qemu_fw_cfg.c media: headers: fix linux/mod_devicetable.h inclusions 2018-08-02 18:30:54 -04:00
raspberrypi.c firmware: raspberrypi: Fix firmware calls with large buffers 2019-12-13 08:51:26 +01:00
scpi_pm_domain.c
ti_sci.c firmware: ti_sci: Always request response from firmware 2019-09-19 09:09:39 +02:00
ti_sci.h firmware: ti_sci: Switch to SPDX Licensing 2018-05-04 23:10:23 -07:00