common: spl: Warn about overflow of SRAM stack
PATCH 1/1 common: spl: Warn about overflow of SRAM stack
If early stack usage is exactly same as SIZE_LIMIT_PROVIDE_STACK, then its most likely to have overflowed beyond this limit and corrupted any regions beyond stack. Warn about this to the user.
---
I found this useful when debugging slient corruption of code/data leading to random failures post relocation.
common/spl/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
common/spl/spl.c +7 -0
@@ -950,6 +950,13 @@ __weak void spl_relocate_stack_check(void) }printf ("SPL initial stack usage: %lu bytes\n" ,CONFIG_VAL (SIZE_LIMIT_PROVIDE_STACK ) - i); + +/* +* If we used up all of the SIZE_LIMIT_PROVIDE_STACK, then here is high +* possibility of stack overflow, warn the user accordingly +*/ +if (!i) +printf ("SPL possible initial stack overflow detected!!\n" );#endif }
Signature · 1 line
2.40.1
Quoted 4 lines · Vignesh Raghavendra
If early stack usage is exactly same as
SIZE_LIMIT_PROVIDE_STACK, then its most likely to have overflowed beyond this limit and corrupted any regions beyond stack. Warn about this to the user.
Quoted 8 lines
Signed-off-by Vignesh Raghavendra <[email protected]>---
I found this useful when debugging slient corruption of code/data leading to random failures post relocation.
common/spl/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
Quoted 19 lines · Vignesh Raghavendra
If early stack usage is exactly same as
SIZE_LIMIT_PROVIDE_STACK, then its most likely to have overflowed beyond this limit and corrupted any regions beyond stack. Warn about this to the user.Signed-off-by Vignesh Raghavendra <[email protected]>---
I found this useful when debugging slient corruption of code/data leading to random failures post relocation.
common/spl/spl.c | 7 +++++++ 1 file changed, 7 insertions(+)common/spl/spl.c +0
-0@@ -950,6 +950,13 @@ __weak void spl_relocate_stack_check(void) }
common/spl/spl.c __weak void spl_relocate_stack_check(void) · line 960
Quoted 10 lines
common/spl/spl.c +7
-0printf ("SPL initial stack usage: %lu bytes\n" ,CONFIG_VAL (SIZE_LIMIT_PROVIDE_STACK ) - i); + +/* +* If we used up all of the SIZE_LIMIT_PROVIDE_STACK, then here is high +* possibility of stack overflow, warn the user accordingly +*/ +if (!i) +printf ("SPL possible initial stack overflow detected!!\n" );#endif
Since we're already inside of CONFIG_SPL_SYS_REPORT_STACK_F_USAGE being enabled, we should rework the previous print to include something like "%lu bytes free".
Signature · 1 line
Tom