[PATCH v5 15/17] crash: Introduce crash_extra_elfcorehdr_size() helper

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Sep 18 03:31:16 PDT 2026


> Extract the elfcorehdr extra space calculation from powerpc into a
> generic helper crash_extra_elfcorehdr_size() for use by other
> architectures like arm64.
> 
> Strengthen the original powerpc check: instead of only checking
> the loose CONFIG_CRASH_MAX_MEMORY_RANGES, the new helper enforces
> a strict compile-time BUILD_BUG_ON() to guarantee that the absolute
> maximum theoretical number of ELF Program Headers will never exceed
> the ELF physical limit of PN_XNUM. This ensures absolute safety across
> all architectures with zero runtime overhead.
> 
> The helper also provides a zero-size stub when crash memory hotplug
> is disabled.
> 
> Cc: Madhavan Srinivasan <maddy at linux.ibm.com>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Nicholas Piggin <npiggin at gmail.com>
> Cc: "Christophe Leroy (CS GROUP)" <chleroy at kernel.org>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Baoquan He <baoquan.he at linux.dev>
> Cc: Mike Rapoport <rppt at kernel.org>
> Cc: Pasha Tatashin <pasha.tatashin at soleen.com>
> Cc: Pratyush Yadav <pratyush at kernel.org>
> Cc: Dave Young <ruirui.yang at linux.dev>
> Cc: Sourabh Jain <sourabhjain at linux.ibm.com>
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260918100442.3841135-1-ruanjinjie@huawei.com?part=15




More information about the kexec mailing list