anolis: efi/libstub: should redefine for_each_set_bitrange_from

ANBZ: #20714

We observed kernel was stuck at "accept memory" when "kaslr" was enabled
at kernel decompression stage.
If kaslr choses a random relocation address which is "unaccepted
memory", efistub will do accept_memory(), a inifite loop happens when
accept_memory() is retrieving bitmap of unaccepted memory by using:
for_each_set_bitrange_from.

for_each_set_bitrange_from won't be override as it has been defined in
other place, which may cause infinite loop.
Replase #ifndef...#endif by #undefine to ensure it is override

Fixes: 7417dc9cb9bb("efi/libstub: Implement support for unaccepted memory")
Signed-off-by: Zelin Deng <zelin.deng@linux.alibaba.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/5176
This commit is contained in:
Zelin Deng 2025-04-27 22:48:55 -04:00 committed by 小龙
parent 95ee9d794d
commit 05c0f79ba4
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,8 @@ unsigned long find_next_bit_stub(const unsigned long *addr, unsigned long size,
extern
unsigned long find_next_zero_bit_stub(const unsigned long *addr, unsigned long size,
unsigned long offset);
#ifndef for_each_set_bitrange_from
#undef for_each_set_bitrange_from
/**
* for_each_set_bitrange_from - iterate over all set bit ranges [b; e)
* @b: bit offset of start of current bitrange (first set bit); must be initialized
@ -26,7 +27,6 @@ unsigned long find_next_zero_bit_stub(const unsigned long *addr, unsigned long s
(e) = find_next_zero_bit_stub((addr), (size), (b) + 1), \
(b) < (size); \
(b) = (e) + 1)
#endif
efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc,
struct efi_boot_memmap *map)