[PATCH] [lsan] Support ASan's stack-use-after-return mode in LSan.

Sergey Matveev earthdok at google.com
Fri Oct 11 12:05:46 PDT 2013


  Somewhat ugly but does the job.

  We still need to somehow solve (in a separate CL) the issue of stale pointers in reused frames, by doing one of the following:
  - clearing memory in FakeStack::Allocate(). Likely prohibitively expensive, but could improve leak detection beyond what we have currently (with UAR disabled).
  - storing the true size for each fake frame, and ignoring the unused space. This would be equivalent to what we have without UAR. Can we afford one extra uptr field in FakeFrame? Looks like the size of that structure is hardcoded into the instrumentation code somehow?


================
Comment at: lib/asan/asan_fake_stack.cc:146
@@ +145,3 @@
+      uptr begin = reinterpret_cast<uptr>(ff);
+      callback(begin, begin + FakeStack::BytesInSizeClass(class_id), arg);
+    }
----------------
Some frames might be pending garbage collection. I wonder if it would be safe to filter them out based on the stack pointer value that we have from ptrace? (I.e. the same way as in FakeStack::GC() above.)


http://llvm-reviews.chandlerc.com/D1901



More information about the llvm-commits mailing list