[OnePlus 3T Guides, News, & Discussion] Xennet:
Knowledge is always good and Xda is the best place to share it.. So here it is...

This is important for those interested in depth reading and for those who casually use xda to just download and use stuff because it gonna affect you all...

It all begins with the boot.img file which is located inside the Oxygen OS ROM zip file. The Boot image file can be practically for learning purpose be broken down to ramdisk, kernel and dtb(device tree blob) files.

The importance of all this is that from Oreo onwards Oneplus just shifted the fstab entry(in which the code triggering dm-verity is located) into the dtb file rather than in the ramdisk which becomes a little hard to edit rather than while being in the ramdisk.

So the essential steps being unpacking dtb file from the boot image, then editing the code triggering the dm-verity in the dtb file and then repacking the dtb into the boot image file again. Seems simple but its rather difficult...

The dtb file extracted from the boot image file in fact can be further split into 13 dtb dumps, 12 of which having an fstab entry that triggers dm-verity and each has to patched individually and then combined to a single dtb file and then repacked to the boot image....

So what is important is...

The original code in dtb file by Oneplus in the boot image file after decompiling and analysing by the dtc(device tree compiler) is :

fstab {
compatible = "android,fstab";

system {
compatible = "android,system";
dev = "/dev/block/platform/soc/624000.ufshc/by-name/system";
type = "ext4";
mnt_flags = "ro,barrier=1,discard";
fsmgr_flags = "wait,verify";
status = "ok";
};
};

The line fsmgr_flags = "wait,verify"; should be changed to fsmgr_flags = "wait" to avoid triggering dm verity.

So lets see...

What Magisk does... After analysing the patched boot image by magisk 14.5, 14.6 and 15.0 the Fstab entry in the dtb file looks like this:

fstab {
compatible = "android,fstab";

system {
compatible = "android,system";
dev = "/dev/block/platform/soc/624000.ufshc/by-name/system";
type = "ext4";
mnt_flags = "ro,barrier=1,discard";
fsmgr_flags = <0x77616974 0x0 0x0>;
status = "ok";
};
};

The problem is that magisk searches for the hex code for --->,verify and then replaces it with zero bytes....that efficiently disables the dm verity check in fs tab but the line fsmgr_flags = <0x77616974 0x0 0x0>; makes no sense...but when you translate the hex:77616974 to ASCII it becomes "wait". But whether this has any impilcations on the system or performance. I just simply dont know....

And I just couldn't analyse the dtb file produced by Magisk 15.1 as it fails to patch the dtb file in the boot image completely...just giving an error as Segmentation fault...This is well noticed as you cannot see the line stating that patching fstab in dtb file is conspicuously absent when you flash Magisk 15.1.. and hence Magisk 15.1 fails to clear the dm verity flag in the boot image...This can be ascertained by many who reported that they triggered dm verity today as they flashed Magisk 15.1 after flashing the ROM zip file in the Open Beta thread for oneplus 3T on XDA. But many didn't notice it as they just flashed Magisk 15/14.6 and then upgraded Magisk to 15.1 as the earlier versions as stated above took care of dm verity...

I have to say Magisk is one of the wonders in modern day android era and the statements i have given above is just observations and are really not meant to degrade or hurt the dev or anyone associated with magisk. [MENTION=4470081]topjohnwu[/MENTION] will already be knowing the issue as he is one hell of a developer and will definitely be correcting it...

Coming to SuperSu..This is what SuperSu does after patching the dtb file...

fstab {
compatible = "android,fstab";

system {
fsmgr_flags = "wait";
mnt_flags = "ro,barrier=1,discard";
type = "ext4";
dev = "/dev/block/platform/soc/624000.ufshc/by-name/system";
};

Now here the line fsmgr_flags = "wait"; is good but the line --->status = "ok"; is completely missing as SuperSu appends the line after the word "wait" in the fstab...And now whether this has any implications too whther I really dont know butit too does the job of removing dm-verity triggering...

Post a tiring study through all this I finally managed to patch the Oneplus boot image to as good as possible. I manually unpacked the boot image to dtb. The split the combined dtb to individual dtbs and the removed the line of code manually and the repacked the whole thing again to the original Boot image.

The dtb file in My Patched boot image looks like this after analysing with dtc.. And achieves the desired result...and perfectly avoids triggering dm-verity without causing any untoward effects in the fstab section in dtb file.

fstab {
compatible = "android,fstab";

system {
compatible = "android,system";
dev = "/dev/block/platform/soc/624000.ufshc/by-name/system";
type = "ext4";
mnt_flags = "ro,barrier=1,discard";
fsmgr_flags = "wait";
status = "ok";
};

Now the real question,

What will happen if you flash my patched boot image and then ,

---> When you flash Magisk after flashing my patched boot image it does nothing because it fails to identify the hex code for ",verify" as there is no such word/hex code in my boot.img file so it doesn't change anything to the fstab section in the dtb file in my patched boot image and so there no untoward effects in the code...

--->When you flash SuperSu, but, it still appends the line after "wait" in the dtb file in my patched boot image too and results in removal of the line status = "ok";.

Earlier Boot images posted in the OP, I too patched the hexcodes using a hex editor in the binary dtb file resulting in results in fstab section of dtb file like Magisk...

Now on I will manually patch each boot image file to produce the fstab file with no other alterations done in the dtb file so that there will never be any problems after flashing the patched boot images....