[llvm] r279605 - Preserve a pointer to the newly allocated signal stack as well. That too

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 20:45:44 PDT 2016


I submitted quick fix https://reviews.llvm.org/D23864 to recover bots.
Another working solution is to make Asan to set size greeter than one in Si
gnals.inc

On Wed, Aug 24, 2016 at 7:13 PM Vitaly Buka <vitalybuka at google.com> wrote:

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


More information about the llvm-commits mailing list