summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-04-18 12:46:33 +0000
committerAlexey Samsonov <samsonov@google.com>2013-04-18 12:46:33 +0000
commite8a005f9aac3870f336b5949f7ff634e2b8a51da (patch)
treefd38c8ce74af0513db0a3e79142fa63a8cceb3e3
parent102c04325b454957c322f61c5a8033b720bc9238 (diff)
downloadcompiler-rt-e8a005f9aac3870f336b5949f7ff634e2b8a51da.tar.gz
[Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@179754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_linux.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_linux.cc b/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
index 00e2bd12c..14a682bd9 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
@@ -148,7 +148,12 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *arg) {
// 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) {