topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
48.02k stars 12.21k forks source link

Android 11 MIUI devices need enabled verification in boot.img AVBv2 signature #4447

Closed qianmo-xw closed 2 years ago

qianmo-xw commented 3 years ago

The Xiaomi device using MT6893 cannot start. After patching the boot, it shows infinite restart. I have disabled the vbmeta test. The models are RedmiNote10Pro and RedmiK40Gaming. I have used magiskboot extra cpio to prompt me that it failed. When I use Android_image_kitchen, the window flashes and nothing is unpacked. I think his boot has been specially encrypted. If you need it, I will upload the boot file for the study... Device: RedmiNote10Pro Android version:11 Magisk version name: V23 Magisk version code: 23001

muddpunk commented 3 years ago

I literally can't get in to safe mode. I just keep getting thrown in to fastboot no matter what timings i try 😅

muddpunk commented 3 years ago

Is it possible I can't reach safe mode because it doesn't get to the MIUI animation?

pndwal commented 3 years ago

Could be different on MTK. I got black screen / restart if held pwr button too long, and did also end up in Fastboot somehow.

What worked for me was not to wait for animation as Imentioned. Static MI or Redmi logo lasts about 15 seconds, then I get MIUI or LineageOS animation. I release pwr and immediately hold vol- at about 4 seconds in, well before boot animation, and continue holding till safe mode is booted. This consistently lands me in Magisk detected Safe Mode confirmed by disabled MagiskHide on next system boot. Hope it helps.

muddpunk commented 3 years ago

Yeah see I tried that too, but it's never made it to any boot animation at all. Unfortunately I can't test anything else today, but I have grabbed the alpha release that was mentioned above and I'll try again tomorrow. If not, I might have to revert back to android 10, install twrp with an older magisk again and disable the modules like that 🤷

muddpunk commented 3 years ago

Just realised I can't go back on firmware without completely wiping and doing it fresh. So I've backed everything up and I'm going to clean install A11 and try magisk again. If it works this time round, I guess most issues probably stem from previous modules.

carey036 commented 3 years ago

Just realised I can't go back on firmware without completely wiping and doing it fresh. So I've backed everything up and I'm going to clean install A11 and try magisk again. If it works this time round, I guess most issues probably stem from previous modules.

have ever try to replace "0000000300000000617662746F6F6C20" to "0000000000000000617662746F6F6C20" in hexadecimal

muddpunk commented 3 years ago

have ever try to replace "0000000300000000617662746F6F6C20" to "0000000000000000617662746F6F6C20" in hexadecimal

No. However, a fresh clean install of the same rom has allowed magisk to finally work. Had to of been the modules for sure right?

pndwal commented 3 years ago

Had to of been the modules for sure right?

Well, data/adb/magisk.db could have been corrupted, but less likely.

osm0sis commented 3 years ago

Did @qianmo-xw ever even confirm that hexpatching workaround resolved the issue on their device?

carey036 commented 3 years ago

Did @qianmo-xw ever even confirm that hexpatching workaround resolved the issue on their device?

i built modified magisk in this repo, and shared the apk in coolapk, there were hundred of times download and tested well.

i also have a k40g and it is ok with this magisk.

aviraxp commented 3 years ago

It turns out that this hexpatch is exactly to revert the magiskboot change that disables these 2 AVB flags which is done in https://github.com/topjohnwu/Magisk/blob/439d497a13c73a9ffa5f5a9a2575d1ecc7501858/native/jni/magiskboot/bootimg.cpp#L740 to disable verfication and verity.

The issue is, why do we have to undo this patch?

osm0sis commented 3 years ago

The bootloader doesn't like it I guess. One thing of concern is that it's not only MTK devices, as @DarthJabba9 has confirmed the issue on his Xiaomi and POCO devices too, running both stock MIUI and custom ROMs, and not on MTK hardware.

qianmo-xw commented 3 years ago

Did @qianmo-xw ever even confirm that hexpatching workaround resolved the issue on their device?

Sorry,I haven't paid attention to this issue for a long time. It turns out that hexpatching is effective, although I don't know what his principle is. So should I close this question?

ahxxm commented 3 years ago

the 03->00 hack patch works for me too, Redmi note8 pro with MIUI EEA 12.5.3.0

osm0sis commented 3 years ago

Leave it open. There is an issue with the AVBv2 signature patching that magiskboot does.

osm0sis commented 2 years ago

This should fix it once merged, try the apk-debug.apk in the Artifacts zip: https://github.com/topjohnwu/Magisk/actions/runs/1432894612

Gong-Mi commented 2 years ago

