1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 17:15:08 +00:00

UserspaceEmulator: Don't audit accesses within realloc(), malloc_size()

These functions access malloc-related memory outside of UE's accounting
boundaries, so just ignore them.
This commit is contained in:
Andreas Kling 2020-11-08 00:59:23 +01:00
parent 6d841f2628
commit 013c7ccd73
2 changed files with 14 additions and 1 deletions

View file

@ -153,11 +153,17 @@ bool Emulator::load_elf()
auto malloc_symbol = m_elf->find_demangled_function("malloc");
auto free_symbol = m_elf->find_demangled_function("free");
auto realloc_symbol = m_elf->find_demangled_function("realloc");
auto malloc_size_symbol = m_elf->find_demangled_function("malloc_size");
m_malloc_symbol_start = malloc_symbol.value().value();
m_malloc_symbol_end = m_malloc_symbol_start + malloc_symbol.value().size();
m_free_symbol_start = free_symbol.value().value();
m_free_symbol_end = m_free_symbol_start + free_symbol.value().size();
m_realloc_symbol_start = realloc_symbol.value().value();
m_realloc_symbol_end = m_realloc_symbol_start + realloc_symbol.value().size();
m_malloc_size_symbol_start = malloc_size_symbol.value().value();
m_malloc_size_symbol_end = m_malloc_size_symbol_start + malloc_size_symbol.value().size();
m_debug_info = make<Debug::DebugInfo>(m_elf);
return true;
@ -194,7 +200,10 @@ int Emulator::exec()
bool Emulator::is_in_malloc_or_free() const
{
return (m_cpu.base_eip() >= m_malloc_symbol_start && m_cpu.base_eip() < m_malloc_symbol_end) || (m_cpu.base_eip() >= m_free_symbol_start && m_cpu.base_eip() < m_free_symbol_end);
return (m_cpu.base_eip() >= m_malloc_symbol_start && m_cpu.base_eip() < m_malloc_symbol_end)
|| (m_cpu.base_eip() >= m_free_symbol_start && m_cpu.base_eip() < m_free_symbol_end)
|| (m_cpu.base_eip() >= m_realloc_symbol_start && m_cpu.base_eip() < m_realloc_symbol_end)
|| (m_cpu.base_eip() >= m_malloc_size_symbol_start && m_cpu.base_eip() < m_malloc_size_symbol_end);
}
Vector<FlatPtr> Emulator::raw_backtrace()