[llvm-commits] [PATCH] ASan/Android: fall back to the system allocator for unexpected deallocations

Kostya Serebryany kcc at google.com
Thu Dec 8 12:56:54 PST 2011


On Thu, Dec 8, 2011 at 11:51 AM, Evgeniy Stepanov <eugeni.stepanov at gmail.com
> wrote:

> AFAIK, MacOSX does something like this already.


Yes, and that is very unfortunate.
Intercepting allocators on mac is much more complicated than on linux.
For Linux, including android, I believe we can do simpler.


> We could speed up
> __asan_mz_size significantly and make it lock-free.
>

Mmm. That'll be non-trivial at least. Especially on 32-bit where we have
scarce address space.
(On 64-bit this can be done by maping a 128G virtual memory chunk and then
allocating only from it).


> I don't see a way to call __asan_init much earlier, other than
> patching the linker or something like that.
>

Why not. having __asan_init be called before everything else is really
important.

--kcc


>
> On Thu, Dec 8, 2011 at 11:02 PM, Kostya Serebryany <kcc at google.com> wrote:
> > Having such patch, even under ifdef ANDROID, will be very sad.
> > It makes free() much slower (linear time + lock, instead of constant time
> > w/o lock).
> > We need to figure out some other way (e.g. try to run __asan_init() even
> > earlier).
> >
> > --kcc
> >
> >
> > On Thu, Dec 8, 2011 at 6:38 AM, Evgeniy Stepanov <
> eugeni.stepanov at gmail.com>
> > wrote:
> >>
> >> On Android, allocations from static constructors of uninstrumented
> >> libraries occur before we have a chance to replace the allocator. This
> >> patch helps avoid crashing on the matching deallocations.
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111208/df23545e/attachment.html>


More information about the llvm-commits mailing list