topjohnwu / Magisk

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

MagiskHide Improvement (?) #462

Closed DenyDarko closed 6 years ago

DenyDarko commented 6 years ago

Hey John,

Based on the information of following thread: https://forum.xda-developers.com/apps/magisk/module-safetypatcher-t3809879

I've extracted the data from /proc/cmdline and indeed there is a line "androidboot.verifiedbootstate=orange" which clearly states an unlocked bootloader. Also, there is another one "androidboot.vbmeta.device_state=unlocked".

I wonder if Magiskhide can be improved to make those valuse return "green" and "locked" accordingly.

PS: At least in my case, I had to be root to access cmdline as it's permissions is 444 root:radio but don't know what's the case with other devices (or what belongs to the radio group with read access to the cmdline) , and that's why I'm opening this issue.

topjohnwu commented 6 years ago

@DenyDarko /proc/cmdline is a character file, and its content directly reads out from the kernel, and the kernel got these values directly from the bootloader. It is impossible to change it unless you modify your kernel to specifically remove these flags (many custom kernels do). However, /proc/cmdline is intentionally made unreadable in Android for security purpose. The entries you mentioned will be read by /init and transformed to read-only properties (e.g. ro.boot.verifiedbootstate). Magisk is capable of altering the ro props, that's how (a little part of) MagiskHide works.