[PATCH] D31695: Windows asan_device_setup.bat port of linux shell script

Steven Winston via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 15:12:55 PDT 2017


gpx1000 added a comment.

In https://reviews.llvm.org/D31695#824667, @eugenis wrote:

> This is great! Wrap.sh is definitely a better approach for 99% of users. Why are you saying that it needs an eng dev build though? I thought the idea behind wrap.sh is that it works on regular user devices, as long as the app has DEBUGGABLE in the manifest.


It actually doesn't need to be an eng or dev build.  I'm saying it needs root (setenforce 0 / setenforce 1 are the keys).  If you have root, either through su or through adb root, then the wrap method will work.

>> #!/system/bin/sh-from-zygote\n
>>  ASAN_OPTIONS=start_deactivated=1,malloc_context_size=0
>>  ASAN_ACTIVATION_OPTIONS=include_if_exists=/data/local/tmp/asan.options.b
>>  LD_PRELOAD=libclang_rt.asan-${abi}-android.so
>>  su -c setenforcing 0
>>  $@
>>  su -c setenforcing 1
> 
> As I mentioned in other comments, this script does not pass the variables to the child environment. It needs to be a one-liner or do explicit "export". Did you test it with actual ASan-instrumented code in the app?

Yep, tested it with a PixelXL and with emulator.  Will add in the explicit export (was wondering why it didn't need it tbh).

> 
> 
>> I'd note that with doing this; I'm not entirely sure there's still a need for this script to exist.   I'm creating a blog post / tutorial on how to use ASan using the above wrap implementation; complete with example project.  However, I'll make the suggested changes and resubmit.
> 
> The only reason for the script to exist is performance - any wrap-based solution would restart the entire VM for every new process, which takes at least a few seconds.

That makes quite a bit of sense.  alright, will refactor this script too.  Thanks for the code review, these are some great ideas!  Expect me to have a bit of time over the weekend to do it.


https://reviews.llvm.org/D31695





More information about the llvm-commits mailing list