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: document how to use read_exe() #2064

Merged
merged 1 commit into from
Feb 5, 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
9 changes: 9 additions & 0 deletions bpf/process/bpf_execve_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ read_execve_shared_info(void *ctx, struct msg_process *p, __u64 pid)
execve_joined_info_map_clear(pid);
}

/**
* read_exe() Reads the path from the backing executable file of the current
* process.
*
* The executable file of a process can change using the prctl() system call
* and PR_SET_MM_EXE_FILE. Thus, this function should only be used under the
* execve path since the executable file is locked and usually there is only
* one remaining thread at its exit path.
*/
#ifdef __LARGE_BPF_PROG
static inline __attribute__((always_inline)) __u32
read_exe(struct task_struct *task, struct heap_exe *exe)
Expand Down
Loading