This should fix it once merged, try the apk-debug.apk in the Artifacts zip: https://github.com/topjohnwu/Magisk/actions/runs/1432894612

可以ota 升级系统吗 我没有第3方rec

Can you update it with the ota method 。
I don't like rec

Gong-Mi commented 2 years ago

This should fix it once merged, try the apk-debug.apk in the Artifacts zip: https://github.com/topjohnwu/Magisk/actions/runs/1432894612

可以添加虚拟还原原厂boot吗 联发科貌似不喜欢系统里面替换。

Can you help me add a simulated uninstall boot ? MediaTek does not seem to like the boot used by the system replacement 。

Gong-Mi commented 2 years ago

This should fix it once merged, try the apk-debug.apk in the Artifacts zip: https://github.com/topjohnwu/Magisk/actions/runs/1432894612

使用了 Screenshot_2021-11-08-12-05-43-108_com.topjohnwu.magisk.jpg Screenshot_2021-11-08-12-08-54-519_com.topjohnwu.magisk.jpg

osm0sis commented 2 years ago

Try this one as well to test @Fox2Code's theory in #4906 please: https://github.com/topjohnwu/Magisk/actions/runs/1435283509

Gong-Mi commented 2 years ago

Try this one as well to test @Fox2Code's theory in #4906 please: https://github.com/topjohnwu/Magisk/actions/runs/1435283509

Well, after all, it didn't merge into the mainstream

osm0sis commented 2 years ago

Neither did the last one you tried, but this solution may be more universal.

This is still POC as we have not many information about the issue, I theorized that MIUI on Android11 crashed due to the lack of avb flags due to the 0x2 flag being set. The 0x1 disable most checks already, and should be enough for most devices.

Note: please restore stock image before trying this build, the fix target MIUI Android 11 users, but any other device owner are welcome to test the changes included in this PR to check for any regressions.

Gong-Mi commented 2 years ago

Neither did the last one you tried, but this solution may be more universal.

This is still POC as we have not many information about the issue, I theorized that MIUI on Android11 crashed due to the lack of avb flags due to the 0x2 flag being set. The 0x1 disable most checks already, and should be enough for most devices.

Note: please restore stock image before trying this build, the fix target MIUI Android 11 users, but any other device owner are welcome to test the changes included in this PR to check for any regressions.

I think

Problem: there is a problem with the official Android 12 internal test

I can only test and modify boot

Gong-Mi commented 2 years ago

Neither did the last one you tried, but this solution may be more universal.

This is still POC as we have not many information about the issue, I theorized that MIUI on Android11 crashed due to the lack of avb flags due to the 0x2 flag being set. The 0x1 disable most checks already, and should be enough for most devices.

Note: please restore stock image before trying this build, the fix target MIUI Android 11 users, but any other device owner are welcome to test the changes included in this PR to check for any regressions.

大失败 0100000000617662746F6F6C20 不行
9b5185bb不能通过开机

fail 0100000000617662746F6F6C20 No boot. For mtk1200,

9b5185bb failed the acceptance.

Gong-Mi commented 2 years ago

Neither did the last one you tried, but this solution may be more universal.

This is still POC as we have not many information about the issue, I theorized that MIUI on Android11 crashed due to the lack of avb flags due to the 0x2 flag being set. The 0x1 disable most checks already, and should be enough for most devices.

Note: please restore stock image before trying this build, the fix target MIUI Android 11 users, but any other device owner are welcome to test the changes included in this PR to check for any regressions.

Test version official stable version system-Android 11

osm0sis commented 2 years ago

I think this needs to remain open until there's a way to toggle KEEPVBMETAFLAG in the app 🤔

Gong-Mi commented 2 years ago

I think this needs to remain open until there's a way to toggle KEEPVBMETAFLAG in the app 🤔

Thank you

I want to know if it's finished.

Gong-Mi commented 2 years ago

I think this needs to remain open until there's a way to toggle KEEPVBMETAFLAG in the app 🤔

https://github.com/topjohnwu/Magisk/pull/4975#pullrequestreview-815341698

Screenshot_2021-11-25-04-13-49-818_com.topjohnwu.magisk.jpg

All that's missing is an introduction to the new features. Other than that, perfect.

Gong-Mi commented 2 years ago

the latest

https://github.com/topjohnwu/Magisk/pull/5028

osm0sis commented 2 years ago

Shit, now OnePlus 9 Pro needs it set to 00 as well, now that OPPO has merged OOS into ColorOS. 😢😒

Upside is I can test things first-hand now.

yujincheng08 commented 2 years ago

ui is done. could be closed