kernel: refactor PR_REAL_REGS

This commit is contained in:
weishu
2024-04-26 13:25:10 +08:00
parent 2e1bb8e303
commit f982683825
4 changed files with 12 additions and 30 deletions

View File

@@ -542,11 +542,7 @@ int ksu_handle_setuid(struct cred *new, const struct cred *old)
static int handler_pre(struct kprobe *p, struct pt_regs *regs)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
struct pt_regs *real_regs = (struct pt_regs *)PT_REGS_PARM1(regs);
#else
struct pt_regs *real_regs = regs;
#endif
struct pt_regs *real_regs = PT_REAL_REGS(regs);
int option = (int)PT_REGS_PARM1(real_regs);
unsigned long arg2 = (unsigned long)PT_REGS_PARM2(real_regs);
unsigned long arg3 = (unsigned long)PT_REGS_PARM3(real_regs);