Android 系统调试(1) 禁止SeLinux

有时候调试需要关闭SElinux , 下面方式可以临时或永久关闭SELinux

方式一: 

adb shell "echo 0 > /sys/fs/selinux/enforce" //设置SELinux 成为permissive模式
adb shell "echo 1 > /sys/fs/selinux/enforce" //设置SELinux 成为enforcing模式 

方式二: 

adb shell setenforce 1 //设置SELinux 成为enforcing模式 
adb shell setenforce 0 //设置SELinux 成为permissive模式 

方式三: 

diff --git a/system/core/init/selinux.cpp b/system/core/init/selinux.cpp
index 438ba7a..8282d83 100755
--- a/system/core/init/selinux.cpp
+++ b/system/core/init/selinux.cpp
@@ -106,7 +106,8 @@ EnforcingStatus StatusFromCmdline() {bool IsEnforcing() {//return false;//add by hxqif (ALLOW_PERMISSIVE_SELINUX) {
-        return StatusFromCmdline() == SELINUX_ENFORCING;
+        //return StatusFromCmdline() == SELINUX_ENFORCING;
+        return StatusFromCmdline() == SELINUX_PERMISSIVE;}return true;}
--- a/system/core/init/service.cpp
+++ b/system/core/init/service.cpp
@@ -86,7 +86,9 @@ static Result ComputeContextFromExecutable(const std::string& servifree(new_con);}if (rc == 0 && computed_context == mycon.get()) {
-        return Error() << "File " << service_path << "(labeled \"" << filecon.get()
+        //return Error() << "File " << service_path << "(labeled \"" << filecon.get()
+               std::ostringstream file_label_err;
+               file_label_err << "File " << service_path << "(labeled \"" << filecon.get()<< "\") has incorrect label or no domain transition from " << mycon.get()<< " to another SELinux domain defined. Have you configured your ""service correctly? https://source.android.com/security/selinux/"


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部