Skip to content

Backported Foundation Devices fixes#34

Open
sneurlax wants to merge 4 commits into
mainfrom
backport/foundation-devices-fixes
Open

Backported Foundation Devices fixes#34
sneurlax wants to merge 4 commits into
mainfrom
backport/foundation-devices-fixes

Conversation

@sneurlax

Copy link
Copy Markdown
Member

Today I compared Foundation-Devices/tor to our downstream cypherstack/tor. These are the fixes we do not have yet.

Closes #23

sneurlax added 4 commits July 13, 2026 12:56
Backport of Foundation-Devices' GrapheneOS crash fix.

Replace the assert!(!client.is_null()) panics in tor_client_bootstrap
and tor_client_set_dormant with graceful null guards so calling these
before start (or after stop) returns instead of aborting the process,
which crashed the app on GrapheneOS in particular.

Also make stop() idempotent: return early when the proxy is already
stopped and reset the client state afterwards.

Add preemptive-circuit tuning to tor_start to reduce needless circuit
building.
Backport of Foundation-Devices' fix. Bind to port 0 and read back the
port the OS assigns instead of guessing a random port and retrying on
collision. This is the standard, race-free way to obtain a free port and
removes the now-unused dart:math import.
Backport of Foundation-Devices' change. Pass the linker flags
-Wl,--hash-style=both and -Wl,-z,max-page-size=16384 when building the
Rust library for Android so the shared object loads on devices with
16 KB memory pages (required for Android 15+ on such hardware).
Backport of Foundation-Devices' fix. AGP 8+ rejects the package
attribute in the manifest; the namespace is already declared in
android/build.gradle (com.cypherstack.tor_ffi_plugin). Leaving the
attribute in place fails downstream consumers' processDebugManifest.
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

Successfully merging this pull request may close these issues.

Can fail to get random unused port

1 participant