kernel: allow GKI kprobes to use LSM hook for ksu_handle_devpts
* Also minor changes on comments Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
@@ -1460,13 +1460,8 @@ static int ksu_task_fix_setuid(struct cred *new, const struct cred *old,
|
||||
return ksu_handle_setuid(new, old);
|
||||
}
|
||||
|
||||
/*
|
||||
* Keep in mind, since kprobes already have pre handler, we must
|
||||
* guard it with CONFIG_KSU_KPROBES_HOOK, although it is possible to
|
||||
* disable kprobes pre handler, but this is way more simple.
|
||||
* However, if you wanna use LSM hooks, feel free to fork.
|
||||
*/
|
||||
#if !defined(KSU_HAS_DEVPTS_HANDLER) && !defined(CONFIG_KSU_KPROBES_HOOK)
|
||||
#ifndef MODULE
|
||||
#ifndef KSU_HAS_DEVPTS_HANDLER
|
||||
extern int ksu_handle_devpts(struct inode *inode);
|
||||
static int ksu_inode_permission(struct inode *inode, int mask)
|
||||
{
|
||||
@@ -1480,12 +1475,11 @@ static int ksu_inode_permission(struct inode *inode, int mask)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MODULE
|
||||
static struct security_hook_list ksu_hooks[] = {
|
||||
LSM_HOOK_INIT(task_prctl, ksu_task_prctl),
|
||||
LSM_HOOK_INIT(inode_rename, ksu_inode_rename),
|
||||
LSM_HOOK_INIT(task_fix_setuid, ksu_task_fix_setuid),
|
||||
#if !defined(KSU_HAS_DEVPTS_HANDLER) && !defined(CONFIG_KSU_KPROBES_HOOK)
|
||||
#ifndef KSU_HAS_DEVPTS_HANDLER
|
||||
LSM_HOOK_INIT(inode_permission, ksu_inode_permission),
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) || \
|
||||
|
||||
Reference in New Issue
Block a user