[PATCH 1/4] core2md: Map entire ELF file

6 views
Skip to first unread message

Marc Gonzalez

unread,
Jul 4, 2023, 8:57:47 AM7/4/23
to google-br...@googlegroups.com, Joshua Peraza, Mark Mentovai, Ivan Penkov, Lei Zhang, Yuki Wang, Arnaud Vrac
Functions that inspect the ELF header such as FindElfSection()
actually expect a pointer to the start of the file.
Thus, we must map the entire object file.

In fact, mapping.offset doesn't even make sense to me.
---
src/client/linux/minidump_writer/linux_dumper.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 85922a9c..5c4c389c 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -346,7 +346,7 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
return false;
bool filename_modified = HandleDeletedFileInMapping(filename);

- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG)
return false;

@@ -459,7 +459,7 @@ bool ElfFileSoName(const LinuxDumper& dumper,
if (!dumper.GetMappingAbsolutePath(mapping, filename))
return false;

- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG) {
// mmap failed
return false;
--
2.34.1

Reply all
Reply to author
Forward
0 new messages