From c9a40877337598d3d794271a5160f48e61f3160c Mon Sep 17 00:00:00 2001 From: CallMESuper <919675084@qq.com> Date: Wed, 27 Mar 2024 13:48:32 +0800 Subject: [PATCH] kernel: fix issue with dfd parameter retrieval Although in most cases, this system call might not be used, or when called, AT_FDCWD(-100) is passed in. --- kernel/sucompat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sucompat.c b/kernel/sucompat.c index 56c430c46ba6..f19b2212bec3 100644 --- a/kernel/sucompat.c +++ b/kernel/sucompat.c @@ -134,7 +134,7 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr, __maybe_unused static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs) { - int *dfd = (int *)PT_REGS_PARM1(regs); + int *dfd = (int *)&PT_REGS_PARM1(regs); const char __user **filename_user = (const char **)&PT_REGS_PARM2(regs); int *mode = (int *)&PT_REGS_PARM3(regs); // Both sys_ and do_ is C function @@ -150,7 +150,7 @@ static int sys_faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs) #else struct pt_regs *real_regs = regs; #endif - int *dfd = (int *)PT_REGS_PARM1(real_regs); + int *dfd = (int *)&PT_REGS_PARM1(real_regs); const char __user **filename_user = (const char **)&PT_REGS_PARM2(real_regs); int *mode = (int *)&PT_REGS_PARM3(real_regs); @@ -261,4 +261,4 @@ void ksu_sucompat_exit() { unregister_kprobe(&newfstatat_kp); unregister_kprobe(&faccessat_kp); #endif -} \ No newline at end of file +}