axonasif / rusty-magisk

Magisk support layer for android-x86
GNU General Public License v2.0
32 stars 6 forks source link

emulate magisk boot process wrong #6

Open HuskyDG opened 2 years ago

HuskyDG commented 2 years ago

Rusty-magisk don't stop boot process if magisk in post-fs-data are not completed

Follow topjohnwu's Magisk Documentation, in post-fs-data stage, boot process must be stopped until all Magisk jobs are completed or 40 seconds timeout is reached.

Also the road from post-fs-data to late_start happened in very short time and magisk post-fs-data jobs may not be completed yet, maybe there are processing post-fs-data module script but late_start was triggered. That can make some modules cannot be working well if the user install many module

Compare init.rc between Magisk on my phone and init.rc in rusty-magisk.

IMG_20220112_115230_903

IMG_20220112_115156_749

HuskyDG commented 2 years ago

https://github.com/topjohnwu/Magisk/issues/3760

https://github.com/RikkaApps/Riru/issues/287

axonasif commented 2 years ago

Thanks for sharing your insights, I will look into it when I can.

hmtheboy154 commented 2 years ago

This was koushsu init.rc implementation and @axonasif use it back in Magisk 21.x days, it used to work but now isn't anymore. He can't check because he don't have a device to test so I'll modify the init and see if it boot on my PS-x86 build when I have time. Thanks for reminding us about this

HuskyDG commented 2 years ago

Find a way (Use u:r:su:s0) to patch sepolicy and allow magisk domain to be permissive (do all thing). Then launch magisk in u:r:magisk:s0 selinux context

In Topjohnwu's emulator.sh:

ln -sf ./magiskinit magiskpolicy
if [ -f /vendor/etc/selinux/precompiled_sepolicy ]; then
  ./magiskpolicy --load /vendor/etc/selinux/precompiled_sepolicy --live --magisk 2>&1
elif [ -f /sepolicy ]; then
  ./magiskpolicy --load /sepolicy --live --magisk 2>&1
else
  ./magiskpolicy --live --magisk 2>&1
fi
hmtheboy154 commented 2 years ago

There's already one Also we already in permissive, just need to patch Magisk in.

HuskyDG commented 2 years ago

There's already one Also we already in permissive, just need to patch Magisk in.

Oh i noticed that almost emulator has Permissive Selinux mode