请问什么是kernel domain与init domain?
本文是原「蜗窝讨论区」的历史存档(2017-11-17),来自版块「Linux kernel技术问答」,共 1 帖。讨论区已停止服务,此处仅供查阅。
在android init进程中,有如下一段代码: // Set up SELinux, including loading the SELinux policy if we're in the kernel domain. selinux_initialize(is_first_stage);
// If we're in the kernel domain, re-exec init to transition to the init domain now
// that the SELinux policy has been loaded.
if (is_first_stage) {
if (restorecon("/init") == -1) {
ERROR("restorecon failed: %s\n", strerror(errno));
security_failure(;
}
char* path = argv[0];
char* args[] = { path, const_cast<char*>("--second-stage"), nullptr };
if (execv(path, args) == -1) {
ERROR("execv(\"%s\") failed: %s\n", path, strerror(errno));
security_failure(;
}
}
请问什么是kernel domain与init domain? 此init为什么要执行两次?还请高手帮忙解答,万分感激。
