remove devpts hook
This commit is contained in:
@@ -164,30 +164,6 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ksu_handle_devpts(struct inode *inode)
|
|
||||||
{
|
|
||||||
if (!current->mm) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uid_t uid = current_uid().val;
|
|
||||||
if (uid % 100000 < 10000) {
|
|
||||||
// not untrusted_app, ignore it
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ksu_is_allow_uid(uid))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (ksu_devpts_sid) {
|
|
||||||
struct inode_security_struct *sec = selinux_inode(inode);
|
|
||||||
if (sec) {
|
|
||||||
sec->sid = ksu_devpts_sid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
@@ -221,15 +197,6 @@ static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pts_unix98_lookup_pre(struct kprobe *p, struct pt_regs *regs)
|
|
||||||
{
|
|
||||||
struct inode *inode;
|
|
||||||
struct file *file = (struct file *)PT_REGS_PARM2(regs);
|
|
||||||
inode = file->f_path.dentry->d_inode;
|
|
||||||
|
|
||||||
return ksu_handle_devpts(inode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kprobe *init_kprobe(const char *name,
|
static struct kprobe *init_kprobe(const char *name,
|
||||||
kprobe_pre_handler_t handler)
|
kprobe_pre_handler_t handler)
|
||||||
{
|
{
|
||||||
@@ -260,7 +227,7 @@ static void destroy_kprobe(struct kprobe **kp_ptr)
|
|||||||
*kp_ptr = NULL;
|
*kp_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kprobe *su_kps[4];
|
static struct kprobe *su_kps[3];
|
||||||
|
|
||||||
// sucompat: permited process can execute 'su' to gain root access.
|
// sucompat: permited process can execute 'su' to gain root access.
|
||||||
void ksu_sucompat_init()
|
void ksu_sucompat_init()
|
||||||
@@ -268,7 +235,6 @@ void ksu_sucompat_init()
|
|||||||
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
|
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
|
||||||
su_kps[1] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
|
su_kps[1] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
|
||||||
su_kps[2] = init_kprobe(SYS_NEWFSTATAT_SYMBOL, newfstatat_handler_pre);
|
su_kps[2] = init_kprobe(SYS_NEWFSTATAT_SYMBOL, newfstatat_handler_pre);
|
||||||
su_kps[3] = init_kprobe("pts_unix98_lookup", pts_unix98_lookup_pre);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ksu_sucompat_exit()
|
void ksu_sucompat_exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user