[PATCH] D103176: [dfsan] Add a flag about whether to propagate offset labels at gep

stephan.yichao.zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 08:57:34 PDT 2021


stephan.yichao.zhao created this revision.
stephan.yichao.zhao added a reviewer: gbalats.
Herald added a subscriber: hiraditya.
stephan.yichao.zhao requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

DFSan has flags to control flows between pointers and objects referred
by pointers. For example,

  a = *p;
  L(a) = L(*p)        when -dfsan-combine-pointer-labels-on-load = false
  L(a) = L(*p) + L(p) when -dfsan-combine-pointer-labels-on-load = true
  
  *p = b;
  L(*p) = L(b)        when -dfsan-combine-pointer-labels-on-store = false
  L(*p) = L(b) + L(p) when -dfsan-combine-pointer-labels-on-store = true

The question is what to do with p += c.

In practice we found many confusing flows if we propagate labels from c
to p. So a new flag works like this

  p += c;
  L(p) = L(p)        when -dfsan-propagate-via-pointer-arithmetic = false
  L(p) = L(p) + L(c) when -dfsan-propagate-via-pointer-arithmetic = true


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103176

Files:
  compiler-rt/test/dfsan/custom.cpp
  compiler-rt/test/dfsan/gep.c
  compiler-rt/test/dfsan/pair.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/array.ll
  llvm/test/Instrumentation/DataFlowSanitizer/dont_combine_offset_labels_on_gep.ll
  llvm/test/Instrumentation/DataFlowSanitizer/load.ll
  llvm/test/Instrumentation/DataFlowSanitizer/origin_load.ll
  llvm/test/Instrumentation/DataFlowSanitizer/origin_select.ll
  llvm/test/Instrumentation/DataFlowSanitizer/select.ll
  llvm/test/Instrumentation/DataFlowSanitizer/store.ll
  llvm/test/Instrumentation/DataFlowSanitizer/struct.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103176.347987.patch
Type: text/x-patch
Size: 23614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210526/87055d82/attachment-0001.bin>


More information about the llvm-commits mailing list