Skip to content

Commit

Permalink
tracee-ebpf: fix missing sched_process_exit with pid=new
Browse files Browse the repository at this point in the history
  • Loading branch information
yanivagman committed Jan 13, 2022
1 parent c469264 commit 9a0b32a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tracee-ebpf/tracee/tracee.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2496,6 +2496,9 @@ int tracepoint__sched__sched_process_exit(struct bpf_raw_tracepoint_args *ctx)
if (!init_event_data(&data, ctx))
return 0;

// evaluate should_trace before removing this pid from the maps
bool traced = should_trace(&data.context);

// Remove this pid from all maps
bpf_map_delete_elem(&traced_pids_map, &data.context.host_tid);
bpf_map_delete_elem(&new_pids_map, &data.context.host_tid);
Expand All @@ -2514,7 +2517,7 @@ int tracepoint__sched__sched_process_exit(struct bpf_raw_tracepoint_args *ctx)
}
}

if (!should_trace(&data.context))
if (!traced)
return 0;

long exit_code = get_task_exit_code(data.task);
Expand Down

0 comments on commit 9a0b32a

Please sign in to comment.