Skip to content

Commit d15f83b

Browse files
tracers: Remove tracked munmap (#389)
This wasn't cleaned up which will eventually fill up the BPF map and not allow any more insertions :(. Ideally in the future we should have an integration test for this. Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
1 parent 0c76b59 commit d15f83b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bpf/tracers.bpf.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ int tracer_exit_munmap(struct syscall_trace_exit *ctx) {
117117
return 0;
118118
}
119119

120-
int ret = ctx->ret;
121-
if (ret != 0) {
120+
if (ctx->ret != 0) {
121+
bpf_map_delete_elem(&tracked_munmap, &key);
122122
return 0;
123123
}
124124

@@ -130,6 +130,8 @@ int tracer_exit_munmap(struct syscall_trace_exit *ctx) {
130130
.start_address = *start_address,
131131
};
132132

133+
int ret;
134+
133135
if (lightswitch_config.use_ring_buffers) {
134136
ret = bpf_ringbuf_output(&tracer_events_rb, &event, sizeof(tracer_event_t), 0);
135137
} else {
@@ -139,6 +141,7 @@ int tracer_exit_munmap(struct syscall_trace_exit *ctx) {
139141
LOG("[error] failed to send munmap tracer event");
140142
}
141143

144+
bpf_map_delete_elem(&tracked_munmap, &key);
142145
return 0;
143146
}
144147

0 commit comments

Comments
 (0)