mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
	henry.willard@oracle.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen	 <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	Jiri Bohac	 <jbohac@suse.cz>,
	Sourabh Jain <sourabhjain@linux.ibm.com>,
	Guo Weikang	 <guoweikang.kernel@gmail.com>,
	Joel Granados <joel.granados@kernel.org>,
	Alexander Graf	 <graf@amazon.com>,
	Sohil Mehta <sohil.mehta@intel.com>,
	Jonathan McDowell	 <noodles@fb.com>,
	linux-kernel@vger.kernel.org, yifei.l.liu@oracle.com,
	stable@vger.kernel.org, Paul Webb <paul.x.webb@oracle.com>,
	Roberto Sassu	 <roberto.sassu@huaweicloud.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH] x86/kexec: Add a sanity check on previous kernel's ima kexec buffer
Date: Tue, 02 Dec 2025 14:10:47 -0500	[thread overview]
Message-ID: <93bd3c308c79414b3c620216b20d5962fcaccd15.camel@linux.ibm.com> (raw)
In-Reply-To: <CAMj1kXFDAypcEAAFw=O6pS5zD5aujXUvo3_95p_2fJiESsSmgQ@mail.gmail.com>

[Cc: Roberto Sassu, linux-integrity]

On Tue, 2025-12-02 at 08:16 +0100, Ard Biesheuvel wrote:
> On Mon, 1 Dec 2025 at 22:43, Mimi Zohar <zohar@linux.ibm.com> wrote:
> > 
> > On Mon, 2025-12-01 at 15:03 +0530, Harshit Mogalapalli wrote:
> > > Hi all,
> > > 
> > > On 13/11/25 01:00, Harshit Mogalapalli wrote:
> > > > When the second-stage kernel is booted via kexec with a limiting command
> > > > line such as "mem=<size>", the physical range that contains the carried
> > > > over IMA measurement list may fall outside the truncated RAM leading to
> > > > a kernel panic.
> > > > 
> > > >      BUG: unable to handle page fault for address: ffff97793ff47000
> > > >      RIP: ima_restore_measurement_list+0xdc/0x45a
> > > >      #PF: error_code(0x0000) – not-present page
> > > > 
> > > > Other architectures already validate the range with page_is_ram(), as
> > > > done in commit: cbf9c4b9617b ("of: check previous kernel's
> > > > ima-kexec-buffer against memory bounds") do a similar check on x86.
> > 
> > It should be obvious that without carrying the measurement list across kexec,
> > that attestation will fail.  Please mention it here in the patch description.
> > 
> 
> Couldn't we just use memremap() and be done with it? That will use the
> direct map if the memory is mapped, or vmap() it otherwise.

No, the IMA measurement list is not a continuous buffer, but a linked list of
records with varying types of fields and field sizes.  The call to
ima_dump_measurement_list() marshals the measurement list into a buffer, while
ima_restore_measurement_list() unmarshals it.

-- 
thanks,

Mimi


  reply	other threads:[~2025-12-02 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 19:30 Harshit Mogalapalli
2025-12-01  9:33 ` Harshit Mogalapalli
2025-12-01 21:43   ` Mimi Zohar
2025-12-02  7:16     ` Ard Biesheuvel
2025-12-02 19:10       ` Mimi Zohar [this message]
2025-12-01 11:22 ` Jonathan McDowell
2025-12-01 17:20 ` Andrew Morton
2025-12-01 18:19   ` Borislav Petkov
2025-12-29  8:06     ` Harshit Mogalapalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93bd3c308c79414b3c620216b20d5962fcaccd15.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=graf@amazon.com \
    --cc=guoweikang.kernel@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=henry.willard@oracle.com \
    --cc=hpa@zytor.com \
    --cc=jbohac@suse.cz \
    --cc=joel.granados@kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=noodles@fb.com \
    --cc=paul.x.webb@oracle.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=rppt@kernel.org \
    --cc=sohil.mehta@intel.com \
    --cc=sourabhjain@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yifei.l.liu@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®