diff --git a/bpf/process/bpf_generic_retkprobe.c b/bpf/process/bpf_generic_retkprobe.c index db3321f361a..f76b09f39b4 100644 --- a/bpf/process/bpf_generic_retkprobe.c +++ b/bpf/process/bpf_generic_retkprobe.c @@ -82,16 +82,14 @@ static struct generic_maps maps = { .heap = (struct bpf_map_def *)&process_call_heap, .calls = (struct bpf_map_def *)&retkprobe_calls, .filter = (struct bpf_map_def *)&filter_map, + .config = (struct bpf_map_def *)&config_map, + .data = (struct bpf_map_def *)data_heap_ptr, }; __attribute__((section((MAIN)), used)) int BPF_KRETPROBE(generic_retkprobe_event, unsigned long ret) { - return generic_retkprobe(ctx, (struct bpf_map_def *)&process_call_heap, - (struct bpf_map_def *)&config_map, - (struct bpf_map_def *)&retkprobe_calls, - (struct bpf_map_def *)data_heap_ptr, - ret); + return generic_retkprobe(ctx, &maps, ret); } __attribute__((section("kprobe"), used)) int diff --git a/bpf/process/generic_calls.h b/bpf/process/generic_calls.h index d259c7e2631..12d9abd498f 100644 --- a/bpf/process/generic_calls.h +++ b/bpf/process/generic_calls.h @@ -216,11 +216,7 @@ generic_process_event_and_setup(struct pt_regs *ctx, struct generic_maps *maps) return generic_process_event(ctx, maps); } -FUNC_INLINE int generic_retkprobe(void *ctx, struct bpf_map_def *heap, - struct bpf_map_def *config_map, - struct bpf_map_def *tailcalls, - struct bpf_map_def *data_heap, - unsigned long ret) +FUNC_INLINE int generic_retkprobe(void *ctx, struct generic_maps *maps, unsigned long ret) { struct execve_map_value *enter; struct msg_generic_kprobe *e; @@ -233,13 +229,13 @@ FUNC_INLINE int generic_retkprobe(void *ctx, struct bpf_map_def *heap, long ty_arg, do_copy; __u64 pid_tgid; - e = map_lookup_elem(heap, &zero); + e = map_lookup_elem(maps->heap, &zero); if (!e) return 0; e->idx = get_index(ctx); - config = map_lookup_elem(config_map, &e->idx); + config = map_lookup_elem(maps->config, &e->idx); if (!config) return 0; @@ -257,7 +253,7 @@ FUNC_INLINE int generic_retkprobe(void *ctx, struct bpf_map_def *heap, ty_arg = config->argreturn; do_copy = config->argreturncopy; if (ty_arg) { - size += read_call_arg(ctx, e, 0, ty_arg, size, ret, 0, (struct bpf_map_def *)data_heap); + size += read_call_arg(ctx, e, 0, ty_arg, size, ret, 0, (struct bpf_map_def *)maps->data); #ifdef __LARGE_BPF_PROG struct socket_owner owner; @@ -284,7 +280,7 @@ FUNC_INLINE int generic_retkprobe(void *ctx, struct bpf_map_def *heap, switch (do_copy) { case char_buf: - size += __copy_char_buf(ctx, size, info.ptr, ret, false, e, (struct bpf_map_def *)data_heap); + size += __copy_char_buf(ctx, size, info.ptr, ret, false, e, (struct bpf_map_def *)maps->data); break; case char_iovec: size += __copy_char_iovec(size, info.ptr, info.cnt, ret, e); @@ -314,7 +310,7 @@ FUNC_INLINE int generic_retkprobe(void *ctx, struct bpf_map_def *heap, e->func_id = config->func_id; e->common.size = size; - tail_call(ctx, tailcalls, TAIL_CALL_ARGS); + tail_call(ctx, maps->calls, TAIL_CALL_ARGS); return 1; } #endif /* __GENERIC_CALLS_H__ */