diff options
author | Pavel Labath <labath@google.com> | 2017-06-20 08:11:47 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-06-20 08:11:47 +0000 |
commit | df1a0d11808b874776a0c2ff824f2209eb942dc1 (patch) | |
tree | a5beff54edb60fb0e464f9fc75267f84936d6271 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | |
parent | f891812b7bac04a52c5b82d1bfe0e81891974728 (diff) | |
download | bcm5719-llvm-df1a0d11808b874776a0c2ff824f2209eb942dc1.tar.gz bcm5719-llvm-df1a0d11808b874776a0c2ff824f2209eb942dc1.zip |
[linux] Change the way we load vdso pseudo-module
Summary:
This is basically a revert of D16107 and parts of D10800, which were
trying to get vdso loading working. They did this by implementing a
generic load-an-elf-file from memory approach, which is not correct,
since we cannot assume that an elf file is loaded in memory in full (it
usually isn't, as there's no need to load section headers for example).
This meant that we would read garbage instead of section sizes, and if
that garbage happened to be a large number, we would crash while trying
to allocate a buffer to accomodate the hypothetical section.
Instead of this, I add a bit of custom code to load the vdso to
DynamicLoaderPOSIXDYLD (which already needed to handle the vdso
specially). I determine the size of the memory to read using
Process::GetMemoryRegionInfo, which is information coming from the OS,
and cannot be forged by a malicious/misbehaving application.
Reviewers: eugene, clayborg
Subscribers: lldb-commits, ravitheja, tberghammer, emaste
Differential Revision: https://reviews.llvm.org/D34352
llvm-svn: 305780
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 06f1a4d22d2..6d8717b0ef2 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -14,7 +14,6 @@ #include <stdint.h> // C++ Includes -#include <functional> #include <vector> // Other libraries and framework includes @@ -182,9 +181,6 @@ private: typedef std::map<lldb::addr_t, lldb::AddressClass> FileAddressToAddressClassMap; - typedef std::function<lldb::offset_t(lldb_private::DataExtractor &, - lldb::offset_t, lldb::offset_t)> - SetDataFunction; /// Version of this reader common to all plugins based on this class. static const uint32_t m_plugin_version = 1; @@ -230,7 +226,7 @@ private: // Parses the ELF program headers. static size_t GetProgramHeaderInfo(ProgramHeaderColl &program_headers, - const SetDataFunction &set_data, + lldb_private::DataExtractor &object_data, const elf::ELFHeader &header); // Finds PT_NOTE segments and calculates their crc sum. @@ -255,7 +251,7 @@ private: /// Parses the elf section headers and returns the uuid, debug link name, crc, /// archspec. static size_t GetSectionHeaderInfo(SectionHeaderColl §ion_headers, - const SetDataFunction &set_data, + lldb_private::DataExtractor &object_data, const elf::ELFHeader &header, lldb_private::UUID &uuid, std::string &gnu_debuglink_file, @@ -379,14 +375,6 @@ private: RefineModuleDetailsFromNote(lldb_private::DataExtractor &data, lldb_private::ArchSpec &arch_spec, lldb_private::UUID &uuid); - - static lldb::offset_t SetData(const lldb_private::DataExtractor &src, - lldb_private::DataExtractor &dst, - lldb::offset_t offset, lldb::offset_t length); - - lldb::offset_t SetDataWithReadMemoryFallback(lldb_private::DataExtractor &dst, - lldb::offset_t offset, - lldb::offset_t length); }; #endif // liblldb_ObjectFileELF_h_ |