am 2f40ddf3: Merge "Do not suppress maps dump when si_addr<PAGE_SIZE"
* commit '2f40ddf3f3e4ce88681311fc0e2321e2c54cd413': Do not suppress maps dump when si_addr<PAGE_SIZE
This commit is contained in:
commit
75ef453e5d
1 changed files with 6 additions and 9 deletions
|
|
@ -64,6 +64,7 @@ static bool signal_has_si_addr(int sig) {
|
||||||
case SIGFPE:
|
case SIGFPE:
|
||||||
case SIGILL:
|
case SIGILL:
|
||||||
case SIGSEGV:
|
case SIGSEGV:
|
||||||
|
case SIGTRAP:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -350,16 +351,12 @@ static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_running = (si.si_code == SI_USER);
|
bool has_fault_address = signal_has_si_addr(si.si_signo);
|
||||||
uintptr_t addr = reinterpret_cast<uintptr_t>(si.si_addr);
|
uintptr_t addr = reinterpret_cast<uintptr_t>(si.si_addr);
|
||||||
addr &= ~0xfff; // round to 4K page boundary
|
|
||||||
if (!is_running && addr == 0) { // null-pointer deref
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LOG(log, logtype::MAPS, "\nmemory map: %s\n", is_running? "" : "(fault address prefixed with --->)");
|
_LOG(log, logtype::MAPS, "\nmemory map: %s\n", has_fault_address ? "(fault address prefixed with --->)" : "");
|
||||||
|
|
||||||
if(!is_running && (addr < map->begin()->start)) {
|
if (has_fault_address && (addr < map->begin()->start)) {
|
||||||
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " before any mapped regions\n", addr);
|
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " before any mapped regions\n", addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,10 +366,10 @@ static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) {
|
||||||
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " between mapped regions\n", addr);
|
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " between mapped regions\n", addr);
|
||||||
}
|
}
|
||||||
prev = it;
|
prev = it;
|
||||||
bool in_map = !is_running && (addr >= (*it).start) && (addr < (*it).end);
|
bool in_map = has_fault_address && (addr >= (*it).start) && (addr < (*it).end);
|
||||||
dump_map(log, &*it, in_map);
|
dump_map(log, &*it, in_map);
|
||||||
}
|
}
|
||||||
if (!is_running && (addr >= (*prev).end)) {
|
if (has_fault_address && (addr >= (*prev).end)) {
|
||||||
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " after any mapped regions\n", addr);
|
_LOG(log, logtype::MAPS, "--->Fault address falls at %" PRIPTR " after any mapped regions\n", addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue