fix(magisk): scrub any competing /system/xbin/su; Verify fails on a non-Magisk su#17
Merged
Merged
Conversation
…on-Magisk su Magisk reported "Abnormal State -- a su binary not from Magisk has been detected" on an instance whose shared master still carried a classic/engine su at /system/xbin/su (sha 185106.../2012872B). The Magisk pipeline scrubbed only its own bootstrap su (bsr_su) and Verify only swept for bsr_su's hash, so a competing su passed silently. Git confirms NO commit ever changed su handling (bsr_magisk.ps1: only ac2af27 + the adb fix); the adb fix simply let the pipeline complete so Magisk booted and flagged the pre-existing leftover. Root source of that su: the legacy Run-Live-E2E injected it via the engine's classic-su path (-Action AdbRoot). - Prep + Clean: rm /system/xbin/su (+ daemonsu) in the offline carve, so Magisk's su (/system/bin/su->magisk, /sbin/su->magisk) is the only one. Re-running Clean repairs an already-rooted instance. - Verify: enumerate every su in the standard PATH dirs and FAIL on any that is not a symlink to magisk (new pure, unit-tested Find-StraySu). su scan is pushed as a script file (the inline loop's ';' didn't survive PS->adb quoting). - Run-Live-E2E.ps1: rewritten to drive bsr_magisk.ps1 -Action Auto (the shipped pipeline) and ASSERT VERIFY PASS + no competing su across a reboot; correct package io.github.huskydg.magisk; revert via Magisk Undo. (It used to root via the classic-su path, which planted the competing su.) - Run-Resolve-Tests: +7 Find-StraySu cases (38). Run-Tests (28) + Check-Embedded-Sync green. Live-verified on Tiramisu64_9: Clean scrubbed the stray su; Verify then reported competing su: none -> VERIFY PASS.
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.
Symptom
Magisk shows "Abnormal State — a su binary not from Magisk has been detected" on a freshly-rooted instance.
Root cause (investigated per "look at the last commits")
/system/xbin/su— sha185106…, 2,012,872 B = the engine''s classic-su binary (the old root method), left in the shared masterRoot.vhd.bsr_magisk.ps1has only two commits ever (ac2af27+ the adb fix), and the only commit touchingsystem/xbin/suisac2af27. The v11 adb fix didn''t write any su — it just let the pipeline complete, so Magisk finally booted and flagged the pre-existing leftover.tests/Run-Live-E2E.ps1rooted via the engine''s legacy classic-su path (-Action AdbRoot), which installs a setuid/system/xbin/su. Running it (a prior background re-root E2E) planted the su in the master.bsr_su), never a pre-existing/system/xbin/su; and Verify only swept forbsr_su''s hash, so a competing su passed silently.Fix
rm /system/xbin/su(+daemonsu) in the offline carve. Magisk''s own su (/system/bin/su→magisk,/sbin/su→magisk) is the only one. Re-running Clean repairs an already-rooted instance.Find-StraySu). The scan is pushed as a script file (the inline loop''s;didn''t survive PS→adb→device quoting).Run-Live-E2E.ps1rewritten to drive the shippedbsr_magisk.ps1 -Action Autopipeline and assert VERIFY PASS + no competing su across a reboot — correct packageio.github.huskydg.magisk, revert via Magisk Undo. (It previously planted the competing su via classic-su.)Verified live (Tiramisu64_9)
/system/xbin/su(stat → File not found), Root.vhd updated.competing su: none→ VERIFY PASS (su -c id→uid=0,/system/bin/su→./magisk, nobsr_sutraces).Tests
Run-Resolve-Tests.ps1: +7Find-StraySucases → 38/38Run-Tests.ps1→ 28/28;Check-Embedded-Sync.ps1in sync (re-embeddedblueStackRoot.cmd)