kernel: rename KSU_WITH_KPROBES to KSU_KPROBES_HOOK for better self explanitory

This commit is contained in:
rifsxd
2025-05-21 15:13:17 +06:00
parent 26d3ec14a6
commit eed685507a
5 changed files with 23 additions and 23 deletions

View File

@@ -24,7 +24,7 @@
#define SU_PATH "/system/bin/su"
#define SH_PATH "/system/bin/sh"
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
static bool ksu_sucompat_non_kp __read_mostly = true;
#endif
@@ -58,7 +58,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
{
const char su[] = SU_PATH;
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_non_kp) {
return 0;
}
@@ -85,7 +85,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
// const char sh[] = SH_PATH;
const char su[] = SU_PATH;
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_non_kp){
return 0;
}
@@ -135,7 +135,7 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
const char sh[] = KSUD_PATH;
const char su[] = SU_PATH;
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_non_kp) {
return 0;
}
@@ -170,7 +170,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
const char su[] = SU_PATH;
char path[sizeof(su) + 1];
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_non_kp) {
return 0;
}
@@ -213,7 +213,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
int ksu_handle_devpts(struct inode *inode)
{
#ifndef CONFIG_KSU_WITH_KPROBES
#ifndef CONFIG_KSU_KPROBES_HOOK
if (!ksu_sucompat_non_kp) {
return 0;
}
@@ -247,7 +247,7 @@ int ksu_handle_devpts(struct inode *inode)
return 0;
}
#ifdef CONFIG_KSU_WITH_KPROBES
#ifdef CONFIG_KSU_KPROBES_HOOK
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
@@ -330,7 +330,7 @@ static struct kprobe *su_kps[4];
// sucompat: permited process can execute 'su' to gain root access.
void ksu_sucompat_init()
{
#ifdef CONFIG_KSU_WITH_KPROBES
#ifdef CONFIG_KSU_KPROBES_HOOK
su_kps[0] = init_kprobe(SYS_EXECVE_SYMBOL, execve_handler_pre);
su_kps[1] = init_kprobe(SYS_FACCESSAT_SYMBOL, faccessat_handler_pre);
su_kps[2] = init_kprobe(SYS_NEWFSTATAT_SYMBOL, newfstatat_handler_pre);
@@ -343,7 +343,7 @@ void ksu_sucompat_init()
void ksu_sucompat_exit()
{
#ifdef CONFIG_KSU_WITH_KPROBES
#ifdef CONFIG_KSU_KPROBES_HOOK
for (int i = 0; i < ARRAY_SIZE(su_kps); i++) {
destroy_kprobe(&su_kps[i]);
}