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

CloseProxmark crashes if called twice on Android O and later #23

Open
micolous opened this Issue Sep 15, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@micolous
Contributor

micolous commented Sep 15, 2018

Description

CloseProxmark crashes if called twice on Android O and later:

pid: 0, tid: 0 >>> au.id.micolous.andprox <<<

backtrace:
  #00  pc 000000000006b7d0  /system/lib64/libc.so (tgkill+8)
  #01  pc 000000000001df10  /system/lib64/libc.so (abort+88)
  #02  pc 0000000000025e84  /system/lib64/libc.so (__libc_fatal+116)
  #03  pc 0000000000068644  /system/lib64/libc.so (_Z23__pthread_internal_findl+180)
  #04  pc 000000000006867c  /system/lib64/libc.so (pthread_join+52)
  #05  pc 000000000002d8f0  /data/app/au.id.micolous.andprox-56hLF2Vm_PzLEoeq51UcDg==/lib/arm64/libnatives.so (CloseProxmark+32)
  #06  pc 00000000000c6600  /data/app/au.id.micolous.andprox-56hLF2Vm_PzLEoeq51UcDg==/lib/arm64/libnatives.so (Java_au_id_micolous_andprox_natives_Natives_stopReaderThread+32)
  #07  pc 000000000002eee0  /data/app/au.id.micolous.andprox-56hLF2Vm_PzLEoeq51UcDg==/oat/arm64/base.odex

Reproducing this on emulator gives:

09-15 10:05:15.386 6749-6765/? A/libc: invalid pthread_t 0xc9dff970 passed to libc

It appears this is because of:

https://github.com/aosp-mirror/platform_bionic/blob/ed16b344e75f422fb36fbfd91fb30de339475880/libc/bionic/pthread_internal.cpp#L116-L128

Tests don't catch this because:

  1. :natives runs tests in SDK 21 mode (while the rest of the app is SDK 27
  2. We don't actually call CloseProxmark twice.

This will require an upstream patch to Proxmark3 to fix.

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