mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Roberto Sassu <roberto.sassu@huaweicloud.com>,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	chenhuacai@kernel.org, kernel@xen0n.name, maddy@linux.ibm.com,
	mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org,
	pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
	alex@ghiti.fr, tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com, robh@kernel.org,
	saravanak@kernel.org
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org,
	linux-riscv@lists.infradead.org, devicetree@vger.kernel.org,
	noodles@fb.com, linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH] kexec: Select ima_get/free_kexec_buffer() with CONFIG_HAVE_IMA_KEXEC(_OF)
Date: Thu, 15 Oct 2026 20:04:39 -0400	[thread overview]
Message-ID: <2dd935d171066eb4f1c251184eee871ad91f46b4.camel@linux.ibm.com> (raw)
In-Reply-To: <20261014150005.138309-1-roberto.sassu@huaweicloud.com>

Hi Roberto,

On Wed, 2026-10-14 at 17:00 +0200, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@huawei.com>

The first paragraph should explain the problem from a high level: the user-
visible impact and cause. For example, something like:

“On x86, if CONFIG_OF_FLATTREE is enabled, the kernel uses the device tree
implementation of ima_get/free_kexec_buffer(). However, x86 doesn’t pass the IMA
buffer through the device tree, so the buffer is never found and the IMA
measurement log is not carried over across kexec.”

Then continue with the fix: defining CONFIG_HAVE_IMA_KEXEC_OF and selecting it
only on the architectures that use the device tree implementation.

thanks,

Mimi

> 
> The ima_get/free_kexec_buffer() device tree implementation relies on the
> arch code calling of_kexec_alloc_and_setup_fdt() to pass the information
> about where the IMA kexec buffer is located. Only the arm64, powerpc and
> riscv architectures support that. LoongArch implicitly assumes that the
> device tree implementation is used, but it does not call that function.

> 
> The ima_get/free_kexec_buffer() x86 implementation instead still relies on
> the setup data to pass the kexec buffer information, and is built only if
> CONFIG_OF_FLATTREE is not defined.
> 
> However, if CONFIG_OF_FLATTREE is selected in x86, x86 attempts to use the
> device tree implementations of ima_get/free_kexec_buffer(), which are never
> going to succeed because of_kexec_alloc_and_setup_fdt() is not called for
> that architecture.
> 
> Instead, define CONFIG_HAVE_IMA_KEXEC_OF (automatically selects
> HAVE_IMA_KEXEC), select it for the architectures that should use the
> ima_get/free_kexec_buffer() device tree implementation, and enable these
> functions if the new config option is enabled. Set it also on LoongArch, to
> preserve the current behavior and avoid a link failure. LoongArch does not
> pass the buffer location to the next kernel yet; this will be addressed
> separately.
> 
> Finally, don't select it for x86, and use x86's own setup_data-based
> implementation regardless of CONFIG_OF_FLATTREE.
> 
> Fixes: b69a2afd5afc ("x86/kexec: Carry forward IMA measurement log on kexec")
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>

      reply	other threads:[~2026-10-16  0:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 15:00 Roberto Sassu
2026-10-16  0:04 ` Mimi Zohar [this message]

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=2dd935d171066eb4f1c251184eee871ad91f46b4.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hpa@zytor.com \
    --cc=kernel@xen0n.name \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maddy@linux.ibm.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=noodles@fb.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=robh@kernel.org \
    --cc=saravanak@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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®