Magisk/native/jni
topjohnwu a1b5185ecb Make sure rootfs file selabels are correct
Android Q init assumes rootfs to always be on EXT4 images, thus
never runs restorecon on the whole root directory. This is an issue
because some folders in rootfs were set with special selabels in
the system partition, but when copying over to initramfs by magiskinit,
these labels will not be preserved.

So the solution is to relabel the files in rootfs with the original
context right? Yes, but rootfs does not allow security xattr to be set
on files before the kernel SELinux initializes with genfs_contexts.
We have to load our sepolicy to the kernel before we clone the root
directory from system partition, which we will also restore the selabel
in the meantime.

Unfortunately this means that for each reboot, the exact same policy
will be loaded to the kernel twice: once in magiskinit so we can label
rootfs properly, and once by the original init, which is part of the
boot procedure. There is no easy way to prevent init from loading
sepolicy, as init will refuse to continue if policy loading has failed.
2019-03-14 22:27:29 -04:00
..
core Make sure rootfs file selabels are correct 2019-03-14 22:27:29 -04:00
external Build libsqlite.so only with magisk 2019-03-07 05:21:27 -05:00
include Make sure rootfs file selabels are correct 2019-03-14 22:27:29 -04:00
magiskboot Support boot_img_hdr_v2 2019-03-13 16:51:22 -04:00
magiskhide Don't crash when encounter unexpected XML input 2019-03-12 17:19:29 -04:00
magiskpolicy Remove unnecessary rules 2019-03-08 04:21:23 -05:00
resetprop Make parse prop file a util function 2019-03-05 20:27:09 -05:00
su Use our own function to parse int 2019-03-07 20:31:35 -05:00
systemproperties Some code adjustments 2019-02-24 23:09:34 -05:00
utils Improve builtin selinux implementation 2019-03-14 06:34:22 -04:00
Android.mk Welcome to the 64 bit world! 2019-02-24 08:13:27 -05:00
Application.mk Compiler flag enhancements 2019-02-26 03:42:44 -05:00