kernel: Simplify state management logic

This commit is contained in:
ShirkNeko
2025-11-09 14:06:25 +08:00
parent 3e5f69cdf8
commit f670151f20
4 changed files with 23 additions and 19 deletions

View File

@@ -77,7 +77,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
{
const char su[] = SU_PATH;
#ifndef KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
#ifdef KSU_MANUAL_HOOK
if (!ksu_su_compat_enabled) {
return 0;
}
@@ -107,10 +107,10 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
// const char sh[] = SH_PATH;
const char su[] = SU_PATH;
#ifndef KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
#ifdef KSU_MANUAL_HOOK
if (!ksu_su_compat_enabled) {
return 0;
}
return 0;
}
#endif
if (!ksu_is_allow_uid_for_current(current_uid().val)) {
return 0;
@@ -159,10 +159,10 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
const char sh[] = KSUD_PATH;
const char su[] = SU_PATH;
#ifndef KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
#ifdef KSU_MANUAL_HOOK
if (!ksu_su_compat_enabled) {
return 0;
}
return 0;
}
#endif
if (unlikely(!filename_ptr))
return 0;
@@ -211,10 +211,10 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
const char su[] = SU_PATH;
char path[sizeof(su) + 1];
#ifndef KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
#ifdef KSU_MANUAL_HOOK
if (!ksu_su_compat_enabled){
return 0;
}
return 0;
}
#endif
if (unlikely(!filename_user))
return 0;
@@ -250,7 +250,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
int __ksu_handle_devpts(struct inode *inode)
{
#ifndef KSU_HAVE_SYSCALL_TRACEPOINTS_HOOK
#ifdef KSU_MANUAL_HOOK
if (!ksu_su_compat_enabled)
return 0;
#endif