[compiler-rt] r206178 - [asan] added internal flag mmap_limit_mb

Kostya Serebryany kcc at google.com
Mon Apr 14 09:59:58 PDT 2014


Ouch, I am sorry.
May I ask you to apply a fix (I am running home and have no Windows box
handy to test anyway).

Most likely, you need to add atomic_fetch_add/atomic_fetch_sub
for atomic_uintptr_t,
just duplicate two corresponding  functions
around sanitizer_common/sanitizer_atomic_msvc.h (line 104)

--kcc


On Mon, Apr 14, 2014 at 9:41 AM, Hans Wennborg <hans at chromium.org> wrote:

> Hi Kostya,
>
> On Mon, Apr 14, 2014 at 7:51 AM, Kostya Serebryany <kcc at google.com> wrote:
> > Author: kcc
> > Date: Mon Apr 14 09:51:01 2014
> > New Revision: 206178
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=206178&view=rev
> > Log:
> > [asan] added internal flag mmap_limit_mb
> >
>
> [...]
>
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Mon Apr
> 14 09:51:01 2014
> > @@ -244,6 +244,24 @@ char *StripModuleName(const char *module
> >    return internal_strdup(short_module_name);
> >  }
> >
> > +static atomic_uintptr_t g_total_mmaped;
> > +
> > +void IncreaseTotalMmap(uptr size) {
> > +  if (!common_flags()->mmap_limit_mb) return;
> > +  uptr total_mmaped =
> > +      atomic_fetch_add(&g_total_mmaped, size, memory_order_relaxed) +
> size;
>
> I'm getting a build error here with MSVC:
>
>
> E:\b\build\slave\Chromium_Win_Clang\build\src\third_party\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc(252)
> : error C2664: '__sanitizer::u32
> __sanitizer::atomic_fetch_add(volatile __sanitizer::atomic_uint32_t
> *,__sanitizer::u32,__sanitizer::memory_order)' : cannot convert
> argument 1 from '__sanitizer::atomic_uintptr_t *' to 'volatile
> __sanitizer::atomic_uint32_t *'
>
>
>
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
>
> > +  if ((total_mmaped >> 20) > common_flags()->mmap_limit_mb) {
> > +    // Since for now mmap_limit_mb is not a user-facing flag, just
> CHECK.
> > +    common_flags()->mmap_limit_mb = 0;  // Allow mmap in CHECK.
> > +    CHECK_LT(total_mmaped >> 20, common_flags()->mmap_limit_mb);
> > +  }
> > +}
> > +
> > +void DecreaseTotalMmap(uptr size) {
> > +  if (!common_flags()->mmap_limit_mb) return;
> > +  atomic_fetch_sub(&g_total_mmaped, size, memory_order_relaxed);
>
> And:
>
>
> E:\b\build\slave\Chromium_Win_Clang\build\src\third_party\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc(262)
> : error C2664: '__sanitizer::u32
> __sanitizer::atomic_fetch_sub(volatile __sanitizer::atomic_uint32_t
> *,__sanitizer::u32,__sanitizer::memory_order)' : cannot convert
> argument 1 from '__sanitizer::atomic_uintptr_t *' to 'volatile
> __sanitizer::atomic_uint32_t *'
>
>
>
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140414/41323640/attachment.html>


More information about the llvm-commits mailing list