Android Customizing SePolicy: Difference between revisions
No edit summary |
|||
Line 40: | Line 40: | ||
===Compile U-Boot=== | ===Compile U-Boot=== | ||
Compile the new U-Boot | Compile the new U-Boot | ||
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}} | |||
$ source build/envsetup.sh | |||
$ lunch {{#var:ANDROID_MACHINE_NAME}}-userdebug | |||
$ make bootloader | |||
===Update U-Boot=== | ===Update U-Boot=== |
Revision as of 02:51, 23 January 2020
Overview
SELinux is the Security Enhanced Linux concept to enhance the Android Security and have the controlled access to the files.
Please refer to https://source.android.com/security/selinux for more detailed concepts.
Bringup Stages and SELinux Permissive
Despite SELinux enforcement from Android 7.1.1 and onwards, you may want to access certain device nodes / have the application to be able to control the hardware.
We recommend building the proper sepolicy by following https://source.android.com/security/selinux/build
This requires SELinux to be set to permissive mode.
Refer to https://source.android.com/security/selinux/validate how to validate and remove the proper filecontext and Sepolicy in place.
You will mostly see below output when avc daemon blocks access to certain files especially applications.
$adb shell su root dmesg | grep 'avc: ' type=1400 audit: avc: denied { read write } for pid=177
SELinux enforcement can be disabled via ADB on userdebug or eng builds. To do so, first switch ADB to root by running adb root. Then, to disable SELinux enforcement, run:
$adb shell setenforce 0
Or at the kernel command line (during early device bring-up):
androidboot.selinux=permissive
Setting the permission in Boot image
Edit U-Boot command line arguments
https://github.com/varigit/uboot-imx/blob/n7.1.1_1.0.0_ga_var01/
Change following macro
#define CONFIG_EXTRA_ENV_SETTINGS \ "bootargs=" \ ....... ....\0"
And append "androidboot.selinux=permissive\0" to the kernel
#define CONFIG_EXTRA_ENV_SETTINGS \ "bootargs=" \ ....... androidboot.selinux=permissive\0"
Compile U-Boot
Compile the new U-Boot
$ cd ~/var_n_711_100/n_711_100_build $ source build/envsetup.sh $ lunch -userdebug $ make bootloader
Update U-Boot
Flash the binaries following Android Recovery SD card and replacing your binaries in /opt/images/Android/
The updated U-Boot should have the SeLinux in permissive mode.