From d1efa5ef9612f0006f991959c1a9ffcdf01cf9b1 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 18 Apr 2013 12:46:33 +0000 Subject: [PATCH] [Sanitizer] Don't die in symbolizer if it can't read /proc/self/exe link llvm-svn: 179754 --- .../lib/sanitizer_common/sanitizer_symbolizer_linux.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc index 00e2bd12cf02..14a682bd99ec 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_linux.cc +++ b/compiler-rt/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) {