kernel: stop intercepting devpts inode permission via LSM

* Somehow, it just does not work properly. (sometimes)

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
rsuntk
2025-09-02 19:24:28 +07:00
committed by ShirkNeko
parent dd00678da1
commit 3161671a7d
2 changed files with 8 additions and 33 deletions

View File

@@ -242,8 +242,14 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
return 0;
}
static int ksu_inline_handle_devpts(struct inode *inode)
int ksu_handle_devpts(struct inode *inode)
{
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_hook_state)
return 0;
#endif
if (!current->mm) {
return 0;
}
@@ -272,22 +278,6 @@ static int ksu_inline_handle_devpts(struct inode *inode)
return 0;
}
int __ksu_handle_devpts(struct inode *inode)
{
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_hook_state) {
return 0;
}
#endif
return ksu_inline_handle_devpts(inode);
}
// dead code, we are phasing out ksu_handle_devpts for LSM hooks.
int __maybe_unused ksu_handle_devpts(struct inode *inode)
{
return 0;
}
#ifdef CONFIG_KSU_KPROBES_HOOK
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
@@ -334,7 +324,7 @@ static int pts_unix98_lookup_pre(struct kprobe *p, struct pt_regs *regs)
inode = (struct inode *)PT_REGS_PARM2(regs);
#endif
return ksu_inline_handle_devpts(inode);
return ksu_handle_devpts(inode);
}
#else
static struct kprobe *su_kps[5];
@@ -380,9 +370,7 @@ void ksu_sucompat_init(void)
su_kps[2] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
su_kps[3] = init_kprobe(SYS_NEWFSTATAT_SYMBOL, newfstatat_handler_pre);
su_kps[4] = init_kprobe(SYS_FSTATAT64_SYMBOL, newfstatat_handler_pre);
#ifdef MODULE
su_kps[5] = init_kprobe("pts_unix98_lookup", pts_unix98_lookup_pre);
#endif
#else
ksu_sucompat_hook_state = true;
pr_info("ksu_sucompat init\n");