Merge changes from topic "bootconfig-selinux-property" am: c19a7dd30e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1624584 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I3f96e5a5ecf093838b48cafdcea82eb673b214b2
This commit is contained in:
commit
aff8b2da5c
1 changed files with 10 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ namespace {
|
||||||
|
|
||||||
enum EnforcingStatus { SELINUX_PERMISSIVE, SELINUX_ENFORCING };
|
enum EnforcingStatus { SELINUX_PERMISSIVE, SELINUX_ENFORCING };
|
||||||
|
|
||||||
EnforcingStatus StatusFromCmdline() {
|
EnforcingStatus StatusFromProperty() {
|
||||||
EnforcingStatus status = SELINUX_ENFORCING;
|
EnforcingStatus status = SELINUX_ENFORCING;
|
||||||
|
|
||||||
ImportKernelCmdline([&](const std::string& key, const std::string& value) {
|
ImportKernelCmdline([&](const std::string& key, const std::string& value) {
|
||||||
|
|
@ -101,12 +101,20 @@ EnforcingStatus StatusFromCmdline() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (status == SELINUX_ENFORCING) {
|
||||||
|
ImportBootconfig([&](const std::string& key, const std::string& value) {
|
||||||
|
if (key == "androidboot.selinux" && value == "permissive") {
|
||||||
|
status = SELINUX_PERMISSIVE;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEnforcing() {
|
bool IsEnforcing() {
|
||||||
if (ALLOW_PERMISSIVE_SELINUX) {
|
if (ALLOW_PERMISSIVE_SELINUX) {
|
||||||
return StatusFromCmdline() == SELINUX_ENFORCING;
|
return StatusFromProperty() == SELINUX_ENFORCING;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue