umber-kernel/include
Harshit Mogalapalli 9e1f51c1ad ima: verify the previous kernel's IMA buffer lies in addressable RAM
[ Upstream commit 10d1c75ed4382a8e79874379caa2ead8952734f9 ]

Patch series "Address page fault in ima_restore_measurement_list()", v3.

When the second-stage kernel is booted via kexec with a limiting command
line such as "mem=<size>" we observe a pafe fault that happens.

    BUG: unable to handle page fault for address: ffff97793ff47000
    RIP: ima_restore_measurement_list+0xdc/0x45a
    #PF: error_code(0x0000)  not-present page

This happens on x86_64 only, as this is already fixed in aarch64 in
commit: cbf9c4b961 ("of: check previous kernel's ima-kexec-buffer
against memory bounds")

This patch (of 3):

When the second-stage kernel is booted with a limiting command line (e.g.
"mem=<size>"), the IMA measurement buffer handed over from the previous
kernel may fall outside the addressable RAM of the new kernel.  Accessing
such a buffer can fault during early restore.

Introduce a small generic helper, ima_validate_range(), which verifies
that a physical [start, end] range for the previous-kernel IMA buffer lies
within addressable memory:
	- On x86, use pfn_range_is_mapped().
	- On OF based architectures, use page_is_ram().

Link: https://lkml.kernel.org/r/20251231061609.907170-1-harshit.m.mogalapalli@oracle.com
Link: https://lkml.kernel.org/r/20251231061609.907170-2-harshit.m.mogalapalli@oracle.com
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Cc: Alexander Graf <graf@amazon.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Borislav Betkov <bp@alien8.de>
Cc: guoweikang <guoweikang.kernel@gmail.com>
Cc: Henry Willard <henry.willard@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Bohac <jbohac@suse.cz>
Cc: Joel Granados <joel.granados@kernel.org>
Cc: Jonathan McDowell <noodles@fb.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Paul Webb <paul.x.webb@oracle.com>
Cc: Sohil Mehta <sohil.mehta@intel.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Cc: Yifei Liu <yifei.l.liu@oracle.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-03-04 07:21:17 -05:00
..
acpi APEI/GHES: ensure that won't go past CPER allocated record 2026-03-04 07:19:35 -05:00
asm-generic audit: add missing syscalls to read class 2026-03-04 07:19:29 -05:00
clocksource
crypto crypto: scatterwalk - Fix memcpy_sglist() to always succeed 2026-01-02 12:57:08 +01:00
cxl
drm drm: of: drm_of_panel_bridge_remove(): fix device_node leak 2026-03-04 07:21:10 -05:00
dt-bindings dt-bindings: power: qcom,rpmpd: Add SC8280XP_MXC_AO 2026-01-30 10:32:09 +01:00
hyperv
keys
kunit kunit: Enforce task execution in {soft,hard}irq contexts 2026-01-08 10:16:50 +01:00
kvm
linux ima: verify the previous kernel's IMA buffer lies in addressable RAM 2026-03-04 07:21:17 -05:00
math-emu
media media: dvb-core: dmxdevfilter must always flush bufs 2026-03-04 07:19:49 -05:00
memory
misc
net net: Drop the lock in skb_may_tx_timestamp() 2026-03-04 07:20:49 -05:00
pcmcia
ras RAS: Report all ARM processor CPER information to userspace 2025-12-18 14:03:09 +01:00
rdma RDMA/core: add rdma_rw_max_sge() helper for SQ sizing 2026-02-26 14:59:27 -08:00
rv
scsi scsi: core: Fix error handler encryption support 2026-01-23 11:21:23 +01:00
soc
sound ASoC: SDCA: Force some SDCA Controls to be volatile 2026-02-26 14:59:15 -08:00
target scsi: target: Fix LUN/device R/W and total command stats 2025-12-18 14:02:48 +01:00
trace tracing/dma: Cap dma_map_sg tracepoint arrays to prevent buffer overflow 2026-02-19 16:31:33 +01:00
uapi include: uapi: netfilter_bridge.h: Cover for musl libc 2026-03-04 07:20:39 -05:00
ufs scsi: ufs: host: mediatek: Require CONFIG_PM 2026-02-26 14:59:27 -08:00
vdso
video
xen Partial revert "x86/xen: fix balloon target initialization for PVH dom0" 2026-02-26 14:59:01 -08:00
Kbuild