Skip to content

Relabel otp/ before the Android run-as ERTS probe (MOB-478) - #138

Merged
GenericJam merged 2 commits into
masterfrom
fix/relabel-before-erts-check
Oct 13, 2026
Merged

GenericJam merged 2 commits into
masterfrom
fix/relabel-before-erts-check

Conversation

@GenericJam

@GenericJam GenericJam commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Fixes MOB-478.

mix mob.deploy --native --android failed on a rooted (userdebug) emulator after the app was reinstalled: "OTP runtime missing on device". The reinstalled app runs under new SELinux MCS categories, but the otp/ tree --native pushed as root (after adb uninstall, so these are fresh files) came out with the previous install's (observed: otp/ s0:c210,..., otp/erts-17.0 s0:c209,...). The run-as ERTS probe couldn't read it, and the deploy stopped before relabel_otp_android/1, which ran only last.

deploy_android/3 now relabels otp/ before the probe too. The final relabel after every write stays. Without root the chcon fails silently, as before.

Test: test/mob_dev/deployer_android_relabel_test.exs runs Deployer.deploy_all/1 against a fake adb on PATH that hides ERTS from the probe until a chcon has run. It asserts the deploy succeeds, a relabel runs before the probe, and the last adb call is the final relabel. It fails with the early relabel removed (the "OTP runtime missing" error).

Device (Scene3d_arm, android-35 google_apis arm64, userdebug, throwaway mix mob.new --blank --local app): deploy --native, adb uninstall, deploy --native again.

  • master 8d1ab5c: ✗ OTP runtime missing on device emulator-5620; run-as ... ls otp/erts-*/bin/erl_child_setup → No such file (cache c210, erts-17.0 c209).
  • this branch: ✓ Deployed to 1 device(s), erts-17.0 relabelled to the app's c211, BEAM started (Mob.Dist: distribution started). No manual chcon.

Gates: mix test 3065 passed (11 excluded); format, credo --strict clean, compile --warnings-as-errors, erlfmt. mix mob.security_scan --strict: 4 HIGH bundled-tarball drift findings for ios_device/ios_sim (Elixir, exqlite beam), from the local OTP cache vs priv/security/bundled_versions.exs; this PR touches neither.

Review: reviewer subagent (Codex rate-limited until 6:25 PM): SHIP, two test nitpicks fixed, re-review SHIP; pre-merge: MERGE (CHANGELOG wording fixed after it).

After an APK reinstall on a rooted emulator the app runs under new SELinux
MCS categories, but the otp/ tree mix mob.deploy --native pushed as root
kept the previous install's. The run-as ERTS probe couldn't read it and
the deploy failed with "OTP runtime missing on device" before its only
relabel, which ran last. Relabel before the probe too; the final relabel
after every write stays.
@GenericJam
GenericJam merged commit a1933e1 into master Oct 13, 2026
6 checks passed
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.

1 participant