Skip to content

Commit

Permalink
kernel: fix issue with dfd parameter retrieval
Browse files Browse the repository at this point in the history
Although in most cases, this system call might not be used, or when called, AT_FDCWD(-100) is passed in.
  • Loading branch information
18712886438 authored Mar 27, 2024
1 parent eea2287 commit ee65e23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/sucompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -261,4 +261,4 @@ void ksu_sucompat_exit() {
unregister_kprobe(&newfstatat_kp);
unregister_kprobe(&faccessat_kp);
#endif
}
}

0 comments on commit ee65e23

Please sign in to comment.