[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed578d5e-c2ec-46b8-90fa-7e4f9b727685@linux.ibm.com>
Date: Thu, 23 Jan 2025 16:53:01 +0530
From: Sourabh Jain <sourabhjain@...ux.ibm.com>
To: Hari Bathini <hbathini@...ux.ibm.com>, linuxppc-dev@...ts.ozlabs.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Mahesh Salgaonkar <mahesh@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, kexec@...ts.infradead.org,
linux-kernel@...r.kernel.org, Baoquan He <bhe@...hat.com>
Subject: Re: [PATCH v2 1/6] kexec: Initialize ELF lowest address to ULONG_MAX
Hello Hari,
On 23/01/25 15:34, Hari Bathini wrote:
>
>
> 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@...ux.ibm.com>
Thanks for the Ack!
- Sourabh Jain
>
>> Fixes: a0458284f062 ("powerpc: Add support code for kexec_file_load()")
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
>> Cc: Hari Bathini <hbathini@...ux.ibm.com>
>> Cc: Madhavan Srinivasan <maddy@...ux.ibm.com>
>> Cc: Mahesh Salgaonkar <mahesh@...ux.ibm.com>
>> Cc: Michael Ellerman <mpe@...erman.id.au>
>> Cc: kexec@...ts.infradead.org
>> Cc: linuxppc-dev@...ts.ozlabs.org
>> Cc: linux-kernel@...r.kernel.org
>> Acked-by: Baoquan He <bhe@...hat.com>
>> Signed-off-by: Sourabh Jain <sourabhjain@...ux.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;
>
Powered by blists - more mailing lists