<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Alexander, <div class=""><br class=""></div><div class="">It looks like this commit is causing failures on Darwin: <a href="http://lab.llvm.org:8080/green/job/clang-stage1-RA/1421/consoleFull#15588960978254eaf0-7326-4999-85b0-388101f2d404" class="">http://lab.llvm.org:8080/green/job/clang-stage1-RA/1421/consoleFull#15588960978254eaf0-7326-4999-85b0-388101f2d404</a></div><div class=""><br class=""></div><div class="">Can you please fix this?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Erik<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 26, 2019, at 9:22 AM, Alexander Richardson via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: arichardson<br class="">Date: Mon Aug 26 09:22:04 2019<br class="">New Revision: 369924<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=369924&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=369924&view=rev</a><br class="">Log:<br class="">[asan_symbolize] Avoid blocking when llvm-symbolizer is installed as addr2line<br class=""><br class="">Summary:<br class="">Currently, llvm-symbolizer will print -1 when presented with -1 and not<br class="">print a second line. In that case we will block for ever trying to read<br class="">the file name. This also happens for non-existent files, in which case GNU<br class="">addr2line exits immediate, but llvm-symbolizer does not (see<br class=""><a href="https://llvm.org/PR42754" class="">https://llvm.org/PR42754</a>). While touching these lines, I also added some<br class="">more debug logging to help diagnose this and potential future issues.<br class=""><br class="">Reviewers: kcc, eugenis, glider, samsonov<br class=""><br class="">Reviewed By: eugenis<br class=""><br class="">Subscribers: kubamracek, #sanitizers, llvm-commits<br class=""><br class="">Tags: #sanitizers, #llvm<br class=""><br class="">Differential Revision: <a href="https://reviews.llvm.org/D65322" class="">https://reviews.llvm.org/D65322</a><br class=""><br class="">Modified:<br class="">    compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py<br class="">    compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp<br class=""><br class="">Modified: compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py?rev=369924&r1=369923&r2=369924&view=diff" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py?rev=369924&r1=369923&r2=369924&view=diff</a><br class="">==============================================================================<br class="">--- compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py (original)<br class="">+++ compiler-rt/trunk/lib/asan/scripts/asan_symbolize.py Mon Aug 26 09:22:04 2019<br class="">@@ -27,6 +27,7 @@ import os<br class=""> import re<br class=""> import subprocess<br class=""> import sys<br class="">+from distutils.spawn import find_executable<br class=""><br class=""> symbolizers = {}<br class=""> demangle = False<br class="">@@ -153,6 +154,7 @@ class Addr2LineSymbolizer(Symbolizer):<br class="">     addr2line_tool = 'addr2line'<br class="">     if binutils_prefix:<br class="">       addr2line_tool = binutils_prefix + addr2line_tool<br class="">+    logging.debug('addr2line binary is %s' % find_executable(addr2line_tool))<br class="">     cmd = [addr2line_tool, '-fi']<br class="">     if demangle:<br class="">       cmd += ['--demangle']<br class="">@@ -174,14 +176,34 @@ class Addr2LineSymbolizer(Symbolizer):<br class="">       is_first_frame = True<br class="">       while True:<br class="">         function_name = self.pipe.stdout.readline().rstrip()<br class="">+        logging.debug("read function_name='%s' from addr2line" % function_name)<br class="">+        # If llvm-symbolizer is installed as addr2line, older versions of<br class="">+        # llvm-symbolizer will print -1 when presented with -1 and not print<br class="">+        # a second line. In that case we will block for ever trying to read the<br class="">+        # file name. This also happens for non-existent files, in which case GNU<br class="">+        # addr2line exits immediate, but llvm-symbolizer does not (see<br class="">+        # <a href="https://llvm.org/PR42754" class="">https://llvm.org/PR42754</a>).<br class="">+        if function_name == '-1':<br class="">+          logging.debug("got function '-1' -> no more input")<br class="">+          break<br class="">         file_name = self.pipe.stdout.readline().rstrip()<br class="">+        logging.debug("read file_name='%s' from addr2line" % file_name)<br class="">         if is_first_frame:<br class="">           is_first_frame = False<br class="">-        elif function_name in ['', '??']:<br class="">-          assert file_name == function_name<br class="">+        elif function_name == '??':<br class="">+          assert file_name == '??:0', file_name<br class="">+          logging.debug("got function '??' -> no more input")<br class="">+          break<br class="">+        elif not function_name:<br class="">+          assert not file_name, file_name<br class="">+          logging.debug("got empty function name -> no more input")<br class="">           break<br class="">         lines.append((function_name, file_name));<br class="">-    except Exception:<br class="">+    except BrokenPipeError:<br class="">+      logging.debug("got broken pipe, addr2line returncode=%d" % self.pipe.poll())<br class="">+      lines.append(('??', '??:0'))<br class="">+    except Exception as e:<br class="">+      logging.debug("got unknown exception communicating with addr2line", exc_info=e)<br class="">       lines.append(('??', '??:0'))<br class="">     return ['%s in %s %s' % (addr, function, fix_filename(file)) for (function, file) in lines]<br class=""><br class=""><br class="">Modified: compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp?rev=369924&r1=369923&r2=369924&view=diff" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp?rev=369924&r1=369923&r2=369924&view=diff</a><br class="">==============================================================================<br class="">--- compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp (original)<br class="">+++ compiler-rt/trunk/test/asan/TestCases/Posix/asan-symbolize-bad-path.cpp Mon Aug 26 09:22:04 2019<br class="">@@ -1,4 +1,15 @@<br class=""> // Test that asan_symbolize does not hang when provided with an non-existing<br class=""> // path.<br class="">-// RUN: echo '#0 0xabcdabcd (%t/bad/path+0x1234)' | %asan_symbolize | FileCheck %s<br class="">-// CHECK: #0 0xabcdabcd<br class="">+// RUN: echo '#0 0xabcdabcd (%t/bad/path+0x1234)' | %asan_symbolize | FileCheck %s -check-prefix CHECK-BAD-FILE<br class="">+// CHECK-BAD-FILE: #0 0xabcdabcd in ?? ??:0<br class="">+// CHECK-BAD-FILE-EMPTY:<br class="">+<br class="">+// Also test that asan_symbolize doesn't assert on an invalid address with a valid file:<br class="">+// RUN: %clangxx_asan -O0 %s -o %t<br class="">+// RUN: echo '#0 0xabcdabcd (%t+0x0)' | %asan_symbolize | FileCheck %s -check-prefix CHECK-BAD-ADDR<br class="">+// CHECK-BAD-ADDR: #0 0xabcdabcd in ??<br class="">+// CHECK-BAD-ADDR-EMPTY:<br class="">+<br class="">+int main() {<br class="">+  return 0;<br class="">+}<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>