summaryrefslogtreecommitdiff
path: root/include/android_bootloader_message.h
diff options
context:
space:
mode:
authorRonald Wahl <[email protected]>2026-02-07 16:33:30 +0100
committerTom Rini <[email protected]>2026-02-20 10:39:19 -0600
commitef65b15383c99f4562539a635fe166fb4d75c0e3 (patch)
tree53f86a36b7f91c21ef99978262f19c6e19c847bb /include/android_bootloader_message.h
parent2a86d872ecd85022dd43880bd7f30d547cfb35a0 (diff)
spl: fix stack placement in spl_relocate_stack_gd()
Currently when CONFIG_SPL_STACK_R and CONFIG_SPL_SYS_MALLOC_SIMPLE is enabled then spl_relocate_stack_gd() will setup a layout where the stack lays inside the heap and grows down to heap start. Also the global data is part of the heap. This can lead to corruption of stack and global data. The current layout is: 0x0 +-------------+ . . . . gd->malloc_base +- - - - - - -+ | |\ | HEAP/STACK | \ | | } SPL_STACK_R_MALLOC_SIMPLE_LEN gd->start_addr_sp +- - - - - - -+ / (gd->malloc_limit) | GLOBAL DATA |/ CONFIG_SPL_STACK_R_ADDR +-------------+ The above broken layout was actually introduced with commit adc421e4cee8 ("arm: move gd handling outside of C code"). This commit changes the layout so that the stack is below the heap and the global data. It is now similar to the one before relocation: 0x0+-------------+ . . . . +- - - - - - -+ | | | STACK | | | gd->start_addr_sp +-------------+ | GLOBAL DATA | gd->malloc_base +-------------+ | |\ | HEAP | } SPL_STACK_R_MALLOC_SIMPLE_LEN | |/ (gd->malloc_limit) CONFIG_SPL_STACK_R_ADDR +-------------+ Fixes: adc421e4cee8 ("arm: move gd handling outside of C code") Cc: Tom Rini <[email protected]> Cc: Anshul Dalal <[email protected]> Cc: Leo Yu-Chi Liang <[email protected]> Cc: Dhruva Gole <[email protected]> Cc: Simon Glass <[email protected]> Cc: Albert ARIBAUD <[email protected]> Signed-off-by: Ronald Wahl <[email protected]>
Diffstat (limited to 'include/android_bootloader_message.h')
0 files changed, 0 insertions, 0 deletions