8000 chore: use map instead of stack to store task_info by yanivagman · Pull Request #3920 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: use map instead of stack to store task_info #3920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions pkg/ebpf/c/tracee.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,20 @@ int tracepoint__sched__sched_process_fork(struct bpf_raw_tracepoint_args *ctx)

// Update the task_info map with the new task's info

task_info_t task = {};
__builtin_memcpy(&task, p.task_info, sizeof(task_info_t));
task.recompute_scope = true;
task.context.tid = child_ns_tid;
task.context.host_tid = child_tid;
task.context.start_time = child_start_time;
ret = bpf_map_update_elem(&task_info_map, &task.context.host_tid, &task, BPF_ANY);
ret = bpf_map_update_elem(&task_info_map, &child_tid, p.task_info, BPF_ANY);
if (ret < 0)
tracee_log(ctx, BPF_LOG_LVL_DEBUG, BPF_LOG_ID_MAP_UPDATE_ELEM, ret);
task_info_t *task = bpf_map_lookup_elem(&task_info_map, &child_tid);
if (unlikely(task == NULL)) {
// this should never happen - we just updated the map with this key
tracee_log(ctx, BPF_LOG_LVL_WARN, BPF_LOG_ID_MAP_LOOKUP_ELEM, 0);
return 0;
}

task->recompute_scope = true;
task->context.tid = child_ns_tid;
task->context.host_tid = child_tid;
task->context.start_time = child_start_time;

// Update the proc_info_map with the new process's info (from parent)

Expand Down
0