Files
linux/include/linux
Harshit Mogalapalli 10d1c75ed4 ima: verify the previous kernel's IMA buffer lies in addressable RAM
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>
2026-01-26 19:07:10 -08:00
..
2025-10-22 07:54:33 +02:00
2026-01-11 06:09:11 -10:00
2025-11-11 10:01:30 +01:00
2025-11-18 22:26:02 +05:30
2025-10-13 11:27:52 +01:00
2026-01-20 19:44:19 -08:00
2025-12-12 12:36:44 -07:00
2025-12-04 07:19:26 -07:00
2025-12-09 23:29:42 -08:00
2025-09-24 02:48:05 -07:00
2025-11-21 11:21:31 +01:00
2025-10-27 09:56:27 -07:00
2025-11-04 12:36:57 +01:00
2025-09-23 11:13:22 +02:00
2025-10-22 07:55:00 +02:00
2025-11-01 12:44:49 -05:00
2025-12-13 20:04:32 +12:00
2025-12-16 00:57:29 -05:00
2025-12-23 11:23:10 -08:00
2026-01-11 06:09:11 -10:00
2025-10-29 18:28:29 -07:00
2025-09-13 17:32:44 -07:00
2025-11-04 12:36:02 +01:00
2025-10-22 07:53:15 +02:00
2025-09-23 11:13:22 +02:00
2026-01-11 06:09:11 -10:00
2025-10-24 21:39:27 +02:00
2025-11-23 12:30:40 +01:00
2025-11-20 13:43:59 -08:00
2026-01-14 11:00:00 +01:00
2025-09-17 15:58:29 -04:00
2025-11-04 19:10:33 -08:00
2025-09-23 13:28:20 -04:00
2025-11-05 23:58:20 +01:00
2025-11-03 17:41:17 +01:00
2025-11-11 10:01:30 +01:00
2026-01-12 10:45:31 -06:00
2026-01-11 06:09:11 -10:00
2026-01-11 06:09:11 -10:00
2025-10-30 18:35:26 +01:00
2025-10-24 21:39:27 +02:00
2025-10-31 10:16:23 +01:00
2025-11-27 14:24:30 -08:00
2025-11-18 17:52:54 +01:00
2026-01-11 06:09:11 -10:00
2025-11-11 13:18:56 +01:00
2025-11-28 09:21:18 -07:00
2026-01-13 11:37:52 +01:00
2025-11-27 14:22:31 +01:00
2025-11-20 17:57:40 -08:00
2025-11-03 17:41:18 +01:00
2025-11-03 19:27:41 -08:00
2026-01-11 06:09:11 -10:00
2025-11-03 17:41:18 +01:00
2025-10-01 07:24:55 -04:00
2025-12-24 08:02:55 -05:00
2025-11-24 15:08:54 -08:00
2025-11-12 09:38:34 +01:00