Kernel: Use kernel_mapping_base as the minimum kernel stack address

Since KASLR was added kernel_load_base only signifies the address at
which the kernel image start, not the start of kernel memory, meaning
that a valid kernel stack can be allocated before it in memory.

We use kernel_mapping_base, the lowest address covered by the kernel
page directory, as the minimal address when performing safety checks
during backtrace generation.
This commit is contained in:
Idan Horowitz 2022-04-10 22:49:06 +03:00 committed by Andreas Kling
parent 07a3002d39
commit 2f4ab64e8c
Notes: sideshowbarker 2024-07-17 22:41:14 +09:00

View file

@ -124,7 +124,7 @@ NEVER_INLINE static void dump_backtrace_impl(FlatPtr base_pointer, bool use_ksym
if (use_ksyms) {
FlatPtr copied_stack_ptr[2];
for (FlatPtr* stack_ptr = (FlatPtr*)base_pointer; stack_ptr && recognized_symbol_count < max_recognized_symbol_count; stack_ptr = (FlatPtr*)copied_stack_ptr[0]) {
if ((FlatPtr)stack_ptr < kernel_load_base)
if ((FlatPtr)stack_ptr < kernel_mapping_base)
break;
void* fault_at;