Skip to content

Commit

Permalink
Sync elastic-ebpf with "Add cwd to fork and ctty to exit"
Browse files Browse the repository at this point in the history
  • Loading branch information
haesbaert committed Jul 2, 2024
1 parent 779dafd commit b171c6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion elastic-ebpf/GPL/Events/EbpfEventProto.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ struct ebpf_process_exit_event {
struct ebpf_event_header hdr;
struct ebpf_pid_info pids;
struct ebpf_cred_info creds;
int32_t exit_code;
struct ebpf_tty_dev ctty;
char comm[TASK_COMM_LEN];
int32_t exit_code;

// Variable length fields: pids_ss_cgroup_path
struct ebpf_varlen_fields_start vl_fields;
Expand Down
6 changes: 6 additions & 0 deletions elastic-ebpf/GPL/Events/Process/Probe.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ int BPF_PROG(sched_process_fork, const struct task_struct *parent, const struct
size = ebpf_resolve_pids_ss_cgroup_path_to_string(field->data, child);
ebpf_vl_field__set_size(&event->vl_fields, field, size);

// cwd
field = ebpf_vl_field__add(&event->vl_fields, EBPF_VL_FIELD_CWD);
size = ebpf_resolve_path_to_string(field->data, &child->fs->pwd, child);
ebpf_vl_field__set_size(&event->vl_fields, field, size);

bpf_ringbuf_output(&ringbuf, event, EVENT_SIZE(event), 0);

out:
Expand Down Expand Up @@ -201,6 +206,7 @@ static int taskstats_exit__enter(const struct task_struct *task, int group_dead)
event->exit_code = (exit_code >> 8) & 0xFF;
ebpf_pid_info__fill(&event->pids, task);
ebpf_cred_info__fill(&event->creds, task);
ebpf_ctty__fill(&event->ctty, task);
ebpf_comm__fill(event->comm, sizeof(event->comm), task);

// Variable length fields
Expand Down
2 changes: 1 addition & 1 deletion elastic-ebpf/commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
817e105658f032a6e8f5070e9fc852ac98231e2e
ba15ef679e3bbdc784d18fb2cd42d3687b7f1d83

0 comments on commit b171c6c

Please sign in to comment.