Skip to content

Bug 42368: Do not use API26+ java.nio features

Merge Info

Related Issues

Backporting

Timeline

  • Immediate: patchset needed as soon as possible
  • Next Minor Stable Release: patchset that needs to be verified in nightly before backport
  • Eventually: patchset that needs to be verified in alpha before backport
  • No Backport (preferred): patchset for the next major stable

(Optional) Justification

  • Emergency security update: patchset fixes CVEs, 0-days, etc
  • Censorship event: patchset enables censorship circumvention
  • Critical bug-fix: patchset fixes a bug in core-functionality
  • Consistency: patchset which would make development easier if it were in both the alpha and release branches; developer tools, build system changes, etc
  • Sponsor required: patchset required for sponsor
  • Localization: typos and other localization changes that should be also in the release branch
  • Other: please explain

Merging

  • Merge to tor-browser - !fixups to tor-browser-specific commits, new features, security backports
  • Merge to base-browser - !fixups to base-browser-specific commits, new features to be shared with mullvad-browser, and security backports
    • NOTE: if your changeset includes patches to both base-browser and tor-browser please clearly label in the change description which commits should be cherry-picked to base-browser after merging

Issue Tracking

Review

Request Reviewer

  • Request review from an applications developer depending on modified system:
    • NOTE: if the MR modifies multiple areas, please /cc all the relevant reviewers (since gitlab only allows 1 reviewer)
    • accessibility : henry
    • android : clairehurst, dan
    • build system : boklm
    • extensions : ma1
    • firefox internals (XUL/JS/XPCOM) : ma1
    • fonts : pierov
    • frontend (implementation) : henry
    • frontend (review) : donuts, richard
    • localization : henry, pierov
    • macos : clairehurst, dan
    • nightly builds : boklm
    • rebases/release-prep : dan, ma1, pierov, richard
    • security : ma1
    • signing : boklm, richard
    • updater : pierov
    • misc/other : pierov, richard

Change Description

In TorIntegrationAndroid (introduced in !852 (merged)) I used some java.nio methods that are available only from API26. As a result, older versions of Android had crashes at startup.

So, I removed newer calls (a mix of Path, Paths and Files) and now we use only File.

The most problematic calls were the permissions and file copy.

The tor daemon requires the directory used for IPC to be 700, but java.io doesn't have proper chmods... So, I remove all permissions for everybody, and then add them back only for the owner.

For the file copy, I had to implement it with the various stream, instead of using a simple single line (Files.copy) 😒. I didn't bother with buffered stuff, since we only read/write big buffer.

How Tested

I've installed a local build in a lollipop-based emulator (API21, the oldest we support).

First, I checked it doesn't crash at start.

Then, I set the new backend and checked it can bootstrap and we can browse with it.

I've tested also the simulated censorship, but I seem not to be able to do the domain fronted requests!

Merge request reports

Loading