This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by labath on Jun 19 2017, 8:08 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Jun 19 2017, 8:08 AM
clayborg accepted this revision.Jun 19 2017, 9:16 AM
This revision is now accepted and ready to land.Jun 19 2017, 9:16 AM
tberghammer accepted this revision.Jun 19 2017, 10:16 AM

Looks good

This revision was automatically updated to reflect the committed changes.