diff options
author | Andreas Kling <kling@serenityos.org> | 2020-11-08 00:59:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-08 01:15:02 +0100 |
commit | 013c7ccd730532d5e6754e93f49fd49caf4d5927 (patch) | |
tree | 4677ab29e26ebb1935df204be2feca9650913abf /DevTools/UserspaceEmulator | |
parent | 6d841f2628a368dd9bb81c5c017d6ea4febe74fe (diff) | |
download | serenity-013c7ccd730532d5e6754e93f49fd49caf4d5927.zip |
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.
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 11 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 87c1c52044..cf705a0ad9 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -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() diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index baaf4edeea..30142edf02 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -164,8 +164,12 @@ private: FlatPtr m_malloc_symbol_start { 0 }; FlatPtr m_malloc_symbol_end { 0 }; + FlatPtr m_realloc_symbol_start { 0 }; + FlatPtr m_realloc_symbol_end { 0 }; FlatPtr m_free_symbol_start { 0 }; FlatPtr m_free_symbol_end { 0 }; + FlatPtr m_malloc_size_symbol_start { 0 }; + FlatPtr m_malloc_size_symbol_end { 0 }; sigset_t m_pending_signals { 0 }; sigset_t m_signal_mask { 0 }; |