kernel: don't umount for non zygote child process. fixes #1054,#1049,#1045

This commit is contained in:
weishu
2023-10-19 17:29:02 +08:00
parent 1f1d4d454e
commit ce892bc439
3 changed files with 28 additions and 4 deletions

View File

@@ -27,7 +27,8 @@ static int transive_to_domain(const char *domain)
error = security_secctx_to_secid(domain, strlen(domain), &sid);
if (error) {
pr_info("security_secctx_to_secid %s -> sid: %d, error: %d\n", domain, sid, error);
pr_info("security_secctx_to_secid %s -> sid: %d, error: %d\n",
domain, sid, error);
}
if (!error) {
if (!ksu_sid)
@@ -107,3 +108,18 @@ bool is_ksu_domain()
{
return ksu_sid && current_sid() == ksu_sid;
}
bool is_zygote(void *sec)
{
struct task_security_struct *tsec = (struct task_security_struct *)sec;
if (!tsec) {
return false;
}
char *domain;
u32 seclen;
int err = security_secid_to_secctx(tsec->sid, &domain, &seclen);
if (err) {
return false;
}
return strncmp("u:r:zygote:s0", domain, seclen) == 0;
}