[PATCH] [Sanitizer RT] Put the module name string ownership in Symbolizer in order
Kostya Serebryany
kcc at google.com
Mon Mar 30 13:08:45 PDT 2015
Ok, let's go this way...
================
Comment at: sanitizer_symbolizer.h:90
@@ -87,1 +89,3 @@
+ // module. It is safe to store and compare them as pointers as long as the
+ // Symbolizer owning these strings is alive.
bool GetModuleNameAndOffsetForPC(uptr pc, const char **module_name,
----------------
Can you modify the comments (and logic) by removing "as long as .. "
These names should be just live forever, independent of anything.
================
Comment at: sanitizer_symbolizer.h:120
@@ +119,3 @@
+ // corresponding module might get unloaded later. To prevent use-after-free
+ // race conditions, create Symbolizer-owned copies of the strings that we can
+ // safely return.
----------------
Why race conditions?
This may happen w/o any threads, right?
================
Comment at: sanitizer_symbolizer.h:125
@@ +124,3 @@
+ ModuleNameOwner() : storage_(1000), last_match_(nullptr) {}
+ const char *GetOwnedCopy(const char *str);
+
----------------
add a comment explaining thread-(un) safety and which lock should be held.
http://reviews.llvm.org/D8666
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list