[PATCH] D53811: [MSan] another take at instrumenting inline assembly - now with calls

Alexander Potapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 05:01:28 PDT 2018


glider created this revision.
glider added reviewers: eugenis, kcc, dvyukov.
Herald added a subscriber: llvm-commits.

Turns out it's not always possible to figure out whether an asm() statement argument points to a valid memory region.
One example would be per-CPU objects in the Linux kernel, for which the addresses are calculated using the FS register and a small offset in the .data..percpu section.
To avoid pulling all sorts of checks into the instrumentation, we replace actual checking/unpoisoning code with calls to __msan_instrument_asm_load(ptr, size) and __msan_instrument_asm_store(ptr, size) functions in the runtime.

This patch doesn't implement the runtime hooks in compiler-rt, as there's been no demand in assembly instrumentation for userspace apps so far.


Repository:
  rL LLVM

https://reviews.llvm.org/D53811

Files:
  lib/Transforms/Instrumentation/MemorySanitizer.cpp
  test/Instrumentation/MemorySanitizer/msan_asm_conservative.ll
  test/Instrumentation/MemorySanitizer/msan_x86_bts_asm.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53811.171485.patch
Type: text/x-patch
Size: 20553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181029/522ee83e/attachment.bin>


More information about the llvm-commits mailing list