kernel: phase out devpts_hook

* Since it's interceptable from LSM Hook,
then we just need to remove ksu_handle_devpts and
make a decoy for it.

Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
rsuntk
2025-06-25 14:53:34 +07:00
committed by ShirkNeko
parent c71ef3ce29
commit bb02b12a69
3 changed files with 20 additions and 28 deletions

View File

@@ -233,14 +233,8 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
return 0;
}
int ksu_handle_devpts(struct inode *inode)
static int ksu_inline_handle_devpts(struct inode *inode)
{
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_hook_state) {
return 0;
}
#endif
if (!current->mm) {
return 0;
}
@@ -269,6 +263,22 @@ int ksu_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)
@@ -315,7 +325,7 @@ static int pts_unix98_lookup_pre(struct kprobe *p, struct pt_regs *regs)
inode = (struct inode *)PT_REGS_PARM2(regs);
#endif
return ksu_handle_devpts(inode);
return ksu_inline_handle_devpts(inode);
}
#else
static struct kprobe *su_kps[5];