kernel: fix memory leaks and x86_64 args

This commit is contained in:
weishu
2022-12-14 16:26:43 +07:00
parent 2934ec1718
commit c6300ccf94
2 changed files with 8 additions and 3 deletions

View File

@@ -54,9 +54,11 @@ static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs) {
}
if (!memcmp(filename->name, su, sizeof(su))) {
pr_info("faccessat su->sh!\n");
regs->regs[1] = sh_user_path();
PT_REGS_PARM2(regs) = sh_user_path();
}
putname(filename);
return 0;
}
@@ -76,9 +78,11 @@ static int newfstatat_handler_pre(struct kprobe *p, struct pt_regs *regs) {
}
if (!memcmp(filename->name, su, sizeof(su))) {
pr_info("newfstatat su->sh!\n");
regs->regs[1] = sh_user_path();
PT_REGS_PARM2(regs) = sh_user_path();
}
putname(filename);
return 0;
}
@@ -104,6 +108,8 @@ static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs) {
escape_to_root(false);
}
putname(filename);
return 0;
}