This is an archive of the discontinued LLVM Phabricator instance.

[asan] Create a .ASAN$G(A-Z) section for global registration
ClosedPublic

Authored by rnk on Nov 16 2016, 3:20 PM.

Details

Summary

The expectation is that new instrumented code will add global variable
metadata to the .ASAN$GL section, and we will use this new code to
iterate over it.

This technique seems to break when using incremental linking, which
seems to align every global to a 256 byte boundary. Presumably this is
so that it can incrementally cope with global changing size. Clang
already passes -incremental:no as a linker flag when you invoke it to do
the link step.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 78274.Nov 16 2016, 3:20 PM
rnk retitled this revision from to [asan] Create a .ASAN$G(A-Z) section for global registration.
rnk updated this object.
rnk added reviewers: pcc, kcc, mehdi_amini, kubamracek.
rnk added a subscriber: llvm-commits.
rnk added a reviewer: rgov.Nov 17 2016, 9:02 AM

Vitaly, FYI.
Reid, could you please also add a test with a DSO?

lib/asan/asan_globals_win.cc
28 ↗(On Diff #78274)

will this work in the presence of multiple DSOs?
I.e. if asan rt is on one DSO and the callback comes from the other.
(Just asking, I don't remember how this is done on Windows)

rnk updated this revision to Diff 78385.Nov 17 2016, 10:32 AM
rnk edited edge metadata.
  • Add DLL test
lib/asan/asan_globals_win.cc
28 ↗(On Diff #78274)

Yes, this file is special because we link it into every DSO. I added a test that shows we report globals from DSOs when stripping is enabled.

kcc accepted this revision.Nov 17 2016, 10:37 AM
kcc edited edge metadata.

LGTM (but not a windows expert)
Thanks!

This revision is now accepted and ready to land.Nov 17 2016, 10:37 AM
This revision was automatically updated to reflect the committed changes.