Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: steven chen <chenste@linux.microsoft.com>,
	stefanb@linux.ibm.com, roberto.sassu@huaweicloud.com,
	roberto.sassu@huawei.com, eric.snowberg@oracle.com,
	ebiederm@xmission.com, paul@paul-moore.com, code@tyhicks.com,
	bauermann@kolabnow.com, linux-integrity@vger.kernel.org,
	kexec@lists.infradead.org, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: madvenka@linux.microsoft.com, nramas@linux.microsoft.com,
	James.Bottomley@HansenPartnership.com
Subject: Re: [PATCH v7 2/7] kexec: define functions to map and unmap segments
Date: Fri, 07 Feb 2025 14:15:53 -0500	[thread overview]
Message-ID: <6fd5510827a2ebb91aee8c72432e248e967fa5be.camel@linux.ibm.com> (raw)
In-Reply-To: <20250203232033.64123-3-chenste@linux.microsoft.com>

Hi Steven,

On Mon, 2025-02-03 at 15:20 -0800, steven chen wrote:
> Currently, the mechanism to map and unmap segments to the kimage
> structure is not available to the subsystems outside of kexec.  This
> functionality is needed when IMA is allocating the memory segments
> during kexec 'load' operation.  Implement functions to map and unmap
> segments to kimage.
> 
> Implement kimage_map_segment() to enable mapping of IMA buffer source
> pages to the kimage structure post kexec 'load'.  This function,
> accepting a kimage pointer, an address, and a size, will gather the
> source pages within the specified address range, create an array of page
> pointers, and map these to a contiguous virtual address range.  The
> function returns the start of this range if successful, or NULL if
> unsuccessful.
> 
> Implement kimage_unmap_segment() for unmapping segments
> using vunmap().
> 
> From: Tushar Sugandhi <tusharsu@linux.microsoft.com>
> Author: Tushar Sugandhi <tusharsu@linux.microsoft.com>
> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>

I don't recall previously adding my "Reviewed-by" tag.

Eric, I'd appreciate your reviewing this and the subsequent patch "[PATCH v7 3/7]
ima: kexec: skip IMA segment validation after kexec soft reboot" in particular.


> Signed-off-by: Tushar Sugandhi <tusharsu@linux.microsoft.com>
> Signed-off-by: steven chen <chenste@linux.microsoft.com>
> ---
>  include/linux/kexec.h |  7 ++++++
>  kernel/kexec_core.c   | 54 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+)
> 
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index f0e9f8eda7a3..f8413ea5c8c8 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -467,6 +467,9 @@ extern bool kexec_file_dbg_print;
>  #define kexec_dprintk(fmt, arg...) \
>          do { if (kexec_file_dbg_print) pr_info(fmt, ##arg); } while (0)
>  
> +extern void *kimage_map_segment(struct kimage *image,
> +					unsigned long addr, unsigned long size);

scripts/Checkpatch.pl complains about the parenthesis alignment here and elsewhere.

Mimi

> +extern void kimage_unmap_segment(void *buffer);
>  #else /* !CONFIG_KEXEC_CORE */
>  struct pt_regs;
>  struct task_struct;
> @@ -474,6 +477,10 @@ static inline void __crash_kexec(struct pt_regs *regs) { }
>  static inline void crash_kexec(struct pt_regs *regs) { }
>  static inline int kexec_should_crash(struct task_struct *p) { return 0; }
>  static inline int kexec_crash_loaded(void) { return 0; }
> +static inline void *kimage_map_segment(struct kimage *image,
> +					unsigned long addr, unsigned long size)
> +{ return NULL; }
> +static inline void kimage_unmap_segment(void *buffer) { }
>  #define kexec_in_progress false
>  #endif /* CONFIG_KEXEC_CORE */
>  



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

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 23:20 [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute steven chen
2025-02-03 23:20 ` [PATCH v7 1/7] ima: define and call ima_alloc_kexec_file_buf steven chen
2025-02-06 16:49   ` Mimi Zohar
2025-02-07 19:20     ` steven chen
2025-02-07 19:36     ` Mimi Zohar
2025-02-07 19:10   ` Mimi Zohar
2025-02-07 19:23     ` steven chen
2025-02-03 23:20 ` [PATCH v7 2/7] kexec: define functions to map and unmap segments steven chen
2025-02-07 19:15   ` Mimi Zohar [this message]
2025-02-10 17:06     ` steven chen
2025-02-12 13:03       ` Mimi Zohar
2025-02-18  4:24         ` Baoquan He
2025-02-03 23:20 ` [PATCH v7 3/7] ima: kexec: skip IMA segment validation after kexec soft reboot steven chen
2025-02-04 19:39   ` Stefan Berger
2025-02-04 20:28     ` steven chen
2025-02-04 22:51       ` Stefan Berger
2025-02-07 19:24     ` steven chen
2025-02-03 23:20 ` [PATCH v7 4/7] ima: kexec: define functions to copy IMA log at soft boot steven chen
2025-02-03 23:20 ` steven chen
2025-02-03 23:20 ` [PATCH v7 5/7] ima: kexec: move IMA log copy from kexec load to execute steven chen
2025-02-03 23:20 ` [PATCH v7 6/7] ima: make the kexec extra memory configurable steven chen
2025-02-07 16:04   ` Mimi Zohar
2025-02-03 23:20 ` [PATCH v7 7/7] ima: measure kexec load and exec events as critical data steven chen
2025-02-07 15:16   ` Mimi Zohar
2025-02-07 17:06     ` Mimi Zohar
2025-02-07 17:48       ` Stefan Berger
2025-02-07 19:26         ` steven chen
  -- strict thread matches above, loose matches on Subject: below --
2025-02-18 17:20 [PATCH v7 0/7] ima: kexec: measure events between kexec load and execute steven chen
2025-02-18 17:20 ` [PATCH v7 2/7] kexec: define functions to map and unmap segments steven chen
2025-02-03 18:45 [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute steven chen
2025-02-03 18:45 ` [PATCH v7 2/7] kexec: define functions to map and unmap segments steven chen
2025-02-03 18:42 [PATCH v7 0/7] ima: kexec: measure events between kexec load and excute steven chen
2025-02-03 18:42 ` [PATCH v7 2/7] kexec: define functions to map and unmap segments steven chen

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=6fd5510827a2ebb91aee8c72432e248e967fa5be.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bauermann@kolabnow.com \
    --cc=chenste@linux.microsoft.com \
    --cc=code@tyhicks.com \
    --cc=ebiederm@xmission.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=madvenka@linux.microsoft.com \
    --cc=nramas@linux.microsoft.com \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=stefanb@linux.ibm.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