Skip to content

Commit 6eecde5

Browse files
committed
eBPF tracer: avoiding overflow of the fd_by_pid_tgid map
1 parent 3313f9e commit 6eecde5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ebpftracer/ebpf.go

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

ebpftracer/ebpf/tcp/state.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,10 @@ int sys_enter_connect(void *ctx) {
153153
return 0;
154154
}
155155

156+
SEC("tracepoint/syscalls/sys_exit_connect")
157+
int sys_exit_connect(void *ctx) {
158+
__u64 id = bpf_get_current_pid_tgid();
159+
bpf_map_delete_elem(&fd_by_pid_tgid, &id);
160+
return 0;
161+
}
162+

0 commit comments

Comments
 (0)