[compiler-rt] r291510 - Bypass quarantine when quarantine size is set ot zero.

Aleksey Shlyapnikov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 15:48:53 PST 2017


Actually, it was reverted and I re-landed the change as D28586 after this
bug fix D28577.

You mean, the test verifying that quarantine is, in fact, bypassed? Not
right away, but I'll think about it.

On Tue, Jan 10, 2017 at 4:41 PM, Kostya Serebryany <kcc at google.com> wrote:

> is a test possible here?
>
> On Mon, Jan 9, 2017 at 3:49 PM, Alex Shlyapnikov via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: alekseyshl
>> Date: Mon Jan  9 17:49:15 2017
>> New Revision: 291510
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=291510&view=rev
>> Log:
>> Bypass quarantine when quarantine size is set ot zero.
>>
>> Modified:
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sa
>> nitizer_common/sanitizer_quarantine.h?rev=291510&r1=291509&
>> r2=291510&view=diff
>> ============================================================
>> ==================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h Mon
>> Jan  9 17:49:15 2017
>> @@ -49,6 +49,10 @@ class Quarantine {
>>    }
>>
>>    void Init(uptr size, uptr cache_size) {
>> +    // Thread local quarantine size can be zero only when global
>> quarantine size
>> +    // is zero (it allows us to perform just one atomic read per Put()
>> call).
>> +    CHECK((size == 0 && cache_size == 0) || cache_size != 0);
>> +
>>      atomic_store(&max_size_, size, memory_order_relaxed);
>>      atomic_store(&min_size_, size / 10 * 9,
>>                   memory_order_relaxed);  // 90% of max size.
>> @@ -61,8 +65,15 @@ class Quarantine {
>>    }
>>
>>    void Put(Cache *c, Callback cb, Node *ptr, uptr size) {
>> -    c->Enqueue(cb, ptr, size);
>> -    if (c->Size() > GetCacheSize())
>> +    uptr cache_size = GetCacheSize();
>> +    if (cache_size) {
>> +      c->Enqueue(cb, ptr, size);
>> +    } else {
>> +      // cache_size == 0 only when size == 0 (see Init).
>> +      cb.Recycle(ptr);
>> +    }
>> +    // Check cache size anyway to accommodate for runtime cache_size
>> change.
>> +    if (c->Size() > cache_size)
>>        Drain(c, cb);
>>    }
>>
>> @@ -207,6 +218,7 @@ class QuarantineCache {
>>      return b;
>>    }
>>  };
>> +
>>  } // namespace __sanitizer
>>
>>  #endif // SANITIZER_QUARANTINE_H
>>
>>
>> _______________________________________________
>> 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/20170113/7ecf77fb/attachment.html>


More information about the llvm-commits mailing list