kernel: remove devpts hook
This commit is contained in:
@@ -318,12 +318,6 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dummified
|
|
||||||
int ksu_handle_devpts(struct inode *inode)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __ksu_handle_devpts(struct inode *inode)
|
int __ksu_handle_devpts(struct inode *inode)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -390,54 +384,6 @@ static void sucompat_sys_enter_handler(void *data, struct pt_regs *regs,
|
|||||||
|
|
||||||
#endif // KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
|
#endif // KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
|
||||||
|
|
||||||
#ifdef KSU_KPROBES_HOOK
|
|
||||||
|
|
||||||
static int pts_unix98_lookup_pre(struct kprobe *p, struct pt_regs *regs)
|
|
||||||
{
|
|
||||||
struct inode *inode;
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
|
|
||||||
struct file *file = (struct file *)PT_REGS_PARM2(regs);
|
|
||||||
inode = file->f_path.dentry->d_inode;
|
|
||||||
#else
|
|
||||||
inode = (struct inode *)PT_REGS_PARM2(regs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ksu_handle_devpts(inode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kprobe *init_kprobe(const char *name,
|
|
||||||
kprobe_pre_handler_t handler)
|
|
||||||
{
|
|
||||||
struct kprobe *kp = kzalloc(sizeof(struct kprobe), GFP_KERNEL);
|
|
||||||
if (!kp)
|
|
||||||
return NULL;
|
|
||||||
kp->symbol_name = name;
|
|
||||||
kp->pre_handler = handler;
|
|
||||||
|
|
||||||
int ret = register_kprobe(kp);
|
|
||||||
pr_info("sucompat: register_%s kprobe: %d\n", name, ret);
|
|
||||||
if (ret) {
|
|
||||||
kfree(kp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroy_kprobe(struct kprobe **kp_ptr)
|
|
||||||
{
|
|
||||||
struct kprobe *kp = *kp_ptr;
|
|
||||||
if (!kp)
|
|
||||||
return;
|
|
||||||
unregister_kprobe(kp);
|
|
||||||
synchronize_rcu();
|
|
||||||
kfree(kp);
|
|
||||||
*kp_ptr = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct kprobe *pts_kp = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_KRETPROBES
|
#ifdef CONFIG_KRETPROBES
|
||||||
|
|
||||||
static struct kretprobe *init_kretprobe(const char *name,
|
static struct kretprobe *init_kretprobe(const char *name,
|
||||||
@@ -522,11 +468,6 @@ void ksu_sucompat_enable()
|
|||||||
int ret;
|
int ret;
|
||||||
pr_info("sucompat: ksu_sucompat_enable called\n");
|
pr_info("sucompat: ksu_sucompat_enable called\n");
|
||||||
|
|
||||||
#ifdef KSU_KPROBES_HOOK
|
|
||||||
// Register kprobe for pts_unix98_lookup
|
|
||||||
pts_kp = init_kprobe("pts_unix98_lookup", pts_unix98_lookup_pre);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_KRETPROBES
|
#ifdef CONFIG_KRETPROBES
|
||||||
// Register kretprobe for syscall_regfunc
|
// Register kretprobe for syscall_regfunc
|
||||||
syscall_regfunc_rp = init_kretprobe("syscall_regfunc", syscall_regfunc_handler);
|
syscall_regfunc_rp = init_kretprobe("syscall_regfunc", syscall_regfunc_handler);
|
||||||
@@ -568,9 +509,6 @@ void ksu_sucompat_disable()
|
|||||||
destroy_kretprobe(&syscall_unregfunc_rp);
|
destroy_kretprobe(&syscall_unregfunc_rp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KSU_KPROBES_HOOK
|
|
||||||
destroy_kprobe(&pts_kp);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sucompat: permited process can execute 'su' to gain root access.
|
// sucompat: permited process can execute 'su' to gain root access.
|
||||||
|
|||||||
Reference in New Issue
Block a user