Revert "Treat Microdroid as OS with monolithic sepolicy"

Revert submission 2625691

Reason for revert: b/287283650

Reverted changes: /q/submissionid:2625691

Change-Id: Ie62bbb4d4f1af528f42aafde79407b151bab46f9
This commit is contained in:
Pawan Wagh 2023-06-14 18:28:17 +00:00 committed by Gerrit Code Review
parent 94ef7122d6
commit 85f52dd1ac

View file

@ -300,8 +300,6 @@ bool GetVendorMappingVersion(std::string* plat_vers) {
}
constexpr const char plat_policy_cil_file[] = "/system/etc/selinux/plat_sepolicy.cil";
constexpr const char kMicrodroidPrecompiledSepolicy[] =
"/system/etc/selinux/microdroid_precompiled_sepolicy";
bool IsSplitPolicyDevice() {
return access(plat_policy_cil_file, R_OK) != -1;
@ -499,19 +497,14 @@ bool OpenSplitPolicy(PolicyFile* policy_file) {
bool OpenMonolithicPolicy(PolicyFile* policy_file) {
static constexpr char kSepolicyFile[] = "/sepolicy";
// In Microdroid the precompiled sepolicy is located on /system, since there is no vendor code.
// TODO(b/287206497): refactor once we start conditionally compiling init for Microdroid.
std::string monolithic_policy_file = access(kMicrodroidPrecompiledSepolicy, R_OK) == 0
? kMicrodroidPrecompiledSepolicy
: kSepolicyFile;
LOG(INFO) << "Opening SELinux policy from monolithic file " << monolithic_policy_file;
policy_file->fd.reset(open(monolithic_policy_file.c_str(), O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
LOG(VERBOSE) << "Opening SELinux policy from monolithic file";
policy_file->fd.reset(open(kSepolicyFile, O_RDONLY | O_CLOEXEC | O_NOFOLLOW));
if (policy_file->fd < 0) {
PLOG(ERROR) << "Failed to open monolithic SELinux policy";
return false;
}
policy_file->path = monolithic_policy_file;
policy_file->path = kSepolicyFile;
return true;
}