mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: "Jérémy Jean" <Jeremy.Jean@oss.cyber.gouv.fr>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Baoquan He" <baoquan.he@linux.dev>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Pasha Tatashin" <pasha.tatashin@soleen.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Roberto Sassu" <roberto.sassu@huawei.com>,
	"Dmitry Kasatkin" <dmitry.kasatkin@gmail.com>
Cc: Eric Snowberg <eric.snowberg@oracle.com>,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 3/3] ima: clear kexec state when replacing file image
Date: Sun, 15 Nov 2026 07:17:44 -0500	[thread overview]
Message-ID: <93cd2ed8c7b004898084742f28622d977f026b70.camel@linux.ibm.com> (raw)
In-Reply-To: <20261112125246.2715174-5-Jeremy.Jean@oss.cyber.gouv.fr>

On Thu, 2026-11-12 at 12:52 +0000, Jérémy Jean wrote:
> ima_kexec_buffer remains mapped to the IMA segment of the installed
> kexec_file_load image. KEXEC_FILE_UNLOAD and a successful normal
> kexec_load can replace and free that image without clearing the mapping.
> Executing a later kexec_load image can then write the measurement list
> into the freed pages. The new image has an IMA segment size of zero, but
> size does not establish ownership of the mapping.
> 
> Record the image whose segment is mapped and verify it before the
> execute-time update. Clear the mapping and scratch state under kexec_lock
> when a normal image is removed without another file image taking its
> place.
> 
> Fixes: 9f0ec4b16f2b ("ima: kexec: move IMA log copy from kexec load to execute")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> ---
>  include/linux/ima.h                |  1 +
>  kernel/kexec.c                     | 11 +++++++++++
>  kernel/kexec_file.c                |  7 ++++++-
>  security/integrity/ima/ima_kexec.c | 24 ++++++++++++++++++++++++
>  4 files changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/ima.h b/include/linux/ima.h
> index 8e08baf16c2f..d61b7b7756b7 100644
> --- a/include/linux/ima.h
> +++ b/include/linux/ima.h
> @@ -34,6 +34,7 @@ static inline void ima_appraise_parse_cmdline(void) {}
>  #ifdef CONFIG_IMA_KEXEC
>  extern void ima_add_kexec_buffer(struct kimage *image);
>  extern void ima_kexec_post_load(struct kimage *image);
> +void ima_kexec_cleanup(void);
>  #else
>  static inline void ima_kexec_post_load(struct kimage *image) {}
>  #endif

Could ima_kexec_cleanup() get a stub, next to the ima_add_kexec_buffer() stub in
the !CONFIG_IMA_KEXEC block at the bottom of ima.h? That would also cover
CONFIG_IMA=n, and the callers in kexec.c and kexec_file.c wouldn't need the
#ifdefs.

thanks,

Mimi

      reply	other threads:[~2026-11-16 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 12:52 [PATCH v2 0/3] ima: keep kexec dump state tied to installed image Jérémy Jean
2026-11-12 12:52 ` [PATCH v2 1/3] kexec_file: update IMA after machine post-load Jérémy Jean
2026-11-12 12:52 ` [PATCH v2 2/3] ima: keep kexec dump state tied to installed image Jérémy Jean
2026-11-13 20:50   ` Mimi Zohar
2026-11-12 12:52 ` [PATCH v2 3/3] ima: clear kexec state when replacing file image Jérémy Jean
2026-11-15 12:17   ` 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=93cd2ed8c7b004898084742f28622d977f026b70.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=Jeremy.Jean@oss.cyber.gouv.fr \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=rppt@kernel.org \
    --cc=stable@vger.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®