linux/drivers/firmware
Maurizio Lombardi 342f43af70 iscsi_ibft: fix crash due to KASLR physical memory remapping
Starting with commit a799c2bd29
("x86/setup: Consolidate early memory reservations")
memory reservations have been moved earlier during the boot process,
before the execution of the Kernel Address Space Layout Randomization code.

setup_arch() calls the iscsi_ibft's find_ibft_region() function
to find and reserve the memory dedicated to the iBFT and this function
also saves a virtual pointer to the iBFT table for later use.

The problem is that if KALSR is active, the physical memory gets
remapped somewhere else in the virtual address space and the pointer is
no longer valid, this will cause a kernel panic when the iscsi driver tries
to dereference it.

 iBFT detected.
 BUG: unable to handle page fault for address: ffff888000099fd8
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: 0000 [#1] SMP PTI

..snip..

 Call Trace:
  ? ibft_create_kobject+0x1d2/0x1d2 [iscsi_ibft]
  do_one_initcall+0x44/0x1d0
  ? kmem_cache_alloc_trace+0x119/0x220
  do_init_module+0x5c/0x270
  __do_sys_init_module+0x12e/0x1b0
  do_syscall_64+0x40/0x80
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Fix this bug by saving the address of the physical location
of the ibft; later the driver will use isa_bus_to_virt() to get
the correct virtual address.

N.B. On each reboot KASLR randomizes the virtual addresses so
assuming phys_to_virt before KASLR does its deed is incorrect.

Simplify the code by renaming find_ibft_region()
to reserve_ibft_region() and remove all the wrappers.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
2021-07-31 22:20:24 -04:00
..
arm_scmi firmware: arm_scmi: Remove duplicate declaration of struct scmi_protocol_handle 2021-04-27 11:57:26 +01:00
broadcom firmware: bcm47xx_nvram: inline code checking NVRAM size 2021-03-12 15:53:07 +01:00
efi efi: cper: fix snprintf() use in cper_dimm_err_location() 2021-05-22 14:05:37 +02:00
google firmware: google: Enable s0ix logging by default 2021-04-02 16:30:21 +02: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 Assorted arm64 fixes and clean-ups, the most important: 2021-05-07 12:11:05 -07:00
smccc arm/arm64: Probe for the presence of KVM hypervisor 2021-03-31 09:16:55 +01:00
tegra firmware: tegra: fix strncpy()/strncat() confusion 2020-11-10 20:15:17 +01:00
xilinx This is the bulk of the pin control changes for the v5.13 kernel cycle 2021-04-30 13:04:30 -07:00
arm_scpi.c firmware: arm_scpi: Prevent the ternary sign expansion bug 2021-04-27 11:55:57 +01:00
arm_sdei.c arm64: sdei: move uaccess logic to arch/arm64/ 2020-12-02 19:46:14 +00:00
dmi_scan.c ASoC: soc-core: fix DMI handling 2021-03-11 13:25:09 +00:00
dmi-id.c firmware/dmi: Include product_sku info to modalias 2020-10-28 09:51:50 +01:00
dmi-sysfs.c firmware: dmi-sysfs: Replace zero-length array with flexible-array member 2020-06-15 23:08:04 -05:00
edd.c edd: Use scnprintf() for avoiding potential buffer overflow 2020-04-02 20:42:29 +02:00
iscsi_ibft_find.c iscsi_ibft: fix crash due to KASLR physical memory remapping 2021-07-31 22:20:24 -04:00
iscsi_ibft.c iscsi_ibft: fix crash due to KASLR physical memory remapping 2021-07-31 22:20:24 -04:00
Kconfig ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
Makefile firmware: arm_scmi: Enable building as a single module 2020-09-14 07:31:03 +01:00
memmap.c
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: Suppress sysfs bind attributes 2021-04-06 21:25:48 -05:00
qcom_scm.h firmware: qcom_scm: Reduce locking section for __get_convention() 2021-04-06 21:25:23 -05:00
qemu_fw_cfg.c fw_cfg: Add support for parisc architecture 2020-10-15 08:10:37 +02:00
raspberrypi.c firmware: raspberrypi: Introduce devm_rpi_firmware_get() 2021-03-22 17:59:51 +01:00
scpi_pm_domain.c
stratix10-rsu.c firmware: stratix10-rsu: fix warnings 2020-07-02 14:48:48 +02:00
stratix10-svc.c firmware: stratix10-svc: extend svc to support new RSU features 2020-07-02 14:48:48 +02:00
ti_sci.c firmware: ti_sci: rm: Remove unused config() from ti_sci_rm_ringacc_ops 2020-11-01 19:38:04 -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 treewide: change my e-mail address, fix my name 2021-04-09 14:54:23 -07:00