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"