From: Hari Bathini <hbathini@linux.ibm.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Mahesh Salgaonkar <mahesh@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
Baoquan He <bhe@redhat.com>
Subject: Re: [PATCH v2 1/6] kexec: Initialize ELF lowest address to ULONG_MAX
Date: Thu, 23 Jan 2025 15:34:11 +0530 [thread overview]
Message-ID: <7cfe94c9-4ca5-48b1-ab53-bc08fcf8fbc0@linux.ibm.com> (raw)
In-Reply-To: <20250121115442.1278458-2-sourabhjain@linux.ibm.com>
On 21/01/25 5:24 pm, Sourabh Jain wrote:
> kexec_elf_load() loads an ELF executable and sets the address of the
> lowest PT_LOAD section to the address held by the lowest_load_addr
> function argument.
>
> To determine the lowest PT_LOAD address, a local variable lowest_addr
> (type unsigned long) is initialized to UINT_MAX. After loading each
> PT_LOAD, its address is compared to lowest_addr. If a loaded PT_LOAD
> address is lower, lowest_addr is updated. However, setting lowest_addr
> to UINT_MAX won't work when the kernel image is loaded above 4G, as the
> returned lowest PT_LOAD address would be invalid. This is resolved by
> initializing lowest_addr to ULONG_MAX instead.
>
> This issue was discovered while implementing crashkernel high/low
> reservation on the PowerPC architecture.
>
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
> Fixes: a0458284f062 ("powerpc: Add support code for kexec_file_load()")
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Hari Bathini <hbathini@linux.ibm.com>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: kexec@lists.infradead.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> Acked-by: Baoquan He <bhe@redhat.com>
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> kernel/kexec_elf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kexec_elf.c b/kernel/kexec_elf.c
> index d3689632e8b9..3a5c25b2adc9 100644
> --- a/kernel/kexec_elf.c
> +++ b/kernel/kexec_elf.c
> @@ -390,7 +390,7 @@ int kexec_elf_load(struct kimage *image, struct elfhdr *ehdr,
> struct kexec_buf *kbuf,
> unsigned long *lowest_load_addr)
> {
> - unsigned long lowest_addr = UINT_MAX;
> + unsigned long lowest_addr = ULONG_MAX;
> int ret;
> size_t i;
>
next prev parent reply other threads:[~2025-01-23 10:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 11:54 [PATCH v2 0/6] powerpc/crash: use generic crashkernel reservation Sourabh Jain
2025-01-21 11:54 ` [PATCH v2 1/6] kexec: Initialize ELF lowest address to ULONG_MAX Sourabh Jain
2025-01-23 10:04 ` Hari Bathini [this message]
2025-01-23 11:23 ` Sourabh Jain
2025-01-21 11:54 ` [PATCH v2 2/6] crash: remove an unused argument from reserve_crashkernel_generic() Sourabh Jain
2025-01-23 10:13 ` Hari Bathini
2025-01-21 11:54 ` [PATCH v2 3/6] crash: let arch decide crash memory export to iomem_resource Sourabh Jain
2025-01-23 10:26 ` Hari Bathini
2025-01-23 11:50 ` Sourabh Jain
2025-01-21 11:54 ` [PATCH v2 4/6] powerpc/kdump: preserve user-specified memory limit Sourabh Jain
2025-01-23 10:30 ` Hari Bathini
2025-01-23 11:22 ` Sourabh Jain
2025-01-21 11:54 ` [PATCH v2 5/6] powerpc/crash: use generic crashkernel reservation Sourabh Jain
2025-01-23 10:45 ` Hari Bathini
2025-01-23 11:53 ` Sourabh Jain
2025-01-21 11:54 ` [PATCH v2 6/6] crash: option to let arch decide mem range is usable Sourabh Jain
2025-01-24 9:52 ` Hari Bathini
2025-01-24 10:28 ` Sourabh Jain
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=7cfe94c9-4ca5-48b1-ab53-bc08fcf8fbc0@linux.ibm.com \
--to=hbathini@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=sourabhjain@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;
as well as URLs for NNTP newsgroup(s).