[llvm-bugs] [Bug 42287] New: Add a function to undo __lsan_ignore_object
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 14 14:00:27 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42287
Bug ID: 42287
Summary: Add a function to undo __lsan_ignore_object
Product: compiler-rt
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: lsan
Assignee: unassignedbugs at nondot.org
Reporter: terrelln at fb.com
CC: llvm-bugs at lists.llvm.org
I recently added leak sanitizer suppressions to Facebook's folly library [1].
We don't use __lsan_ignore_object() because you can't undo the operation. Can
we add a function to remember an object we've previously ignored?
An example where this is useful:
```
#include <folly/concurrency/AtomicSharedPtr.h>
#include <folly/memory/SanitizeLeak.h>
class Data;
class LeakedDataPtr {
public:
std::shared_ptr<const Data> get() const {
return ptr_.load();
}
void update(std::shared_ptr<const Data> data) {
auto newPtr = data.get();
auto old = ptr_.exchange(std::move(data));
folly::annotate_object_collected(old.get());
folly::annotate_object_leaked(newPtr);
}
static LeakedDataPtr& instance() {
static auto* instancePtr = new LeakedDataPtr();
return *instancePtr;
}
private:
folly::atomic_shared_ptr<const Data> ptr_;
};
```
[1] https://github.com/facebook/folly/blob/master/folly/memory/SanitizeLeak.h
[2]
https://github.com/facebook/folly/blob/master/folly/concurrency/AtomicSharedPtr.h
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190614/ba9a2872/attachment.html>
More information about the llvm-bugs
mailing list