kernel: Syncronize upstream changes (#198)
* Cherry-picked range: (kernel)
ebea31daa8..6915b62b9a
* Also merged unmerged pr:
https://github.com/tiann/KernelSU/pull/ 2909
Co-authored-by: Ylarod <me@ylarod.cn>
Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Co-authored-by: u9521 <63995396+u9521@users.noreply.github.com>
Co-authored-by: Wang Han <416810799@qq.com>
This commit is contained in:
@@ -59,6 +59,7 @@ is_ksu_transition(const struct task_security_struct *old_tsec,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void setup_selinux(const char *domain)
|
||||
{
|
||||
if (transive_to_domain(domain)) {
|
||||
@@ -106,7 +107,7 @@ static int __security_secid_to_secctx(u32 secid, struct lsm_context *cp)
|
||||
}
|
||||
static void __security_release_secctx(struct lsm_context *cp)
|
||||
{
|
||||
return security_release_secctx(cp->context, cp->len);
|
||||
security_release_secctx(cp->context, cp->len);
|
||||
}
|
||||
#else
|
||||
#define __security_secid_to_secctx security_secid_to_secctx
|
||||
@@ -139,7 +140,7 @@ bool is_ksu_domain(void)
|
||||
return is_task_ksu_domain(current_cred());
|
||||
}
|
||||
|
||||
bool is_zygote(const struct cred *cred)
|
||||
bool is_context(const struct cred *cred, const char *context)
|
||||
{
|
||||
if (!cred) {
|
||||
return false;
|
||||
@@ -154,11 +155,21 @@ bool is_zygote(const struct cred *cred)
|
||||
if (err) {
|
||||
return false;
|
||||
}
|
||||
result = strncmp("u:r:zygote:s0", ctx.context, ctx.len) == 0;
|
||||
result = strncmp(context, ctx.context, ctx.len) == 0;
|
||||
__security_release_secctx(&ctx);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool is_zygote(const struct cred *cred)
|
||||
{
|
||||
return is_context(cred, "u:r:zygote:s0");
|
||||
}
|
||||
|
||||
bool is_init(const struct cred *cred)
|
||||
{
|
||||
return is_context(cred, "u:r:init:s0");
|
||||
}
|
||||
|
||||
#define KSU_FILE_DOMAIN "u:object_r:ksu_file:s0"
|
||||
|
||||
u32 ksu_get_ksu_file_sid(void)
|
||||
|
||||
Reference in New Issue
Block a user