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) {