Skip to content

asan_device_setup error bricks phone #6

Closed

Description

@edkimmel

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.

Activity

  1. eugenis commented on Mar 10, 2016

    @eugenis

    Couldyou provide some more info?

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

    Does it help to do asan_device_setup --revert ?

  2. DanAlbert commented on Mar 10, 2016

    @DanAlbert
    Contributor

    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.

  3. CNugteren commented on Mar 11, 2016

    @CNugteren

    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.

  4. edkimmel commented on Mar 11, 2016

    @edkimmel
    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.

  5. DanAlbert commented on Mar 11, 2016

    @DanAlbert
    Contributor

    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.

  6. DanAlbert commented on Mar 12, 2016

    @DanAlbert
    Contributor

    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.

  7. added this to the r11b milestone on Mar 14, 2016
  8. DanAlbert commented on Mar 14, 2016

    @DanAlbert
    Contributor

    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...

  9. self-assigned this
    on Mar 14, 2016
  10. DanAlbert commented on Mar 15, 2016

    @DanAlbert
    Contributor

    Okay, a fix is checked in for r11b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions