Merge changes from topic "bootconfig-selinux-property"
* changes: Allow selinux to be set by bootconfig Allow android_dt_dir to be set by bootconfig
This commit is contained in:
commit
c19a7dd30e
2 changed files with 19 additions and 2 deletions
|
|
@ -92,7 +92,7 @@ namespace {
|
|||
|
||||
enum EnforcingStatus { SELINUX_PERMISSIVE, SELINUX_ENFORCING };
|
||||
|
||||
EnforcingStatus StatusFromCmdline() {
|
||||
EnforcingStatus StatusFromProperty() {
|
||||
EnforcingStatus status = SELINUX_ENFORCING;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool IsEnforcing() {
|
||||
if (ALLOW_PERMISSIVE_SELINUX) {
|
||||
return StatusFromCmdline() == SELINUX_ENFORCING;
|
||||
return StatusFromProperty() == SELINUX_ENFORCING;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -376,6 +376,15 @@ static std::string init_android_dt_dir() {
|
|||
android_dt_dir = value;
|
||||
}
|
||||
});
|
||||
// ..Or bootconfig
|
||||
if (android_dt_dir == kDefaultAndroidDtDir) {
|
||||
ImportBootconfig([&](const std::string& key, const std::string& value) {
|
||||
if (key == "androidboot.android_dt_dir") {
|
||||
android_dt_dir = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
LOG(INFO) << "Using Android DT directory " << android_dt_dir;
|
||||
return android_dt_dir;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue