[linux] Change the way we load vdso pseudo-module

Authored by labath on Jun 20 2017, 1:11 AM.


[linux] Change the way we load vdso pseudo-module

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


labathJun 20 2017, 1:11 AM
Differential Revision
D34352: [linux] Change the way we load vdso pseudo-module
rGf891812b7bac: Remove home-grown thread-local storage wrappers