[PATCH] D83337: [MSAN] Instrument libatomic load/store calls

Gui Andrade via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 12:36:13 PDT 2020


guiand created this revision.
guiand added reviewers: eugenis, vitalybuka.
Herald added subscribers: llvm-commits, Sanitizers, jfb, hiraditya.
Herald added projects: Sanitizers, LLVM.

These calls are neither intercepted by compiler-rt nor is libatomic.a
naturally instrumented.

This patch uses the existing libcall mechanism to detect a call
to __atomic_load or __atomic_store, and instruments them much like
the preexisting instrumentation for atomics.

Calls to _load are modified to have at least Acquire ordering, and
calls to _store at least Release ordering. Because this needs to be
converted at runtime, msan injects a LUT (implemented as a vector
with extractelement).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83337

Files:
  compiler-rt/test/msan/libatomic.c
  llvm/include/llvm/Analysis/TargetLibraryInfo.def
  llvm/lib/Analysis/TargetLibraryInfo.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/test/Instrumentation/MemorySanitizer/libatomic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83337.276184.patch
Type: text/x-patch
Size: 12570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/e79f159b/attachment-0001.bin>


More information about the llvm-commits mailing list