From 1a191bf54d4a77edd0fc5203141ab67a84936e62 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Wed, 2 Oct 2019 16:23:32 +0800 Subject: [PATCH] Support loading system_ext_property_contexts Commit I27dd391fc06a3c78e88a65c7931c84de1699f157 makes property_service no longer load selinux property_contexts by function selinux_android_prop_context_handle. So we should load property_contexts from /system_ext as well in property_service.cpp. Bug: 137712473 Bug: 141871131 Test: `adb shell getprop -Z` to check system_ext_property_contexts is loaded Change-Id: I49c5c725784c0d598062ae356be6226446f4942a --- init/property_service.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/property_service.cpp b/init/property_service.cpp index f5d1143ca..d7e402175 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -963,6 +963,10 @@ void CreateSerializedPropertyInfo() { // Don't check for failure here, so we always have a sane list of properties. // E.g. In case of recovery, the vendor partition will not have mounted and we // still need the system / platform properties to function. + if (access("/system_ext/etc/selinux/system_ext_property_contexts", R_OK) != -1) { + LoadPropertyInfoFromFile("/system_ext/etc/selinux/system_ext_property_contexts", + &property_infos); + } if (!LoadPropertyInfoFromFile("/vendor/etc/selinux/vendor_property_contexts", &property_infos)) { // Fallback to nonplat_* if vendor_* doesn't exist. @@ -980,6 +984,7 @@ void CreateSerializedPropertyInfo() { if (!LoadPropertyInfoFromFile("/plat_property_contexts", &property_infos)) { return; } + LoadPropertyInfoFromFile("/system_ext_property_contexts", &property_infos); if (!LoadPropertyInfoFromFile("/vendor_property_contexts", &property_infos)) { // Fallback to nonplat_* if vendor_* doesn't exist. LoadPropertyInfoFromFile("/nonplat_property_contexts", &property_infos);