Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asan_device_setup error bricks phone #6

Closed
edkimmel opened this issue Mar 10, 2016 · 9 comments
Closed

asan_device_setup error bricks phone #6

edkimmel opened this issue Mar 10, 2016 · 9 comments
Assignees
Milestone

Comments

@edkimmel
Copy link

Platform - OSX 10.11.2
Device - Samsung Galaxy S3, Rooted

  1. Modify asan_device_setup to work on OSX
  • TMPDIRBASE=$(mktemp -d -t template)
    • TMPDIRBASE=$(mktemp -d)
      2) Run ./asan_device_setup --use-su
>> Remounting /system rw
Remounting /dev/block/platform/msm_sdcc.1/by-name/system at /system
Target architecture: arm
>> Pre-L device detected. Setting up app_process symlink.
>> Copying files from the device
>> New installation
>> Generating wrappers
Only in new/: app_process.wrap
Only in new/: asanwrapper
Only in new/: libclang_rt.asan-arm-android.so
>> Pushing files to the device
Installing /system/lib/libclang_rt.asan-arm-android.so 644 
4574 KB/s (691152 bytes in 0.147s)
/system/bin/sh: can't create "/system/lib/libclang_rt.asan-arm-android.so/libclang_rt.asan-arm-android.so": No such file or directory
Unable to open /system/lib/libclang_rt.asan-arm-android.so: No such file or directory
Unable to open /system/lib/libclang_rt.asan-arm-android.so: No such file or directory
Installing /system/bin/app_process.wrap 755 u:object_r:system_file:s0
16 KB/s (279 bytes in 0.016s)
/system/bin/sh: can't create "/system/bin/app_process.wrap/app_process.wrap": No such file or directory
Unable to open /system/bin/app_process.wrap: No such file or directory
Unable to open /system/bin/app_process.wrap: No such file or directory
chcon:  Could not label /system/bin/app_process.wrap with u:object_r:system_file:s0:  No such file or directory
Installing /system/bin/asanwrapper 755 u:object_r:system_file:s0
3 KB/s (71 bytes in 0.020s)
/system/bin/sh: can't create "/system/bin/asanwrapper/asanwrapper": No such file or directory
Unable to open /system/bin/asanwrapper: No such file or directory
Unable to open /system/bin/asanwrapper: No such file or directory
chcon:  Could not label /system/bin/asanwrapper with u:object_r:system_file:s0:  No such file or directory
>> Restarting shell (asynchronous)
>> Please wait until the device restarts

The device no longer boots. I imagine it's because of the errors in the system/lib paths. The file name is repeated mistakenly.

@eugenis
Copy link
Collaborator

eugenis commented Mar 10, 2016

Couldyou provide some more info?

  • adb version
  • ndk version
  • android version on the device

Does it help to do asan_device_setup --revert ?

@DanAlbert
Copy link
Member

Yikes.

We don't actually modify asan_device_setup at all, it's direct from the ASAN repository, so I've opened a bug over there. Should move discussion to that bug, but I'll leave this open to track that we don't have the fix yet.

@CNugteren
Copy link

Saw a similar problem today with NDK 11 and the --use-su option. Even after I fixed the indicated issues such as /system/bin/sh: can't create "/system/lib/libclang_rt.asan-arm-android.so/libclang_rt.asan-arm-android.so": No such file or directory for my device, the script would still brick the device. I didn't try the revert option.

I've tested this on Android 4.4.4 on a Sony Z1C and subsequently with a custom ROM (also Android 4.4.4). The old script (without the useful --use-su option) of the NDK 10e still works on this device. This is on ADB version 1.0.32.

@edkimmel
Copy link
Author

I was using NDK 11 as well.

Device was a Samsung Galaxy S3, android version 4.4.2
I didn't know that I had to do anything extra while rooted to get ADB working in recovery mode, so I'm not able to even try to revert option. Reflashing does nothing, Samsung kies fails. Guess I have a nice looking paperweight.

It's honestly silly that we need a rooted device to access a lot of useful debugging tools, but there's no official support for rooting. I'd even settle for bringing back rooted dev only phones.

@DanAlbert
Copy link
Member

Does this only happen with --use-su? I'm going to see if I can brick a Nexus 5 really quick...

I'm not quite sure how this script could make a device unrecoverable even after reflashing... All it does is modify the system and data partitions.

@DanAlbert
Copy link
Member

So, I was able to render a Nexus 5 (KTU84P) unbootable, but I was also able to recover it. By reflashing.

Looks like this isn't unique to --use-su. It repros on a userdebug KTU84P hammerhead just fine. Still not sure what's going on yet though.

@DanAlbert DanAlbert added this to the r11b milestone Mar 14, 2016
@DanAlbert
Copy link
Member

Looks like this was actually fixed by llvm-mirror/compiler-rt@bd58cbc

The version of clang we shipped was a couple months before that CL.

So, this will be fixed in r12, but given that this is pretty damn harmful I'm going to see if I can rig our build to include a newer asan_device_setup...

@DanAlbert DanAlbert self-assigned this Mar 14, 2016
@DanAlbert
Copy link
Member

Okay, a fix is checked in for r11b.

@DanAlbert
Copy link
Member

r11b is live with the fix: http://developer.android.com/ndk/downloads/index.html#download

@PvR33 PvR33 mentioned this issue Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants