summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2014-06-03 16:43:10 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-03 16:43:10 +0000
commitd69f6b6f7a31d753804363f3427aa7f1131618cc (patch)
tree30b374eed941c14c44c3095aeaa7d3d7872a5ab7 /init
parent8f4ac8e1d3349170f319526e8cfcb036db954ee4 (diff)
parent38fd5650ea03b1f47ead2a12a655298ef2f70a91 (diff)
downloadsystem_core-d69f6b6f7a31d753804363f3427aa7f1131618cc.zip
system_core-d69f6b6f7a31d753804363f3427aa7f1131618cc.tar.gz
system_core-d69f6b6f7a31d753804363f3427aa7f1131618cc.tar.bz2
am 38fd5650: am 82015d4f: Merge "Only allow disabling SELinux on userdebug / eng builds"
* commit '38fd5650ea03b1f47ead2a12a655298ef2f70a91': Only allow disabling SELinux on userdebug / eng builds
Diffstat (limited to 'init')
-rw-r--r--init/Android.mk2
-rw-r--r--init/init.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/init/Android.mk b/init/Android.mk
index 15a23be..489dc93 100644
--- a/init/Android.mk
+++ b/init/Android.mk
@@ -25,7 +25,7 @@ LOCAL_CFLAGS += -DBOOTCHART=1
endif
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1
+LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1
endif
# Enable ueventd logging
diff --git a/init/init.c b/init/init.c
index 7ba25dc..c79929b 100644
--- a/init/init.c
+++ b/init/init.c
@@ -868,6 +868,7 @@ void selinux_init_all_handles(void)
static bool selinux_is_disabled(void)
{
+#ifdef ALLOW_DISABLE_SELINUX
char tmp[PROP_VALUE_MAX];
if (access("/sys/fs/selinux", F_OK) != 0) {
@@ -881,12 +882,14 @@ static bool selinux_is_disabled(void)
/* SELinux is compiled into the kernel, but we've been told to disable it. */
return true;
}
+#endif
return false;
}
static bool selinux_is_enforcing(void)
{
+#ifdef ALLOW_DISABLE_SELINUX
char tmp[PROP_VALUE_MAX];
if (property_get("ro.boot.selinux", tmp) == 0) {
@@ -903,6 +906,7 @@ static bool selinux_is_enforcing(void)
ERROR("SELinux: Unknown value of ro.boot.selinux. Got: \"%s\". Assuming enforcing.\n", tmp);
}
+#endif
return true;
}