#更新 2020.11.30
这个修改方法仅供调试,或者一些展示的需求, 用于量产的软件版本当然不能这么搞,还是得乖乖的抓权限报错,一个个加权限解决。-_-+
#更新 2020.11.30
0. 背景
C:\Users\Administrator>adb shell
sdm660_64:/ # getenforce
getenforce
Enforcing
这个表明Selinux权限存在。
1. 抓开机log
抓一份开机串口log,检索SELinux
[ 7.085097] init: Loading SELinux policy
这句log是重点,从init可以判断这句代码是从system下面找到的。
2 关闭权限
然后我们去grep:
~/android_10/LA.UM.8.6.2$ grep -nr "Loading SELinux policy" ./system/core/
./system/core/init/selinux.cpp:418:
LOG(VERBOSE) << "Loading SELinux policy from monolithic file";
./system/core/init/selinux.cpp:433:
LOG(INFO) << "Loading SELinux policy";
bool IsEnforcing() {
+ return false;
if (ALLOW_PERMISSIVE_SELINUX) {
return StatusFromCmdline() == SELINUX_ENFORCING;
}
return true;
}
在这个函数里面,直接return false即可;debug版本进入ALLOW_PERMISSIVE_SELINUX这个判断,user版本不进入if判断。
C:\Users\Administrator>adb shell
sdm660_64:/ # getenforce
getenforce
Permissive
出现这个log说明Selinux关闭成功了。