Repository navigation
ADFA-5362 fix(proot): learn per device that a kernel cannot run proot with seccomp - #513
Merged
Merged
Conversation
…place PRootEngine wrote the same environment block twice, so a per-device launch decision had no single place to land. Extract it into ProotEnvironment, applied identically by both launch methods. No behaviour change: the map is value-identical to what shipped, pinned by ProotEnvironmentTest so drift fails a test instead of a device.
… seccomp Some kernels cannot run proot with its seccomp acceleration: it aborts in well under a second on assertion "IS_IN_SYSENTER(tracee)" failed, and the device never starts. Forcing PROOT_NO_SECCOMP everywhere instead costs +18% to +75%, so the fact has to be learned per device. No probe: a trivial one does not reproduce the abort, and a faithful one costs 3-14s on every healthy device for an answer the real launch gives for free. Instead the exit seam recognises proot's own marker, remembers it against a capability key (OS build, kernel, app version) and relaunches once. The abort lands before the guest does any work, so the retry cannot duplicate anything and the caller still sees a single onProcessExit.
…capability key Code review: relaunching from inside the engine was a second actuation path that never consulted `desired`, so a stop landing between the aborted launch and the relaunch would have been overruled. The reconciler already relaunches whenever the environment is not alive, so the engine now only records the verdict. Device-verified: recovery takes one tick, 2.3s. The rule that a stored verdict only counts under the same capability key is what keeps a healthy device from being left permanently slower, and it lived in the data layer with no test. Moved to domain as CapabilityKey, with the cases that matter: OS update, kernel change, new versionCode, nothing stored.
This file contains hidden or 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
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.
What
Some kernels cannot run proot with its seccomp acceleration: proot aborts in well under a second and the device never starts. The app now learns that from a real launch, remembers it per device, and launches accordingly. Healthy devices are untouched.
Why not just set
PROOT_NO_SECCOMPeverywhereMeasured on a healthy device (kernel 4.14), same rootfs, two passes each:
Why no probe
A trivial probe (
/bin/true) does not reproduce the abort — it exits 0 on the affected device. A faithful probe has to be the production shape (bash -l), and a successful one costs ~3 s on a fast device and ~13.6 s on a slow one, paid by every healthy device for an answer the real launch gives for free. The failure is the cheap half: exit 1 in ~0.4 s carrying proot's own marker. So the exit seam reads the marker; nothing extra is ever launched.How
SeccompFailure— non-zero exit and proot's own marker. Marker-based on purpose: proot names this failure itself, so there is no timing heuristic that could misread a failing install and slow the device down for good.CapabilityKey— a stored verdict only counts under the same OS build + kernel +versionCode. That is what makes the cache safe over time, and why nothing ever has to clear it.ProotEnvironment— one builder for the proot environment, replacing two hand-written copies. The generatediiabCLI consumes the same verdict.Reduction
Device verification
PROOT_NO_SECCOMP=1iiabCLINot fixed here
The affected device still does not stay up: it now launches proot correctly and is then killed mid-boot, because a legitimate 37 s boot meets a 20 s service-down grace. That is ADFA-5365 (boot grace vs flap grace). This PR closes the capability half only.
Test plan
./gradlew :app:testDebugUnitTest :app:lintDebug— green.ProotCapabilityPrefs.xmlis created, the live proot has no seccomp variable, the box serves normally.logcat | grep ADFA-5362shows exactly one learning line; the next launch carriesPROOT_NO_SECCOMP=1;shared_prefs/ProotCapabilityPrefs.xmlholds the verdict and the key.No server change, no new strings, no UI change.