* [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory
@ 2026-08-10 14:58 Thorsten Blum
2026-08-11 7:05 ` Sourabh Jain
2026-09-09 6:18 ` Madhavan Srinivasan
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-10 14:58 UTC (permalink / raw)
To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP),
Sourabh Jain, Hari Bathini, Aditya Gupta, Jinjie Ruan,
Andrew Morton
Cc: Thorsten Blum, linuxppc-dev, linux-kernel
arch_check_excluded_range() checks if a kexec segment overlaps an
excluded memory range.
Both ranges use inclusive end addresses, but the overlap check uses
exclusive comparisons. This skips ranges with start == ->ranges[i].end
or end == ->ranges[i].start. Use inclusive comparisons instead.
Fixes: 6e5250eaa665 ("powerpc/crash: use generic APIs to locate memory hole for kdump")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Sashiko found this issue when reviewing another patch:
https://sashiko.dev/#/patchset/20260809162403.18142-2-thorsten.blum%40linux.dev
---
arch/powerpc/kexec/file_load_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 40b74cc4ed3e..32e2b7412a9f 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -58,7 +58,7 @@ int arch_check_excluded_range(struct kimage *image, unsigned long start,
emem = image->arch.exclude_ranges;
for (i = 0; i < emem->nr_ranges; i++)
- if (start < emem->ranges[i].end && end > emem->ranges[i].start)
+ if (start <= emem->ranges[i].end && end >= emem->ranges[i].start)
return 1;
return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory
2026-08-10 14:58 [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory Thorsten Blum
@ 2026-08-11 7:05 ` Sourabh Jain
2026-09-09 6:18 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Sourabh Jain @ 2026-08-11 7:05 UTC (permalink / raw)
To: Thorsten Blum, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
Hari Bathini, Aditya Gupta, Jinjie Ruan, Andrew Morton
Cc: linuxppc-dev, linux-kernel
On 10/08/26 20:28, Thorsten Blum wrote:
> arch_check_excluded_range() checks if a kexec segment overlaps an
> excluded memory range.
>
> Both ranges use inclusive end addresses, but the overlap check uses
> exclusive comparisons. This skips ranges with start == ->ranges[i].end
> or end == ->ranges[i].start. Use inclusive comparisons instead.
>
> Fixes: 6e5250eaa665 ("powerpc/crash: use generic APIs to locate memory hole for kdump")
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> Sashiko found this issue when reviewing another patch:
> https://sashiko.dev/#/patchset/20260809162403.18142-2-thorsten.blum%40linux.dev
> ---
> arch/powerpc/kexec/file_load_64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index 40b74cc4ed3e..32e2b7412a9f 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -58,7 +58,7 @@ int arch_check_excluded_range(struct kimage *image, unsigned long start,
>
> emem = image->arch.exclude_ranges;
> for (i = 0; i < emem->nr_ranges; i++)
> - if (start < emem->ranges[i].end && end > emem->ranges[i].start)
> + if (start <= emem->ranges[i].end && end >= emem->ranges[i].start)
Like [1] this also extends the condition to check for a 1-byte overlap.
It is unlikely to occur in practice, but I don't see any harm in doing so.
Hence the changes looks good to me. Feel free to add.
Reviewed-by: Sourabh Jain <sourabhjain@linux.ibm.com>
[1]
https://lore.kernel.org/all/ee531113-5a56-4e6e-bc16-95941aa5bbfd@linux.ibm.com/
> return 1;
>
> return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory
2026-08-10 14:58 [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory Thorsten Blum
2026-08-11 7:05 ` Sourabh Jain
@ 2026-09-09 6:18 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Madhavan Srinivasan @ 2026-09-09 6:18 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Sourabh Jain, Hari Bathini, Aditya Gupta, Jinjie Ruan,
Andrew Morton, Thorsten Blum
Cc: linuxppc-dev, linux-kernel
On Mon, 10 Aug 2026 16:58:27 +0200, Thorsten Blum wrote:
> arch_check_excluded_range() checks if a kexec segment overlaps an
> excluded memory range.
>
> Both ranges use inclusive end addresses, but the overlap check uses
> exclusive comparisons. This skips ranges with start == ->ranges[i].end
> or end == ->ranges[i].start. Use inclusive comparisons instead.
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/kexec_file: Use inclusive range checks for excluded memory
https://git.kernel.org/powerpc/c/449f60f99f8f3cbe80a9bd2242945e827c5ed003
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-09 6:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 14:58 [PATCH] powerpc/kexec_file: Use inclusive range checks for excluded memory Thorsten Blum
2026-08-11 7:05 ` Sourabh Jain
2026-09-09 6:18 ` Madhavan Srinivasan
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®