panic: skip over the first invalid PC in case of InstrFetchProhibited

InstrFetchProhibited usually occurs because of a jump to an invalid
pointer. In this case, PC in the exception frame is the address of
the jump destination. 'esp_ptr_executable' check in print_backtrace
function recognizes the first frame as invalid, and the backtrace is
interrupted. This prevents the user from finding the location where
the invalid pointer is dereferenced.

Bypass the 'esp_ptr_executable' check if the exception cause is
InstrFetchProhibited. Update the test case to no longer ignore this
issue.
This commit is contained in:
Ivan Grokhotkov
2020-07-29 12:20:52 +02:00
parent 48b659b474
commit 5ff9cd495e
3 changed files with 10 additions and 7 deletions

View File

@@ -107,10 +107,7 @@ def instr_fetch_prohibited_inner(env, test_name):
with get_dut(env, test_name, "test_instr_fetch_prohibited") as dut:
dut.expect_gme("InstrFetchProhibited")
dut.expect_reg_dump(0)
dut.expect("Backtrace:")
# At the moment the backtrace is corrupted, need to jump over the first PC in case of InstrFetchProhibited.
# Fix this and change expect to expect_none.
dut.expect("CORRUPTED")
dut.expect_backtrace()
dut.expect_elf_sha256()
dut.expect_none("Guru Meditation")
dut.expect_none("CORRUPTED", "Guru Meditation")
test_common(dut, test_name)