[BUG] v.0.4.6.x - No check/verify of sepolicy add could lead to bootloop
Starting with v.0.4.6.x EdXposed zip needs to add a file called sepolicy.rule in /persist (/persist/magisk/riru_edxposed in my case).
But there is no check if this operation goes well or not and no error is reported to user if not (e.g. if /persist is disk full since of TWRP logs as it happened to me...).
User could think all has been installed proper way (since of no error reported), but without sepolicy set, phone will bootloop at reboot.
Since of no error reported is very difficult for the user to find for what reason it doesn't work fine too...
@enetec1 I dont think persist is a good partition to place sepolicy rule, because it's not exist in some devices, so I wrote an incomplete persist check(in customize.sh).
I use Magisk's original installer.sh, the code for copying the sepolocy file is in this script, u should report it to @topjohnwu in https://github.com/topjohnwu/Magisk/issues
Btw, to avoid bootloop, u can delete '/data/adb/modules(_update)/riru_edxposed(_sandhook)/sepolicy.rule', EdXposed will execute sepolicy script when rule file does not exist in boot.
Reported on Magisk GitHub too now.
https://github.com/topjohnwu/Magisk/issues/2461
https://github.com/topjohnwu/Magisk/issues/2461#issuecomment-586571865
...probably this could be useful...
Btw, to avoid bootloop, u can delete '/data/adb/modules(_update)/riru_edxposed(_sandhook)/sepolicy.rule', EdXposed will execute sepolicy script when rule file does not exist in boot.
@MlgmXyysd (leaving apart what we are discussing on Magisk's installer.sh ticket...) this make me to think that a check is already included in your module... Doesn't is possible to add a similar check to consider the case of sepolicy.rule file not in place since of full /persist ?!? :?
Btw, to avoid bootloop, u can delete '/data/adb/modules(_update)/riru_edxposed(_sandhook)/sepolicy.rule', EdXposed will execute sepolicy script when rule file does not exist in boot.
@MlgmXyysd (leaving apart what we are discussing on Magisk's installer.sh ticket...) this make me to think that a check is already included in your module... Doesn't is possible to add a similar check to consider the case of sepolicy.rule file not in place since of full /persist ?!? :?
All files in the modules folder are placed correctly
All files in the modules folder are placed correctly
Yes, I'm speaking of the policy file in /persist...
P.S.: anyway, let me take the chance to thank you for the Great work your team is doing with this module! ;)
Hi @MlgmXyysd can you confirm your build 4508 should address this issue too? ;) What type of check has been added??
@enetec1 i dont know, u can try
@enetec1 i dont know, u can try
I'm testing it... BUT my /persist is no more in disk full status... ;)
I'm running into multiple issues with the current Alpha and Canary installers on my Honor 8 Pro (DUK-L09, f/w v9.1.0.215, August 2019 security patch, System partition is EROFS thus write-protected by design). I keep my bootloader unlocked at all times but I do prefer to keep OEM Lock On, this didn't cause any issues with the current or any earlier Stable releases.
With OEM Lock On, Alpha and Canary make the phone freeze at the boot logo even if I manually delete sepolicy.rule before rebooting (unexpectedly). Stable installs and works just fine even with OEM Lock On.
With OEM Lock Off, Alpha and Canary still cause a boot freeze if I don't remove secpolicy.rule (expectedly). If I remove secpolicy.rule before rebooting, the phone boots but EdXposed Manager tells me that EdXposed is installed but not active (no matter if YAHFA or Sandhook). If I turn OEM Lock back On after this partial installation, boot freezes again.
From this point, even more weirdness ensues. Even if I opt for this workaround avenue just once, and get Alpha or Canary installed but not active, no further attempts to remove either and go back to Stable result in a working EdXposed until I factory reset my phone. Once I try Alpha or Canary, no matter if I fully uninstall all the modules, EdXposed & Magisk managers, and clean reinstall them, I still keep getting 'installed but not active' with EdXposed Stable but once I factory reset the phone, wham and Stable works again even with OEM Lock On. So it appears that the current Alpha and Canary installers introduce a persistent change that prevents EdXposed from running on my device, and this seems something different from the secpolicy.rule bug alone, which gets triggered as expected and can be worked around by removing secpolicy.rule as expected.
Finally, the weirdest issue. Due to an outdated security implementation (August 2019) I'm perfectly able to fake-pass CTS with Magisk installed, Magisk Hide enabled and OEM Lock On (the latter absolutely needs to be set to On before installing any modules or CTS trips until factory reset). When I install EdXposed Stable from Magisk repository, CTS expectly trips but unexpectedly remains tripped even if I remove all modules, Magisk & EdXposed managers, and revert my boot image to the stock one. So, even the current Stable installer does something to EMUI 9.1 that trips CTS even if there is not a trace of Magisk in the user accessible space.
This may explain why some people with outdated / compromised security implementations expect to fake-pass CTS with EdXposed in App List mode, but actually don't. The installer itself mucks something up aside from Magisk / EdXposed, sadly I'm a noob and have no idea where all the modules & their leftovers go on Huawei's EROFS-based ROMs so I can't investigate. I'm fully aware from John Wu's Twitter posts that fake-passing CTS is probably no longer meaningful after the recent SafetyNet changes, but this issue is bigger than that because it breaks Safety Net for good until factory reset. It's even weirder because I'm able to install any other Magisk modules without tripping CTS, even the Pix3larity one which goes as far as applying custom sepolicy patches to the boot image (actually the recovery image since I'm on a Huawei, have to patch vanilla recovery and am barred from using TWRP).
After installation, the Verbose Log in EdXposed Manager shows no specific error messages other than 'EdXposed not active' (which baffles me).
During installation the Stable installer produces this log: https://i.imgur.com/AUDOWLn.jpg Canary installer shows this: https://i.imgur.com/kqrtbLv.jpg
Since the sepolicy sensitivity is already present in 4.6.1, and 4.6.1 works just fine for me (it even does a /persist check and removes sepolicy.rule by itself) I see no reason why 4.6.2 and 4.6.3:
- still require a manual workaround for secpolicy.rule
- don't work (as in 'inactive') even if installed via this method
- break future 4.6.1 installations until factory reset
- cause boot freeze if OEM Lock = On even if installed via workaround while 4.6.1 doesn't

Since the sepolicy sensitivity is already present in 4.6.1, and 4.6.1 works just fine for me (it even does a /persist check and removes sepolicy.rule by itself) I see no reason why 4.6.2 and 4.6.3:
At present, there are still some problems in the mechanism of Magisk, @topjohnwu says will support fallback, so I removed persist check
So basically things are supposed to get back to normal in a future Magisk release?
Is it the lack of a persist check that also causes boot freeze with OEM Lock = On?
Is there any hope that the installer itself will stop tripping CTS for good? Like, even if CTS is tripped by the EdXposed module itself, I can uninstall it at any time and still get to fake-pass CTS again? Because so far if you try to install any version of EdXposed, CTS stays tripped until factory reset even if you clean sweep all traces of Magisk afterwards.
I think these two additional issues should be reported to John Wu but since they are also EdXposed-related and I'm a complete noob at bug reporting, I have no idea how to do it gracefully.
I am using a Huawei Mate 9 on LineageOS 16.0 Build 4. When updating to EdXposed v0.4.6.2 starting with commit 32e1565fa5469002b846518b5d7df44b349cbf21 the phone reboots on every attempt to boot. If I pull the most recent master and uncomment the check_persist checks and the subsequent removal of the sepolicy it boots without issue. That reverts #477 . I could submit a pull request to fix this, but I'm not sure what the preferred behavior is. Should there be a check for HUAWEI devices that run this check or should it just skip if SAMSUNG is detected? I'm leaning towards the latter since this check was commented out instead of removed. It seems to have just been a quick fix. The only other question this raises is what other devices need the check.
Here's the most recent version with the checks reenabled for anyone having issues with this. https://drive.google.com/file/d/1Pr3tGIK9Ul1kPD75zh2u1wvBFCK668Z-/view?usp=sharing
I'm a complete newbie, so I'm sorry if I say something wrong!
After doing the update on EdXposed via Magisk, my Motorola moto g (5) Android 8.1 with ROM stock went into bootloop, I managed to solve this problem by TWRP. At first I thought the problem was with Riru-core, but it wasn't, I uninstalled both via TWRP, and the phone started normally, I installed Riru-core via Magisk, rebooted and normally called, I don't know if the problem is related to having left the OEM lock off, I'll do some tests with the lock on and see if the problem persists!