[PATCH] D85871: hwasan: Emit the globals note even when globals are uninstrumented.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 20:25:14 PDT 2020


pcc created this revision.
pcc added a reviewer: eugenis.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.
pcc requested review of this revision.

This lets us support the scenario where a binary is linked from a mix
of object files with both instrumented and non-instrumented globals.
This is likely to occur on Android where the decision of whether to use
instrumented globals is based on the API level, which is user-facing.

Previously, in this scenario, it was possible for the comdat from
one of the object files with non-instrumented globals to be selected,
and since this comdat did not contain the note it would mean that the
note would be missing in the linked binary and the globals' shadow
memory would be left uninitialized, leading to a tag mismatch failure
at runtime when accessing one of the instrumented globals.

It is harmless to include the note when targeting a runtime that does
not support instrumenting globals because it will just be ignored.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85871

Files:
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/test/Instrumentation/HWAddressSanitizer/globals.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85871.285249.patch
Type: text/x-patch
Size: 14341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/9f727ab1/attachment.bin>


More information about the llvm-commits mailing list