Fixed misspelling of CONFIG_KSU_HOOK_KPROBES to CONFIG_KSU_KPROBES_HOOK in Makefile and related files.
This commit is contained in:
@@ -56,7 +56,7 @@ ifeq ($(strip $(CONFIG_KSU_MANUAL_HOOK)),y)
|
|||||||
$(info -- SukiSU: Manual hooking enabled!)
|
$(info -- SukiSU: Manual hooking enabled!)
|
||||||
else
|
else
|
||||||
$(info -- SukiSU: KPROBES hooking enabled!)
|
$(info -- SukiSU: KPROBES hooking enabled!)
|
||||||
ccflags-y += -DCONFIG_KSU_HOOK_KPROBES
|
ccflags-y += -DCONFIG_KSU_KPROBES_HOOK
|
||||||
endif
|
endif
|
||||||
|
|
||||||
KERNEL_VERSION := $(VERSION).$(PATCHLEVEL)
|
KERNEL_VERSION := $(VERSION).$(PATCHLEVEL)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
#error "Unsupported arch"
|
#error "Unsupported arch"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1447,7 +1447,7 @@ void __init ksu_core_init(void)
|
|||||||
|
|
||||||
void ksu_core_exit(void)
|
void ksu_core_exit(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
pr_info("ksu_core_kprobe_exit\n");
|
pr_info("ksu_core_kprobe_exit\n");
|
||||||
// we dont use this now
|
// we dont use this now
|
||||||
// ksu_kprobe_exit();
|
// ksu_kprobe_exit();
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ int __init ksu_kernelsu_init(void)
|
|||||||
|
|
||||||
ksu_sucompat_init();
|
ksu_sucompat_init();
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
ksu_ksud_init();
|
ksu_ksud_init();
|
||||||
#else
|
#else
|
||||||
pr_alert("KPROBES is disabled, KernelSU may not work, please check https://kernelsu.org/guide/how-to-integrate-for-non-gki.html");
|
pr_alert("KPROBES is disabled, KernelSU may not work, please check https://kernelsu.org/guide/how-to-integrate-for-non-gki.html");
|
||||||
@@ -121,7 +121,7 @@ void ksu_kernelsu_exit(void)
|
|||||||
|
|
||||||
destroy_workqueue(ksu_workqueue);
|
destroy_workqueue(ksu_workqueue);
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
ksu_ksud_exit();
|
ksu_ksud_exit();
|
||||||
#endif
|
#endif
|
||||||
ksu_sucompat_exit();
|
ksu_sucompat_exit();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ static void stop_vfs_read_hook();
|
|||||||
static void stop_execve_hook();
|
static void stop_execve_hook();
|
||||||
static void stop_input_hook();
|
static void stop_input_hook();
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
static struct work_struct stop_vfs_read_work;
|
static struct work_struct stop_vfs_read_work;
|
||||||
static struct work_struct stop_execve_hook_work;
|
static struct work_struct stop_execve_hook_work;
|
||||||
static struct work_struct stop_input_hook_work;
|
static struct work_struct stop_input_hook_work;
|
||||||
@@ -166,7 +166,7 @@ int ksu_handle_execveat_ksud(int *fd, struct filename **filename_ptr,
|
|||||||
struct user_arg_ptr *argv,
|
struct user_arg_ptr *argv,
|
||||||
struct user_arg_ptr *envp, int *flags)
|
struct user_arg_ptr *envp, int *flags)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_execveat_hook) {
|
if (!ksu_execveat_hook) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ static ssize_t read_iter_proxy(struct kiocb *iocb, struct iov_iter *to)
|
|||||||
int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
|
int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
|
||||||
size_t *count_ptr, loff_t **pos)
|
size_t *count_ptr, loff_t **pos)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_vfs_read_hook) {
|
if (!ksu_vfs_read_hook) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -435,7 +435,7 @@ static bool is_volumedown_enough(unsigned int count)
|
|||||||
int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code,
|
int ksu_handle_input_handle_event(unsigned int *type, unsigned int *code,
|
||||||
int *value)
|
int *value)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_input_hook) {
|
if (!ksu_input_hook) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@ bool ksu_is_safe_mode()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
|
|
||||||
static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
@@ -634,7 +634,7 @@ static void do_stop_input_hook(struct work_struct *work)
|
|||||||
|
|
||||||
static void stop_vfs_read_hook()
|
static void stop_vfs_read_hook()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
bool ret = schedule_work(&stop_vfs_read_work);
|
bool ret = schedule_work(&stop_vfs_read_work);
|
||||||
pr_info("unregister vfs_read kprobe: %d!\n", ret);
|
pr_info("unregister vfs_read kprobe: %d!\n", ret);
|
||||||
#else
|
#else
|
||||||
@@ -645,7 +645,7 @@ static void stop_vfs_read_hook()
|
|||||||
|
|
||||||
static void stop_execve_hook()
|
static void stop_execve_hook()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
bool ret = schedule_work(&stop_execve_hook_work);
|
bool ret = schedule_work(&stop_execve_hook_work);
|
||||||
pr_info("unregister execve kprobe: %d!\n", ret);
|
pr_info("unregister execve kprobe: %d!\n", ret);
|
||||||
#else
|
#else
|
||||||
@@ -660,7 +660,7 @@ static void stop_execve_hook()
|
|||||||
|
|
||||||
static void stop_input_hook()
|
static void stop_input_hook()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
static bool input_hook_stopped = false;
|
static bool input_hook_stopped = false;
|
||||||
if (input_hook_stopped) {
|
if (input_hook_stopped) {
|
||||||
return;
|
return;
|
||||||
@@ -679,7 +679,7 @@ static void stop_input_hook()
|
|||||||
// ksud: module support
|
// ksud: module support
|
||||||
void ksu_ksud_init()
|
void ksu_ksud_init()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = register_kprobe(&execve_kp);
|
ret = register_kprobe(&execve_kp);
|
||||||
@@ -699,7 +699,7 @@ void ksu_ksud_init()
|
|||||||
|
|
||||||
void ksu_ksud_exit()
|
void ksu_ksud_exit()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
unregister_kprobe(&execve_kp);
|
unregister_kprobe(&execve_kp);
|
||||||
// this should be done before unregister vfs_read_kp
|
// this should be done before unregister vfs_read_kp
|
||||||
// unregister_kprobe(&vfs_read_kp);
|
// unregister_kprobe(&vfs_read_kp);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#define SU_PATH "/system/bin/su"
|
#define SU_PATH "/system/bin/su"
|
||||||
#define SH_PATH "/system/bin/sh"
|
#define SH_PATH "/system/bin/sh"
|
||||||
|
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
static bool ksu_sucompat_non_kp __read_mostly = true;
|
static bool ksu_sucompat_non_kp __read_mostly = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
|
|||||||
{
|
{
|
||||||
const char su[] = SU_PATH;
|
const char su[] = SU_PATH;
|
||||||
|
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_sucompat_non_kp) {
|
if (!ksu_sucompat_non_kp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
|
|||||||
// const char sh[] = SH_PATH;
|
// const char sh[] = SH_PATH;
|
||||||
const char su[] = SU_PATH;
|
const char su[] = SU_PATH;
|
||||||
|
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_sucompat_non_kp) {
|
if (!ksu_sucompat_non_kp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr, void *
|
|||||||
const char su[] = SU_PATH;
|
const char su[] = SU_PATH;
|
||||||
const char ksud[] = KSUD_PATH;
|
const char ksud[] = KSUD_PATH;
|
||||||
|
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_sucompat_non_kp) {
|
if (!ksu_sucompat_non_kp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user, void
|
|||||||
char path[sizeof(su) + 1];
|
char path[sizeof(su) + 1];
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_sucompat_non_kp){
|
if (!ksu_sucompat_non_kp){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user, void
|
|||||||
|
|
||||||
int ksu_handle_devpts(struct inode *inode)
|
int ksu_handle_devpts(struct inode *inode)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_KSU_HOOK_KPROBES
|
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||||
if (!ksu_sucompat_non_kp) {
|
if (!ksu_sucompat_non_kp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ int ksu_handle_devpts(struct inode *inode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct pt_regs *real_regs = PT_REAL_REGS(regs);
|
struct pt_regs *real_regs = PT_REAL_REGS(regs);
|
||||||
@@ -339,7 +339,7 @@ static struct kprobe *su_kps[6];
|
|||||||
// sucompat: permited process can execute 'su' to gain root access.
|
// sucompat: permited process can execute 'su' to gain root access.
|
||||||
void ksu_sucompat_init()
|
void ksu_sucompat_init()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
|
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
|
||||||
su_kps[1] = init_kprobe(SYS_EXECVE_COMPAT_SYMBOL, execve_handler_pre);
|
su_kps[1] = init_kprobe(SYS_EXECVE_COMPAT_SYMBOL, execve_handler_pre);
|
||||||
su_kps[2] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
|
su_kps[2] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
|
||||||
@@ -354,7 +354,7 @@ void ksu_sucompat_init()
|
|||||||
|
|
||||||
void ksu_sucompat_exit()
|
void ksu_sucompat_exit()
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_KSU_HOOK_KPROBES
|
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(su_kps); i++) {
|
for (i = 0; i < ARRAY_SIZE(su_kps); i++) {
|
||||||
destroy_kprobe(&su_kps[i]);
|
destroy_kprobe(&su_kps[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user