Two stability-neutral speedups, validated 6/6 on Q3 (build 52433670036000520), rebooting to clean
Enforcing between every run (all flip + adbd cred-patch + fresh shell uid0; 3.71-3.76s):
- Writer.java: replace the per-record Thread.sleep(1) with a 1ms yield every 64 sends. The reactive
EAGAIN/ECONNREFUSED retry already handles send-buffer pressure; the proactive per-packet sleep only
needed to cap the in-flight burst so loopback UDP receive doesn't silently drop. Capping the burst
at 64 (below the on-device ctor's proven-safe 98 sleepless sends) keeps that guarantee while cutting
~1.5s off the 1467-record inject/libas poison. e2e.dex rebuilt (javac -source8 -target8 + d8 min-api30).
- orchestrate.rs: tighten the restart / enforcing-flip / adb-root-verify poll intervals from 300-400ms
to 100ms (same total timeouts) so detection latency isn't a fixed 0.3-0.4s per stage.
poison_batch 3.2s -> ~1.7s; total --adb-root 6.1s -> 3.74s.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Building on the prior 32->14s pass, further cuts profiled on live Q3:
- Multi-file Writer (e2e.dex): one Writer invocation now poisons N files under a
single JVM + one IpSec SA. The base chain's inject-lib + libandroid poisons are
batched into one call (poison_batch) instead of two -> saves a JVM+SA (~1.5s).
- Parallel cred carrier: --adb-root builds the adbd cred module (host clang, ~1.2s)
in a background thread during the base chain (adbd pid is stable; rebuilds only if
it changed) -> fully overlapped.
- Skip the slow dd|base64 read of libandroid's original bytes when the run won't
revert (adb-root/no-restore).
- Faster polling: trackingservice-restart 1s->0.3s, adbd-root verify 1s->0.3s.
Net on this Q3: ~11s to a root adb shell (uid0 + u:r:kernel:s0), single clean
inject pass, no retries. Multi-file Writer also speeds the QPro/Q2/postex flows.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Profiled --adb-root on live Q3 (52433670036000520). Cuts:
- Writer (e2e.dex): the intermittent "writer incomplete" retries were IpSec
objects (encap socket + Binder token) getting GC-collected mid-run under
post-boot memory pressure -> IpSecService tore down the SA -> every send threw
ECONNREFUSED -> whole run aborted + JVM/SA restart (~4-8s each). Fixed by pinning
them in a static (KEEP), plus SO_SNDBUF bump and per-record retry on transient
errno (EAGAIN/ENOBUFS/ECONNREFUSED) so a hiccup never aborts the run. Also paced
sends at 1ms instead of 3ms (the on-device ctor poisons sleeplessly).
- orchestrate.py: poll getenforce after `ctl.start insmod_sh` instead of a fixed
sleep(4) (~3.5s); settle default 8 -> 3 (ctor's init_array runs early); Q3
--adb-root skips the two code-poison reverts (~8s) — transient session, SA already
stopped so the dead-SA ctor is harmless (--postex still reverts, for Magisk).
poison() now surfaces the writer's exception on retry for diagnosis.
Verified on-device: 14.6s, single clean inject pass (no retries), fresh `adb shell`
= uid 0 / u:r:kernel:s0.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Single JSON-driven toolkit. From an unprivileged (uid 2000) adb shell on a
locked retail Quest 3:
- Dirty-Frag page-cache poison stages an attacker-keyed AES-GCM ESP SA and
injects an init_array ctor into hal_tracking (via libeva) that poisons a
diff-patched vendor .ko (llcc_perfmon) to flip selinux_state.enforcing=0;
- ctl.start insmod_sh finit-loads it -> SELinux Permissive (zero root);
- --postex: a second diff-patched carrier (usbip-vudc) cred-patches a waiting
shell to uid 0 (+ syncs the SELinux status page via
selinux_status_update_setenforce) and runs Singularity Magisk (v30.7 fork,
no zygote restart) -> headless `su` under SELinux Enforcing, ~40s.
Both carriers are DIFF-PATCHED existing modules (no per-kernel compilation);
adding a firmware = `port.py --zip ... --device ...` -> targets/<name>.json.
Proven on builds 52345320027600520 and 52433670032200520.
Co-Authored-By: Claude Opus 4.8 <[email protected]>