]> granicus.if.org Git - llvm/commit
hwasan: Instrument globals.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 6 Aug 2019 22:07:29 +0000 (22:07 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 6 Aug 2019 22:07:29 +0000 (22:07 +0000)
commitea686596ffbc893c9954fb3778543618c33e1de5
tree3a4635d7e06d987fa260ebac434dd0078469315b
parentcc63d3ba2fd17bddf349394096c058fde47d1b97
hwasan: Instrument globals.

Globals are instrumented by adding a pointer tag to their symbol values
and emitting metadata into a special section that allows the runtime to tag
their memory when the library is loaded.

Due to order of initialization issues explained in more detail in the comments,
shadow initialization cannot happen during regular global initialization.
Instead, the location of the global section is marked using an ELF note,
and we require libc support for calling a function provided by the HWASAN
runtime when libraries are loaded and unloaded.

Based on ideas discussed with @evgeny777 in D56672.

Differential Revision: https://reviews.llvm.org/D65770

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368102 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/BinaryFormat/ELF.h
lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
test/Instrumentation/HWAddressSanitizer/globals.ll [new file with mode: 0644]