Magisk canary (19305) requires MagiskHide to be toggled off/on to work

Created on 30 Jun 2019  路  19Comments  路  Source: topjohnwu/Magisk

Follow up from #1651 using canary.

I've been using this ROM on my Nexus 7 (2013) (deb): https://forum.xda-developers.com/nexus-7-2013/development/rom-lineageos-16-0-t3903286

Works absolutely fine with Magisk v18.1 and I can pass both basic and cts profiles.

After upgrading to Magisk to the latest canary both basic and cts profiles return false and fail.

magisk.log
recovery last_log

Downgrading to Magisk v18.1 fixes the basic & cts profile failures.

Most helpful comment

@mo123 I plan to incorporate the fix into Magisk soon, no worries

All 19 comments

Just to make sure, have you tried toggling MagiskHide off and on in the Manager settings?

have you tried rebooting? my s8 sometimes failed safetynet after a magisk update but would work again after a reboot

Is this still an issue on 19305?

I'll re-test tonight on 19305 and also toggle magiskhide in both the UI and CLI.

Toggling magiskhide off/on on settings worked (on 19305). Sorry for the drama.

Although, actually, I just tried a reboot and it failed again. It seems I have to toggle it in settings after every reboot which doesn't seem right...

That's actually good (and I was kind of hoping for it)... I've seen some reports of having to toggle MagiskHide off and on after every reboot, but so far noone's been bothered to create any proper report for it.

A boot logcat might show more.

Awesome. Maybe you should also edit the title to more closely match the actual issue. Makes it easier for @topjohnwu.

I can build Magisk now so when I get time I'll run through git bisect and try to identify the commit causing the issue.

@alexa-v2 clear the data of Play Store. And also, your issue is unrelated to this one

The breaking commit for me is 4fcdcd9

If I revert that on the latest master(-ish) it works fine.

I'm investigating this further...

I've not compared with the commit reverted but it looks like when magiskhide starts from boot it yields:

proc_monitor: nothing to monitor, wait for signal

And

** late_start service mode running

I see no evidence of it actually starting to ptrace the zygote process. Then when you toggle disable/enable in magiskhide it then immediately starts ptrace'ing the zygote process and things work as expected.

(Don't ask me how this is relevant to the commit highlighted... :-))

I believe this is a race condition where the first call to check_zygotes() in proc_monitor.cpp:proc_monitor() doesn't detect any zygote processes. (Perhaps parsing the packages.xml was "slow enough").

I've created a fix for this with the relevant log output being:

07-02 19:40:09.051   214   222 D Magisk  : hide_list: initialize
07-02 19:40:09.051   214   222 I Magisk  : hide_list init: [com.google.android.gms/com.google.android.gms.unstable]
07-02 19:40:09.061   214   222 I Magisk  : hide_list init: [org.microg.gms.droidguard/com.google.android.gms.unstable]
07-02 19:40:09.070   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:09.277   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:09.492   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.140   214   356 I Magisk  : ** late_start service mode running
07-02 19:40:10.140   214   356 D Magisk  : magiskdb: query magiskhide=[1]
07-02 19:40:10.140   214   356 I Magisk  : * Running service.d scripts
07-02 19:40:10.140   214   356 I Magisk  : * Running module service scripts
07-02 19:40:10.255   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.523   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.737   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.745   214   222 D Magisk  : proc_monitor: ptrace zygote PID=[225]
07-02 19:40:10.955   214   222 D Magisk  : Found initial zygotes!

You can review the fix here and if you'd like a pull request I'm happy to provide one:

https://github.com/topjohnwu/Magisk/compare/master...kmdm:issue_1654

(I'm happy to fix-up the log messages and white-spacing too)

I believe this is a race condition where the first call to check_zygotes() in proc_monitor.cpp:proc_monitor() doesn't detect any zygote processes. (Perhaps parsing the packages.xml was "slow enough").

I've created a fix for this with the relevant log output being:

07-02 19:40:09.051   214   222 D Magisk  : hide_list: initialize
07-02 19:40:09.051   214   222 I Magisk  : hide_list init: [com.google.android.gms/com.google.android.gms.unstable]
07-02 19:40:09.061   214   222 I Magisk  : hide_list init: [org.microg.gms.droidguard/com.google.android.gms.unstable]
07-02 19:40:09.070   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:09.277   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:09.492   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.140   214   356 I Magisk  : ** late_start service mode running
07-02 19:40:10.140   214   356 D Magisk  : magiskdb: query magiskhide=[1]
07-02 19:40:10.140   214   356 I Magisk  : * Running service.d scripts
07-02 19:40:10.140   214   356 I Magisk  : * Running module service scripts
07-02 19:40:10.255   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.523   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.737   214   222 D Magisk  : Looking for initial zygotes...
07-02 19:40:10.745   214   222 D Magisk  : proc_monitor: ptrace zygote PID=[225]
07-02 19:40:10.955   214   222 D Magisk  : Found initial zygotes!

You can review the fix here and if you'd like a pull request I'm happy to provide one:

master...kmdm:issue_1654

(I'm happy to fix-up the log messages and white-spacing too)

Can you provide the update channel command I can use to download Magisk from your repo with your fix included for Magisk Manager Canary build? I can't remember how the custom update channel command works.

@mo123 I plan to incorporate the fix into Magisk soon, no worries

@kmdm is this still an issue for you?

Problem still exists with latest beta for me.

Was this page helpful?
0 / 5 - 0 ratings