Merge branch 'bugfix/esp32_core_dump_sanity_checks' into 'master'

esp32: Core dump sanity checks

Adds sanity checks when doing core dump to flash

- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition

Ref TW11879

See merge request !686
This commit is contained in:
Ivan Grokhotkov
2017-04-27 10:43:58 +08:00
3 changed files with 159 additions and 68 deletions

View File

@@ -347,11 +347,6 @@ static void esp_panic_dig_reset()
}
}
static inline bool stackPointerIsSane(uint32_t sp)
{
return !(sp < 0x3ffae010 || sp > 0x3ffffff0 || ((sp & 0xf) != 0));
}
static void putEntry(uint32_t pc, uint32_t sp)
{
if (pc & 0x80000000) {
@@ -372,7 +367,7 @@ static void doBacktrace(XtExcFrame *frame)
pc = frame->a0;
while (i++ < 100) {
uint32_t psp = sp;
if (!stackPointerIsSane(sp) || i++ > 100) {
if (!esp_stack_ptr_is_sane(sp) || i++ > 100) {
break;
}
sp = *((uint32_t *) (sp - 0x10 + 4));