<div dir="ltr"><div>This patch conflicts with asan</div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15763/steps/check-clang%20asan/logs/stdio">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15763/steps/check-clang%20asan/logs/stdio</a><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 23, 2016 at 8:50 PM Chandler Carruth via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: chandlerc<br>
Date: Tue Aug 23 22:42:51 2016<br>
New Revision: 279605<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=279605&view=rev" rel="noreferrer" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=279605&view=rev</a><br>
Log:<br>
Preserve a pointer to the newly allocated signal stack as well. That too<br>
is flagged by LSan at least among leak detectors.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Support/Unix/Signals.inc<br>
<br>
Modified: llvm/trunk/lib/Support/Unix/Signals.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=279605&r1=279604&r2=279605&view=diff" rel="noreferrer" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=279605&r1=279604&r2=279605&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)<br>
+++ llvm/trunk/lib/Support/Unix/Signals.inc Tue Aug 23 22:42:51 2016<br>
@@ -120,11 +120,12 @@ static void RegisterHandler(int Signal)<br>
 }<br>
<br>
 #if defined(HAVE_SIGALTSTACK)<br>
-// Hold onto the old alternate signal stack so that it's not reported as a leak.<br>
-// We don't make any attempt to remove our alt signal stack if we remove our<br>
-// signal handlers; that can't be done reliably if someone else is also trying<br>
-// to do the same thing.<br>
+// Hold onto both the old and new alternate signal stack so that it's not<br>
+// reported as a leak. We don't make any attempt to remove our alt signal<br>
+// stack if we remove our signal handlers; that can't be done reliably if<br>
+// someone else is also trying to do the same thing.<br>
 static stack_t OldAltStack;<br>
+static void* NewAltStackPointer;<br>
<br>
 static void CreateSigAltStack() {<br>
   const size_t AltStackSize = MINSIGSTKSZ + 64 * 1024;<br>
@@ -140,6 +141,7 @@ static void CreateSigAltStack() {<br>
<br>
   stack_t AltStack = {};<br>
   AltStack.ss_sp = reinterpret_cast<char *>(malloc(AltStackSize));<br>
+  NewAltStackPointer = AltStack.ss_sp; // Save to avoid reporting a leak.<br>
   AltStack.ss_size = AltStackSize;<br>
   if (sigaltstack(&AltStack, &OldAltStack) != 0)<br>
     free(AltStack.ss_sp);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="cremed">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="cremed">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>