From 0d229dac3b0f6155904d986799580524b726e9e0 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 21 Feb 2020 00:49:33 -0800 Subject: [PATCH] Support Android 11 SELinux paths This is NOT proper Android 11 support --- native/jni/magiskpolicy/policydb.cpp | 8 ++++++++ native/jni/utils/include/selinux.h | 1 + 2 files changed, 9 insertions(+) diff --git a/native/jni/magiskpolicy/policydb.cpp b/native/jni/magiskpolicy/policydb.cpp index c446816cc..14730faaf 100644 --- a/native/jni/magiskpolicy/policydb.cpp +++ b/native/jni/magiskpolicy/policydb.cpp @@ -83,6 +83,14 @@ static bool check_precompiled(const char *precompiled) { return false; } + actual_sha = SYSEXT_POLICY_DIR "system_ext_sepolicy_and_mapping.sha256"; + if (access(actual_sha, R_OK) == 0) { + ok = true; + sprintf(compiled_sha, "%s.system_ext_sepolicy_and_mapping.sha256", precompiled); + if (!cmp_sha256(actual_sha, compiled_sha) != 0) + return false; + } + return ok; } diff --git a/native/jni/utils/include/selinux.h b/native/jni/utils/include/selinux.h index 806d68458..3df8c06ec 100644 --- a/native/jni/utils/include/selinux.h +++ b/native/jni/utils/include/selinux.h @@ -13,6 +13,7 @@ #define VEND_POLICY_DIR "/vendor/etc/selinux/" #define PROD_POLICY_DIR "/product/etc/selinux/" #define ODM_POLICY_DIR "/odm/etc/selinux/" +#define SYSEXT_POLICY_DIR "/system_ext/etc/selinux/" #define SPLIT_PLAT_CIL PLAT_POLICY_DIR "plat_sepolicy.cil" #define SEPOL_PROC_DOMAIN "magisk"