[compiler-rt] r179754 - [Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link
Alexey Samsonov
samsonov at google.com
Thu Apr 18 05:46:34 PDT 2013
Author: samsonov
Date: Thu Apr 18 07:46:33 2013
New Revision: 179754
URL: http://llvm.org/viewvc/llvm-project?rev=179754&view=rev
Log:
[Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc?rev=179754&r1=179753&r2=179754&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc Thu Apr 18 07:46:33 2013
@@ -148,7 +148,12 @@ static int dl_iterate_phdr_cb(dl_phdr_in
// First module is the binary itself.
uptr module_name_len = internal_readlink(
"/proc/self/exe", module_name.data(), module_name.size());
- CHECK_NE(module_name_len, (uptr)-1);
+ if (module_name_len == (uptr)-1) {
+ // We can't read /proc/self/exe for some reason, assume the name of the
+ // binary is unknown.
+ module_name_len = internal_snprintf(module_name.data(),
+ module_name.size(), "/proc/self/exe");
+ }
CHECK_LT(module_name_len, module_name.size());
module_name[module_name_len] = '\0';
} else if (info->dlpi_name) {
More information about the llvm-commits
mailing list