[PATCH] D92440: [dfsan] Support passing non-i16 shadow values in TLS mode

stephan.yichao.zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 12:46:29 PST 2020


stephan.yichao.zhao updated this revision to Diff 309339.
stephan.yichao.zhao added a comment.

updated load.ll and phi.ll.

Evaluated code size.

1. for large binaries with original size 2G, the additional overhead is within 0.2%.

2. We also examined a small case.

Loading TLS arguments and storing TLS ret inside a function have the same overhead 
between the two approaches.

At callsite, if all parameters are variables, their overheads are also the same. 
When any parameter is a constant, the i16-shadow shadow can be of less overhead.

At a callsite this diff stores shadows for the 6 parameters like this:

mov    0x0(%rip),%rax
xor    %ecx,%ecx 
mov    %cx,%fs:(%rax)
mov    %cx,%fs:0x8(%rax)  
mov    %cx,%fs:0x10(%rax)  	
mov    %cx,%fs:0x18(%rax) 
mov    %cx,%fs:0x20(%rax)  
mov    %cx,%fs:0x28(%rax)

The i16-shadow stores shadows for the 6 parameters like this:

mov    0x0(%rip),%rax 
movq   $0x0,%fs:(%rax)
movl   $0x0,%fs:0x8(%rax)

Because of the 8-byte alignment codegen cannot zero-out consecutive memory addresses
with fewer instructions. If this turns out to be a common case, we may want to revisit this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92440/new/

https://reviews.llvm.org/D92440

Files:
  compiler-rt/lib/dfsan/dfsan.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/arith.ll
  llvm/test/Instrumentation/DataFlowSanitizer/call.ll
  llvm/test/Instrumentation/DataFlowSanitizer/callback.ll
  llvm/test/Instrumentation/DataFlowSanitizer/fast16labels.ll
  llvm/test/Instrumentation/DataFlowSanitizer/load.ll
  llvm/test/Instrumentation/DataFlowSanitizer/phi.ll
  llvm/test/Instrumentation/DataFlowSanitizer/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92440.309339.patch
Type: text/x-patch
Size: 21869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201203/bd5e0654/attachment.bin>


More information about the llvm-commits mailing list