<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 31, 2016, at 1:43 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" class="">kcc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, May 31, 2016 at 1:38 PM, Mehdi Amini<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On May 31, 2016, at 1:22 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank" class="">kcc@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 31, 2016 at 1:16 PM, Mehdi Amini<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class="">Committed in r271323.</div><div class=""><br class=""></div></div></blockquote><div class="">Thanks! </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""></div>I wonder what is the rational for the discrepancy between Darwin and Linux?</div></blockquote><div class=""><br class=""></div><div class="">Don't get me started :) </div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Sorry :)</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><a href="http://reviews.llvm.org/D7203" rel="noreferrer" target="_blank" style="font-size: 12.8px;" class="">http://reviews.llvm.org/D7203</a><br class=""></div><div class=""><a href="https://groups.google.com/forum/#!topic/address-sanitizer/FGYgD_P_884" rel="noreferrer" target="_blank" style="font-size: 12.8px;" class="">https://groups.google.com/forum/#!topic/address-sanitizer/FGYgD_P_884</a><span style="font-size: 12.8px;" class=""> </span><br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">I see some rational to abort, I don't see some strong rational to *not* abort on every platform.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Abort is slow</div></div></div></blockquote><div><br class=""></div><div>An ASAN failure is not supposed to be on your critical path, right?</div><div>(Disabling it for testing using a build setting/env-var seems appropriate if it is the only concern...)</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""> and verbose</div></div></div></blockquote><div><br class=""></div><div>Being verbose on crashes by default seems like a good thing to me?</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">, it often involves lots of extra stuff that you don't need when you see an asan report. </div></div></div></blockquote><div><br class=""></div><div>Is core dump the concern? You mentioned in the thread that is is possible to tweak this when ASAN is enabled though.</div><div><br class=""></div><div>-- </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class=""></div><div class="">--kcc</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">-- </div><div class="">Mehdi</div></font></span><div class=""><div class="h5"><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">--kcc </div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- </div><div class="">Mehdi</div></font></span><div class=""><div class=""><div class=""><br class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On May 31, 2016, at 1:11 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank" class="">kcc@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Ah, I think this is caused by different defaults. <div class="">On linux by default asan dies with _exit and on Mac it dies with abort()</div><div class="">This difference was introduced by Kuba after a long resistance from my side :)</div><div class="">The fix should be pretty simple: add abort_on_error=0 to %tool_options in the test. </div><div class="">Could you please check if this helps on Mac? </div><div class="">If so, feel free to submit. </div><div class=""><br class=""></div><div class="">Thanks! </div><div class="">--kcc</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 31, 2016 at 1:01 PM, Mehdi Amini<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Hi Kostya,<br class=""><br class="">We see a bot failure with the test case you added below:<span class="Apple-converted-space"> </span><a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_check/2068/console" rel="noreferrer" target="_blank" class="">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_check/2068/console</a><br class=""><br class="">After investigating, it seems that they trigger an ASAN failure, which is returning a negative error code. The `not` command tool interprets it as a crash, and you need to pass the --crash option to it.<br class=""><br class="">Don't you observe this on your setup? I wonder why they are passing?<br class=""><span class=""><font color="#888888" class=""><br class="">--<br class="">Mehdi<br class=""></font></span><div class=""><div class=""><br class=""><br class=""><br class=""><br class="">> On May 27, 2016, at 2:23 PM, Kostya Serebryany via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class="">><br class="">> Author: kcc<br class="">> Date: Fri May 27 16:23:05 2016<br class="">> New Revision: 271046<br class="">><br class="">> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=271046&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=271046&view=rev</a><br class="">> Log:<br class="">> [sanitizers] introduce __sanitizer_set_report_fd so that we can re-route the sanitizer logging to another fd from inside the process<br class="">><br class="">> Added:<br class="">> compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc<br class="">> Modified:<br class="">> compiler-rt/trunk/include/sanitizer/common_interface_defs.h<br class="">> compiler-rt/trunk/lib/asan/asan_posix.cc<br class="">> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc<br class="">><br class="">> Modified: compiler-rt/trunk/include/sanitizer/common_interface_defs.h<br class="">> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=271046&r1=271045&r2=271046&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=271046&r1=271045&r2=271046&view=diff</a><br class="">> ==============================================================================<br class="">> --- compiler-rt/trunk/include/sanitizer/common_interface_defs.h (original)<br class="">> +++ compiler-rt/trunk/include/sanitizer/common_interface_defs.h Fri May 27 16:23:05 2016<br class="">> @@ -41,6 +41,9 @@ extern "C" {<br class="">><br class="">> // Tell the tools to write their reports to "path.<pid>" instead of stderr.<br class="">> void __sanitizer_set_report_path(const char *path);<br class="">> + // Tell the tools to write their reports to the provided file descriptor<br class="">> + // (casted to void *).<br class="">> + void __sanitizer_set_report_fd(void *fd);<br class="">><br class="">> // Notify the tools that the sandbox is going to be turned on. The reserved<br class="">> // parameter will be used in the future to hold a structure with functions<br class="">><br class="">> Modified: compiler-rt/trunk/lib/asan/asan_posix.cc<br class="">> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=271046&r1=271045&r2=271046&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_posix.cc?rev=271046&r1=271045&r2=271046&view=diff</a><br class="">> ==============================================================================<br class="">> --- compiler-rt/trunk/lib/asan/asan_posix.cc (original)<br class="">> +++ compiler-rt/trunk/lib/asan/asan_posix.cc Fri May 27 16:23:05 2016<br class="">> @@ -36,8 +36,9 @@ namespace __asan {<br class="">> void AsanOnDeadlySignal(int signo, void *siginfo, void *context) {<br class="">> ScopedDeadlySignal signal_scope(GetCurrentThread());<br class="">> int code = (int)((siginfo_t*)siginfo)->si_code;<br class="">> - // Write the first message using the bullet-proof write.<br class="">> - if (18 != internal_write(2, "ASAN:DEADLYSIGNAL\n", 18)) Die();<br class="">> + // Write the first message using fd=2, just in case.<br class="">> + // It may actually fail to write in case stderr is closed.<br class="">> + internal_write(2, "ASAN:DEADLYSIGNAL\n", 18);<br class="">> SignalContext sig = SignalContext::Create(siginfo, context);<br class="">><br class="">> // Access at a reasonable offset above SP, or slightly below it (to account<br class="">><br class="">> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc<br class="">> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc?rev=271046&r1=271045&r2=271046&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc?rev=271046&r1=271045&r2=271046&view=diff</a><br class="">> ==============================================================================<br class="">> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)<br class="">> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Fri May 27 16:23:05 2016<br class="">> @@ -496,6 +496,11 @@ void __sanitizer_set_report_path(const c<br class="">> report_file.SetReportPath(path);<br class="">> }<br class="">><br class="">> +void __sanitizer_set_report_fd(void *fd) {<br class="">> + report_file.fd = reinterpret_cast<uptr>(fd);<br class="">> + report_file.fd_pid = internal_getpid();<br class="">> +}<br class="">> +<br class="">> void __sanitizer_report_error_summary(const char *error_summary) {<br class="">> Printf("%s\n", error_summary);<br class="">> }<br class="">><br class="">> Added: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc<br class="">> URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc?rev=271046&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc?rev=271046&view=auto</a><br class="">> ==============================================================================<br class="">> --- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc (added)<br class="">> +++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_fd_test.cc Fri May 27 16:23:05 2016<br class="">> @@ -0,0 +1,37 @@<br class="">> +// Test __sanitizer_set_report_fd:<br class="">> +// RUN: %clangxx -O2 %s -o %t<br class="">> +// RUN: not %run %t 2>&1 | FileCheck %s<br class="">> +// RUN: not %run %t stdout | FileCheck %s<br class="">> +// RUN: not %run %t %t-out && FileCheck < %t-out %s<br class="">> +<br class="">> +// REQUIRES: stable-runtime<br class="">> +// FIXME: implement SEGV handler in other sanitizers, not just asan.<br class="">> +// XFAIL: msan<br class="">> +// XFAIL: lsan<br class="">> +// XFAIL: tsan<br class="">> +<br class="">> +#include <sanitizer/common_interface_defs.h><br class="">> +#include <stdio.h><br class="">> +#include <string.h><br class="">> +#include <stdlib.h><br class="">> +#include <sys/types.h><br class="">> +#include <sys/stat.h><br class="">> +#include <fcntl.h><br class="">> +#include <assert.h><br class="">> +<br class="">> +volatile int *null = 0;<br class="">> +<br class="">> +int main(int argc, char **argv) {<br class="">> + if (argc == 2) {<br class="">> + if (!strcmp(argv[1], "stdout")) {<br class="">> + __sanitizer_set_report_fd(reinterpret_cast<void*>(1));<br class="">> + } else {<br class="">> + int fd = open(argv[1], O_CREAT | O_WRONLY | O_TRUNC, S_IRWXU);<br class="">> + assert(fd > 0);<br class="">> + __sanitizer_set_report_fd(reinterpret_cast<void*>(fd));<br class="">> + }<br class="">> + }<br class="">> + *null = 0;<br class="">> +}<br class="">> +<br class="">> +// CHECK: ERROR: {{.*}} SEGV on unknown address<br class="">><br class="">><br class="">> _______________________________________________<br class="">> llvm-commits mailing list<br class="">><span class="Apple-converted-space"> </span><a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a><br class="">><span class="Apple-converted-space"> </span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></div></div></blockquote></div></div></div></blockquote></div></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></body></html>