Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d69f6b6f authored by Nick Kralevich's avatar Nick Kralevich Committed by Android Git Automerger
Browse files

am 38fd5650: am 82015d4f: Merge "Only allow disabling SELinux on userdebug / eng builds"

* commit '38fd5650':
  Only allow disabling SELinux on userdebug / eng builds
parents 8f4ac8e1 38fd5650
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ LOCAL_CFLAGS += -DBOOTCHART=1
endif
endif


ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
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
endif


# Enable ueventd logging
# Enable ueventd logging
+4 −0
Original line number Original line Diff line number Diff line
@@ -868,6 +868,7 @@ void selinux_init_all_handles(void)


static bool selinux_is_disabled(void)
static bool selinux_is_disabled(void)
{
{
#ifdef ALLOW_DISABLE_SELINUX
    char tmp[PROP_VALUE_MAX];
    char tmp[PROP_VALUE_MAX];


    if (access("/sys/fs/selinux", F_OK) != 0) {
    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. */
        /* SELinux is compiled into the kernel, but we've been told to disable it. */
        return true;
        return true;
    }
    }
#endif


    return false;
    return false;
}
}


static bool selinux_is_enforcing(void)
static bool selinux_is_enforcing(void)
{
{
#ifdef ALLOW_DISABLE_SELINUX
    char tmp[PROP_VALUE_MAX];
    char tmp[PROP_VALUE_MAX];


    if (property_get("ro.boot.selinux", tmp) == 0) {
    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);
        ERROR("SELinux: Unknown value of ro.boot.selinux. Got: \"%s\". Assuming enforcing.\n", tmp);
    }
    }


#endif
    return true;
    return true;
}
}