[PATCH] D97409: [dfsan] Record dfsan metadata in globals

stephan.yichao.zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 12:48:24 PST 2021


stephan.yichao.zhao added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1219
+  (void)Mod->getOrInsertGlobal(
+      "__dfsan_shadow_width_bits", PrimitiveShadowTy, [&] {
+        auto *gv = new GlobalVariable(
----------------
Are these two variables shared by dfsan runtime and each compilation unit?
Weak leakage is better, it allows all of them 'share' a global: each compilation unit inserts one if users select fast8, and the dfsan runtime reads it and decides what to do.
See __dfsan_track_origins as an example.

PrimitiveShadowTy is used for shadow data, while __dfsan_shadow_width_bits is only a flag.
Can we use IntegerType::get(*Ctx, 8)?



================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1229
+  (void)Mod->getOrInsertGlobal(
+      "__dfsan_shadow_width_bytes", PrimitiveShadowTy, [&] {
+        auto *gv = new GlobalVariable(
----------------
Do we need both __dfsan_shadow_width_bits and __dfsan_shadow_width_bytes? __dfsan_shadow_width_bits seems sufficient.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97409



More information about the llvm-commits mailing list