kernel: fix issue with dfd parameter retrieval (#1543)

Although in most cases, this system call might not be used, or when
called, AT_FDCWD(-100) is passed in.
This commit is contained in:
CallMESuper
2024-03-27 16:29:53 +08:00
committed by GitHub
parent 09402ccfa6
commit 8fe19d3876

View File

@@ -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
}
}