[PATCH] D54469: Introduce new `disable_init` ASan option that is only supported on platforms where `SANITIZER_SUPPORTS_DISABLED_INIT` is true. Currently this is only supported on Darwin.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 12:28:00 PST 2018


delcypher added a comment.

In https://reviews.llvm.org/D54469#1298802, @kcc wrote:

> I also don't understand how it works. 
>  What happens if you do this
>
>   x = malloc()
>   dlopen("asan.so");
>   free(x)
>   
>
> This needs to be a) covered by test and b) explained in comments.


When the ASan library gets loaded we don't want any of the interceptors to be used. The actual purpose of being to load the ASan library this way is simply so we gain access to the ASan malloc enumerator implementation. 
So in the example above, both `malloc()` and `free()` are supposed to be using the same system allocator.

We want to enable doing this because this is how the memory analysis tools on macOS work. They freeze a target process, dlopen the allocator implementation that the target process is using and then call functions in the dlopen()'ed code to perform out-of-process enumeration on behalf of the analysis tool.

I can can extend the existing test to as you suggest and add comments to explain what we expect to happen here.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54469





More information about the llvm-commits mailing list