-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Prevent concurrent calls to Tor API #59
Merged
eighthave
merged 4 commits into
guardianproject:master
from
akwizgran:57-tor-config-crash
Dec 9, 2021
Merged
Prevent concurrent calls to Tor API #59
eighthave
merged 4 commits into
guardianproject:master
from
akwizgran:57-tor-config-crash
Dec 9, 2021
Conversation
This file contains 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
E/fdsan: attempted to close file descriptor, expected to be unowned, actually owned
The lock is static to ensure that if the TorService instance is destroyed and a new instance is created (eg when unbinding and then re-binding), the background threads created by the two instances don't concurrently call into the process's Tor library.
Pushed this for a CI run here: https://gitlab.com/eighthave/tor-android/-/pipelines/421253873 |
This passed the CI (if rebased on before #55) https://gitlab.com/eighthave/tor-android/-/pipelines/421879534 |
This passed CI https://gitlab.com/eighthave/tor-android/-/jobs/1866654537 |
eighthave
added a commit
to eighthave/tor-android
that referenced
this pull request
Dec 17, 2021
This unnests the try/finally block that was added in pull guardianproject#59, and moves it to the main try block, where it now handles the whole shutdown procedure. * guardianproject#61 (comment) * guardianproject#57 * guardianproject#59
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Dec 17, 2021
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
eighthave
added a commit
to eighthave/tor-android
that referenced
this pull request
Dec 21, 2021
This unnests the try/finally block that was added in pull guardianproject#59, and moves it to the main try block, where it now handles the whole shutdown procedure. * guardianproject#61 (comment) * guardianproject#57 * guardianproject#59
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Dec 21, 2021
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jan 21, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jan 25, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Feb 4, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Mar 11, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Mar 18, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 27, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 4, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 16, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 17, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jul 25, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jul 26, 2022
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
uniqx
pushed a commit
to uniqx/tor
that referenced
this pull request
Oct 14, 2023
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Nov 3, 2023
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Nov 9, 2023
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
uniqx
pushed a commit
to uniqx/tor
that referenced
this pull request
Nov 14, 2023
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Dec 8, 2023
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jan 21, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jan 30, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Feb 28, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
bitmold
pushed a commit
to bitmold/tor
that referenced
this pull request
Apr 7, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
bitmold
pushed a commit
to bitmold/tor
that referenced
this pull request
Apr 7, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
bitmold
pushed a commit
to bitmold/tor
that referenced
this pull request
Apr 7, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 9, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 10, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 13, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 16, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Apr 29, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
May 2, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
bitmold
pushed a commit
to bitmold/tor
that referenced
this pull request
May 3, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
uniqx
pushed a commit
to uniqx/tor
that referenced
this pull request
May 7, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 1, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 6, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jun 19, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
uniqx
pushed a commit
to uniqx/tor
that referenced
this pull request
Jul 15, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Aug 6, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Oct 17, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Oct 24, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Oct 31, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Nov 19, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
uniqx
pushed a commit
to uniqx/tor
that referenced
this pull request
Dec 3, 2024
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
syphyr
pushed a commit
to syphyr/tor
that referenced
this pull request
Jan 22, 2025
This is here as an experiment in case it is useful in Java space. It is looking like there are better ways to handle the shutdown, so my guess is that this will not be useful. * guardianproject/tor-android#59 * guardianproject/tor-android#61 (comment) * guardianproject/tor-android#57
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.
This PR prevents the crashes seen in
#57 andTor #32729 by preventing concurrent calls to the Tor API. Concurrent calls are prevented in two ways:Move the call to mainConfigurationFree() onto the same thread as runMain() to ensure it's never called before runMain() has returned, per the comments in tor_api.h.
Use a static lock to prevent different TorService instances within the same process from making concurrent native calls. It was previously possible for this to happen because the native calls are made from a background thread that may (briefly) outlive the TorService instance that launched it.
Edit: The crashes seen in #57 seem to be caused by file descriptor reuse and are not fixed by this PR.