Override allocation functions accessible through .rel{a,}.dyn

Authored by mwolff on Jan 17 2018, 2:34 PM.

Description

Override allocation functions accessible through .rel{a,}.dyn

This allows us to correctly intercept calls to these functions even
when an application was compiled with immediate binding of the
symbols. This can happen for hardened environments or when the
address of a function we want to intercept is taken and ld.bfd is
used.

This patch adds code to also look into .rela.dyn and .rel.dyn for
relocations and catches these situations too then. A semi-automated
test is also added, which can be used to check the behavior of
heaptrack here.

Note that the test shows one way we do not catch right now: When
an allocation function is accessed indirectly through a function
pointer. We would need to find these addresses in the data segments
and override them - I'm not sure how to do that.

This patch is based on the work by Ivan Middleton, thanks a lot!

Details

Committed
mwolffJan 17 2018, 2:57 PM
Parents
R45:481bb53b2a26: Remove unused file
Branches
Unknown
Tags
Unknown
References
refs/backups/branch-wip/override-all-relocs-1516201137