1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Facebook */
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
8 char _license[] SEC("license") = "GPL";
11 __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
12 __uint(map_flags, BPF_F_NO_PREALLOC);
15 } task_storage SEC(".maps");
18 int valid_ptr_count = 0;
19 int null_ptr_count = 0;
21 SEC("fentry/exit_creds")
22 int BPF_PROG(trace_exit_creds, struct task_struct *task)
26 ptr = bpf_task_storage_get(&task_storage, task, 0,
27 BPF_LOCAL_STORAGE_GET_F_CREATE);
29 __sync_fetch_and_add(&valid_ptr_count, 1);
31 __sync_fetch_and_add(&null_ptr_count, 1);
33 __sync_fetch_and_add(&run_count, 1);