kernel: Remove macro definitions, pass variables using ccflags -y, and reapply manual su protection.
kernel: stop printing useless message unless its ddk environment * In-tree build show empty KDIR -- KDIR: -- MDIR: /home/runner/work/KernelSU-Test/KernelSU-Test/kernel_414/KernelSU/kernel AR drivers/iommu/built-in.o CC drivers/input/misc/uinput.o -- KernelSU version: 12329 -- KernelSU: CONFIG_KSU_MANUAL_HOOK -- Supported KernelSU Manager(s): tiann, rsuntk, 5ec1cff CC drivers/kernelsu/ksu.o AR drivers/input/joystick/built-in.o CC drivers/hid/hid-roccat-pyra.o Co-authored-by: Faris <rissu.ntk@gmail.com> Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
@@ -62,7 +62,7 @@ static const struct ksu_feature_handler su_compat_handler = {
|
||||
.set_handler = su_compat_feature_set,
|
||||
};
|
||||
|
||||
#ifndef __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
static bool ksu_sucompat_hook_state __read_mostly = true;
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
|
||||
{
|
||||
const char su[] = SU_PATH;
|
||||
|
||||
#ifndef __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
if (!ksu_sucompat_hook_state) {
|
||||
return 0;
|
||||
}
|
||||
@@ -124,7 +124,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 __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
if (!ksu_sucompat_hook_state) {
|
||||
return 0;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
|
||||
const char sh[] = KSUD_PATH;
|
||||
const char su[] = SU_PATH;
|
||||
|
||||
#ifndef __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
if (!ksu_sucompat_hook_state) {
|
||||
return 0;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
|
||||
const char su[] = SU_PATH;
|
||||
char path[sizeof(su) + 1];
|
||||
|
||||
#ifndef __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
if (!ksu_sucompat_hook_state){
|
||||
return 0;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ int ksu_handle_devpts(struct inode *inode)
|
||||
int __ksu_handle_devpts(struct inode *inode)
|
||||
{
|
||||
|
||||
#ifndef __KPROBES_HOOK
|
||||
#ifndef CONFIG_KSU_KPROBES_HOOK
|
||||
if (!ksu_sucompat_hook_state)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -299,7 +299,7 @@ int __ksu_handle_devpts(struct inode *inode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __KPROBES_HOOK
|
||||
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||
static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
struct pt_regs *real_regs = PT_REAL_REGS(regs);
|
||||
@@ -381,7 +381,7 @@ static void destroy_kprobe(struct kprobe **kp_ptr)
|
||||
// sucompat: permited process can execute 'su' to gain root access.
|
||||
void ksu_sucompat_enable()
|
||||
{
|
||||
#ifdef __KPROBES_HOOK
|
||||
#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);
|
||||
@@ -394,7 +394,7 @@ void ksu_sucompat_enable()
|
||||
|
||||
void ksu_sucompat_disable()
|
||||
{
|
||||
#ifdef __KPROBES_HOOK
|
||||
#ifdef CONFIG_KSU_KPROBES_HOOK
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(su_kps); i++) {
|
||||
destroy_kprobe(&su_kps[i]);
|
||||
|
||||
Reference in New Issue
Block a user