Opened 4 months ago

Closed 4 months ago

#29809 closed defect (fixed)

TBA: Only ship one tor binary per apk

Reported by: sysrqb Owned by: tbb-team
Priority: Very High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: TorBrowserTeam201903, tbb-mobile, tbb-8.5
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Orbot bundles all the binaries into a single apk and ships that, this means they only produce one apk for all the platforms they support. Unfortunately, with fennec, we must create one apk per arch. However, we didn't modify orbot's build system so it only includes one binary for the target architecture, therefore our apks include tor binaries for armeabi, armeabi-v7a, and x86.

This causes a little bloat and we can avoid this, but the more problematic result is it confuses Google Play such that Google Play thinks each apk supports all of those architectures, therefore we can't upload one apk for armv7-only and x86-only, because one of them will override the other.

Child Tickets

Change History (5)

comment:1 Changed 4 months ago by gk

Keywords: TorBrowserTeam201903 tbb-mobile tbb-8.5 added
Priority: MediumVery High

comment:2 Changed 4 months ago by sysrqb

Depending on the difficulty of changing this in orbot's build, we can post-process the apk (or maybe orbot aar). Based on the target, something like:

$ zip -d tor-browser-8.5a9-android-x86-multi-qa.apk lib/armeabi/tor.so
deleting: lib/armeabi/tor.so
$ zip -d tor-browser-8.5a9-android-x86-multi-qa.apk lib/armeabi-v7a/tor.so
deleting: lib/armeabi-v7a/tor.so

After this, Google Play shows:

Native platforms:   x86

Compared with the previous values:

Native platforms:   armeabi, armeabi-v7a, x86

comment:3 Changed 4 months ago by sysrqb

This looks successful (that app installs and runs without failure):

03-18 22:32:58.413  1849  1898 I PackageManager: New shared user org.torproject.torbrowser_alpha.sharedID: id=10317
--------- beginning of system
03-18 22:32:58.449  1849  1898 I PackageManager.DexOptimizer: Running dexopt (dexoptNeeded=1) on: /data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw==/base.apk pkg=org.torproject.torbrowser_alpha isa=x86 dexoptFlags=boot_complete,profile_guided,public,enable_hidden_api_checks targetFilter=speed-profile oatDir=/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw==/oat classLoaderContext=PCL[/system/framework/org.apache.http.legacy.boot.jar]
03-18 22:32:58.450  1707  1707 V installed: DexInv: --- BEGIN '/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw==/base.apk' ---
03-18 22:32:58.465   889   889 W dex2oat : Unexpected CPU variant for X86 using defaults: x86
03-18 22:32:58.465   889   889 W dex2oat : Mismatch between dex2oat instruction set features (ISA: X86 Feature string: -ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) and those of dex2oat executable (ISA: X86 Feature string: ssse3,-sse4.1,-sse4.2,-avx,-avx2,-popcnt) for the command line:
03-18 22:32:58.465   889   889 W dex2oat : /system/bin/dex2oat --zip-fd=8 --zip-location=base.apk --input-vdex-fd=-1 --output-vdex-fd=10 --oat-fd=9 --oat-location=/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw==/oat/x86/base.odex --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed-profile --swap-fd=11 --app-image-fd=12 --image-format=lz4 --classpath-dir=/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw== --class-loader-context=PCL[/system/framework/org.apache.http.legacy.boot.jar] --generate-mini-debug-info --compact-dex-level=none --runtime-arg -Xtarget-sdk-version:26 --runtime-arg -Xhidden-api-checks --compilation-reason=install
03-18 22:32:58.465   889   889 I dex2oat : /system/bin/dex2oat --input-vdex-fd=-1 --output-vdex-fd=10 --compiler-filter=speed-profile --classpath-dir=/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw== --class-loader-context=PCL[/system/framework/org.apache.http.legacy.boot.jar] --generate-mini-debug-info --compact-dex-level=none --compilation-reason=install
03-18 22:32:59.176   889   889 I dex2oat : Explicit concurrent copying GC freed 26987(5MB) AllocSpace objects, 0(0B) LOS objects, 99% free, 896B/1536KB, paused 15us total 3.596ms
03-18 22:32:59.281   889   889 I dex2oat : dex2oat took 817.867ms (1.324s cpu) (threads: 4) arena alloc=464B (464B) java alloc=16KB (17280B) native alloc=7MB (8060920B) free=2MB (2949128B)
03-18 22:32:59.287  1707  1707 V installed: DexInv: --- END '/data/app/org.torproject.torbrowser_alpha-F_xSBaczkBN7RRB1lZ1dFw==/base.apk' (success) ---

(We can ignore the warnings about unexpected CPU variant and mismatched dex instruction set features.)

comment:4 Changed 4 months ago by sysrqb

Status: newneeds_review

Okay, I have a build patch for this. 29809_1

comment:5 Changed 4 months ago by gk

Resolution: fixed
Status: needs_reviewclosed

I squeezed that in for 8.5a9-build3: commit 9cef2ffa0a3299a3d44eefe9757054e4b620b34e on master has the fix.

Note: See TracTickets for help on using tickets.