[PATCH] D65770: hwasan: Instrument globals.

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 12:42:06 PDT 2019


pcc created this revision.
pcc added reviewers: hctim, vitalybuka.
Herald added subscribers: Sanitizers, cfe-commits, hiraditya, kubamracek, srhines.
Herald added projects: clang, Sanitizers, LLVM.

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 <https://reviews.llvm.org/D56672>.

Depends on D65686 <https://reviews.llvm.org/D65686>

Depends on D65768 <https://reviews.llvm.org/D65768>

Depends on D65769 <https://reviews.llvm.org/D65769>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65770

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c
  compiler-rt/lib/hwasan/hwasan.cpp
  compiler-rt/lib/hwasan/hwasan.h
  compiler-rt/lib/hwasan/hwasan_interface_internal.h
  compiler-rt/lib/hwasan/hwasan_report.cpp
  compiler-rt/test/hwasan/TestCases/global.c
  compiler-rt/test/hwasan/lit.cfg.py
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/Instrumentation/HWAddressSanitizer/globals.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65770.213434.patch
Type: text/x-patch
Size: 29840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190805/ba5c9d80/attachment-0001.bin>


More information about the cfe-commits mailing list