kernel: avoding other root process being kprobed
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#define KERNEL_SU_DOMAIN "u:r:su:s0"
|
||||
|
||||
static u32 ksu_sid;
|
||||
|
||||
static int transive_to_domain(const char* domain) {
|
||||
struct cred* cred;
|
||||
struct task_security_struct* tsec;
|
||||
@@ -35,6 +37,8 @@ static int transive_to_domain(const char* domain) {
|
||||
error = security_secctx_to_secid(domain, strlen(domain), &sid);
|
||||
pr_info("error: %d, sid: %d\n", error, sid);
|
||||
if (!error) {
|
||||
if (!ksu_sid) ksu_sid = sid;
|
||||
|
||||
tsec->sid = sid;
|
||||
tsec->create_sid = 0;
|
||||
tsec->keycreate_sid = 0;
|
||||
@@ -97,4 +101,8 @@ bool getenforce() {
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_ksu_domain() {
|
||||
return ksu_sid && current_sid() == ksu_sid;
|
||||
}
|
||||
Reference in New Issue
Block a user