FIX: crash on Bionic libc if CloseProxmark is called twice.#672
Merged
pwpiwi merged 1 commit intoProxmark:masterfrom Oct 6, 2018
Merged
FIX: crash on Bionic libc if CloseProxmark is called twice.#672pwpiwi merged 1 commit intoProxmark:masterfrom
pwpiwi merged 1 commit intoProxmark:masterfrom
Conversation
In Android O and later, if an invalid pthread_t is passed to pthread_join, it calls fatal(). https://github.com/aosp-mirror/platform_bionic/blob/ed16b344e75f422fb36fbfd91fb30de339475880/libc/bionic/pthread_internal.cpp#L116-L128 This patch addresses it by: 1. Always memset(0) on USB_communications_thread at the end of CloseProxmark. 2. On Bionic, only call pthread_join on USB_communications_thread if it is not equal to 0.
RfidResearchGroup
pushed a commit
to RfidResearchGroup/proxmark3
that referenced
this pull request
Sep 15, 2018
Contributor
|
Why and when would this be needed? |
Contributor
Author
|
Because This is nearly the same issue as what was fixed in #617, where defence in depth was added to It's not possible for a caller to know with absolute certainty the state of |
pwpiwi
reviewed
Sep 21, 2018
Contributor
pwpiwi
left a comment
There was a problem hiding this comment.
Would you please surround the memset() with #ifdef as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Android O and later, if an invalid (or defunct)
pthread_tis passed topthread_join, it callsfatal():https://github.com/aosp-mirror/platform_bionic/blob/ed16b344e75f422fb36fbfd91fb30de339475880/libc/bionic/pthread_internal.cpp#L116-L128
This patch addresses it by:
Always
memset(0)onUSB_communications_threadat the end ofCloseProxmark.On Bionic, only call
pthread_joinonUSB_communications_threadif it is not equal to 0.This addresses AndProx/AndProx#23, an issue similar to #617.
Tested: