Skip to content

Commit

Permalink
Thread.cpp: Report VM addresses on VM segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jan 10, 2025
1 parent 2bba3ca commit b468d67
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Utilities/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,11 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : "reading";

fmt::append(msg, "Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress);

if (vm::try_get_addr(reinterpret_cast<u8*>(pExp->ExceptionRecord->ExceptionInformation[1])).second)
{
fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr);
}
}
else
{
Expand Down Expand Up @@ -1999,6 +2004,11 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept

std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context));

if (vm::try_get_addr(info->si_addr).second)
{
fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr);
}

append_thread_name(msg);

sys_log.fatal("\n%s", msg);
Expand Down

0 comments on commit b468d67

Please sign in to comment.