kernel: Undo some changes
This commit is contained in:
@@ -209,7 +209,6 @@ static inline bool check_syscall_fastpath(int nr)
|
||||
case __NR_execve:
|
||||
case __NR_setresuid:
|
||||
case __NR_faccessat2:
|
||||
case __NR_execveat:
|
||||
case __NR_clone:
|
||||
case __NR_clone3:
|
||||
return true;
|
||||
@@ -242,10 +241,6 @@ int ksu_handle_init_mark_tracker(int *fd, const char __user **filename_user,
|
||||
#include "manual_su.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
bool ksu_is_compat __read_mostly = false;
|
||||
#endif
|
||||
|
||||
#ifndef LOOKUP_FOLLOW
|
||||
#define LOOKUP_FOLLOW 0x0001
|
||||
#endif
|
||||
@@ -266,48 +261,6 @@ static inline void ksu_handle_inode_permission(struct pt_regs *regs)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ksu_handle_bprm_check_security(struct pt_regs *regs, long id)
|
||||
{
|
||||
const char __user *filename;
|
||||
char path_buf[256];
|
||||
|
||||
if (id == __NR_execve)
|
||||
filename = (const char __user *)PT_REGS_PARM1(regs);
|
||||
else /* __NR_execveat */
|
||||
filename = (const char __user *)PT_REGS_PARM2(regs);
|
||||
|
||||
if (!ksu_execveat_hook)
|
||||
return;
|
||||
|
||||
memset(path_buf, 0, sizeof(path_buf));
|
||||
strncpy_from_user_nofault(path_buf, filename, sizeof(path_buf));
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static bool compat_check_done __read_mostly = false;
|
||||
if (unlikely(!compat_check_done) &&
|
||||
unlikely(!strcmp(path_buf, "/data/adb/ksud"))) {
|
||||
char buf[4];
|
||||
struct file *file = filp_open(path_buf, O_RDONLY, 0);
|
||||
if (!IS_ERR(file)) {
|
||||
loff_t pos = 0;
|
||||
kernel_read(file, buf, 4, &pos);
|
||||
if (!memcmp(buf, "\x7f\x45\x4c\x46", 4)) {
|
||||
char elf_class;
|
||||
pos = 4;
|
||||
kernel_read(file, &elf_class, 1, &pos);
|
||||
if (elf_class == 0x01)
|
||||
ksu_is_compat = true;
|
||||
pr_info("%s: %s ELF magic found! ksu_is_compat: %d\n",
|
||||
__func__, path_buf, ksu_is_compat);
|
||||
compat_check_done = true;
|
||||
}
|
||||
filp_close(file, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ksu_handle_pre_ksud(path_buf);
|
||||
}
|
||||
|
||||
static inline void ksu_handle_task_alloc(struct pt_regs *regs)
|
||||
{
|
||||
#ifdef CONFIG_KSU_MANUAL_SU
|
||||
@@ -371,10 +324,6 @@ static void ksu_sys_enter_handler(void *data, struct pt_regs *regs, long id)
|
||||
if (id == __NR_faccessat || id == __NR_faccessat2)
|
||||
return ksu_handle_inode_permission(regs);
|
||||
|
||||
// Handle bprm_check_security via execve/execveat
|
||||
if (id == __NR_execve || id == __NR_execveat)
|
||||
return ksu_handle_bprm_check_security(regs, id);
|
||||
|
||||
#ifdef CONFIG_KSU_MANUAL_SU
|
||||
// Handle task_alloc via clone/fork
|
||||
if (id == __NR_clone || id == __NR_clone3)
|
||||
|
||||
Reference in New Issue
Block a user