Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: read_call_arg, copy_path once #2239

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions bpf/process/types/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2537,13 +2537,11 @@ read_call_arg(void *ctx, struct msg_generic_kprobe *e, int index, int type,
struct file *file;
probe_read(&file, sizeof(file), &arg);
path_arg = _(&file->f_path);
goto do_copy_path;
}
// fallthrough to copy_path
case path_ty: {
if (!path_arg)
probe_read(&path_arg, sizeof(path_arg), &arg);
size = copy_path(args, path_arg);
break;
probe_read(&path_arg, sizeof(path_arg), &arg);
goto do_copy_path;
}
case fd_ty: {
struct fdinstall_key key = { 0 };
Expand Down Expand Up @@ -2585,7 +2583,7 @@ read_call_arg(void *ctx, struct msg_generic_kprobe *e, int index, int type,
arg = (unsigned long)_(&bprm->file);
probe_read(&file, sizeof(file), (const void *)arg);
path_arg = _(&file->f_path);
size = copy_path(args, path_arg);
goto do_copy_path;
} break;
#endif
case filename_ty: {
Expand Down Expand Up @@ -2698,6 +2696,9 @@ read_call_arg(void *ctx, struct msg_generic_kprobe *e, int index, int type,
break;
}
return size;

do_copy_path:
return copy_path(args, path_arg);
}

#endif /* __BASIC_H__ */
Loading