From: Nick Kralevich Date: Sat, 10 Dec 2016 01:05:09 +0000 (-0800) Subject: service_manager.c: remove is_selinux_enabled calls X-Git-Tag: android-x86-8.1-r1~377^2^2~25^2~74^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=eb4d5cbde02b17259e968321ef457b158ce1da4e;p=android-x86%2Fframeworks-native.git service_manager.c: remove is_selinux_enabled calls SELinux is always enabled. No need to check for it. Test: Device boots and service manager works without errors. Change-Id: I12be7336e7c31a5f5796ea1383f3dc934eb3c97c --- diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c index 68e3ceb8e6..ea4155848b 100644 --- a/cmds/servicemanager/service_manager.c +++ b/cmds/servicemanager/service_manager.c @@ -60,7 +60,6 @@ int str16eq(const uint16_t *a, const char *b) return 1; } -static int selinux_enabled; static char *service_manager_context; static struct selabel_handle* sehandle; @@ -89,10 +88,6 @@ static bool check_mac_perms(pid_t spid, uid_t uid, const char *tctx, const char static bool check_mac_perms_from_getcon(pid_t spid, uid_t uid, const char *perm) { - if (selinux_enabled <= 0) { - return true; - } - return check_mac_perms(spid, uid, service_manager_context, perm, NULL); } @@ -101,10 +96,6 @@ static bool check_mac_perms_from_lookup(pid_t spid, uid_t uid, const char *perm, bool allowed; char *tctx = NULL; - if (selinux_enabled <= 0) { - return true; - } - if (!sehandle) { ALOGE("SELinux: Failed to find sehandle. Aborting service_manager.\n"); abort(); @@ -384,20 +375,17 @@ int main() return -1; } - selinux_enabled = is_selinux_enabled(); sehandle = selinux_android_service_context_handle(); selinux_status_open(true); - if (selinux_enabled > 0) { - if (sehandle == NULL) { - ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n"); - abort(); - } + if (sehandle == NULL) { + ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n"); + abort(); + } - if (getcon(&service_manager_context) != 0) { - ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n"); - abort(); - } + if (getcon(&service_manager_context) != 0) { + ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n"); + abort(); } union selinux_callback cb;