!2684 加载selinux前检测cgroupv1的创建是否完成

Merge pull request !2684 from wenrui/master
This commit is contained in:
openharmony_ci 2024-03-30 06:37:27 +00:00 committed by Gitee
commit 5f43d3bdf7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -292,6 +292,14 @@ void SystemConfig(const char *uptime)
RegisterBootStateChange(BootStateChange);
INIT_LOGI("boot stage: init finish.");
// The cgroupv1 hierarchy may be created asynchronously in the early stage,
// so make sure it has been done before loading SELinux.
struct stat sourceInfo = {0};
if (stat("/dev/cgroup", &sourceInfo) == 0) {
WaitForFile("/dev/memcg/procs", WAIT_MAX_SECOND);
}
// load SELinux context and policy
// Do not move position!
PluginExecCmdByName("loadSelinuxPolicy", "");