Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kho: warn and exit when unpreserved page wasn't preserved

Calling __kho_unpreserve() on a pair of (pfn, end_pfn) that wasn't
preserved is a bug. Currently, if that is done, the physxa or bits can be
NULL. This results in a soft lockup since a NULL physxa or bits results
in redoing the loop without ever making any progress.

Return when physxa or bits are not found, but WARN first to loudly
indicate invalid behaviour.

Link: https://lkml.kernel.org/r/20251103180235.71409-3-pratyush@kernel.org
Fixes: fc33e4b44b27 ("kexec: enable KHO support for memory preservation")
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Pratyush Yadav and committed by
Andrew Morton
b05addf6 7ecd2e43

+4 -4
+4 -4
kernel/kexec_handover.c
··· 171 171 const unsigned long pfn_high = pfn >> order; 172 172 173 173 physxa = xa_load(&track->orders, order); 174 - if (!physxa) 175 - continue; 174 + if (WARN_ON_ONCE(!physxa)) 175 + return; 176 176 177 177 bits = xa_load(&physxa->phys_bits, pfn_high / PRESERVE_BITS); 178 - if (!bits) 179 - continue; 178 + if (WARN_ON_ONCE(!bits)) 179 + return; 180 180 181 181 clear_bit(pfn_high % PRESERVE_BITS, bits->preserve); 182 182