tools/testing/selftests/bpf/progs/profiler.inc.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/profiler.inc.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/profiler.inc.h- Extension
.h- Size
- 29678 bytes
- Lines
- 961
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_core_read.hbpf/bpf_helpers.hbpf/bpf_tracing.hprofiler.herr.hbpf_experimental.hbpf_compiler.hbpf_misc.h
Detected Declarations
struct var_kill_data_arr_tstruct kernfs_iattrs___52struct kernfs_node___52enum cgroup_subsys_id___localfunction IS_ERRfunction get_userspace_pidfunction is_init_processfunction probe_read_limfunction get_var_spid_indexfunction populate_ancestorsfunction read_full_cgroup_pathfunction get_inode_from_kernfsfunction populate_cgroup_infofunction populate_var_metadatafunction get_var_kill_datafunction trace_var_sys_killfunction bpf_stats_enterfunction bpf_stats_exitfunction bpf_stats_pre_submit_var_perf_eventfunction read_absolute_file_path_from_dentryfunction is_ancestor_in_allowed_inodesfunction is_dentry_allowed_for_filemodfunction BPF_KPROBEfunction tracepoint__syscalls__sys_enter_killfunction raw_tracepoint__sched_process_exitfunction raw_tracepoint__sched_process_execfunction kprobe_ret__do_file_openfunction BPF_KPROBEfunction BPF_KPROBEfunction raw_tracepoint__sched_process_fork
Annotated Snippet
struct var_kill_data_arr_t {
struct var_kill_data_t array[KILL_DATA_ARRAY_SIZE];
};
union any_profiler_data_t {
struct var_exec_data_t var_exec;
struct var_kill_data_t var_kill;
struct var_sysctl_data_t var_sysctl;
struct var_filemod_data_t var_filemod;
struct var_fork_data_t var_fork;
struct var_kill_data_arr_t var_kill_data_arr;
};
volatile struct profiler_config_struct bpf_config = {};
#define FETCH_CGROUPS_FROM_BPF (bpf_config.fetch_cgroups_from_bpf)
#define CGROUP_FS_INODE (bpf_config.cgroup_fs_inode)
#define CGROUP_LOGIN_SESSION_INODE \
(bpf_config.cgroup_login_session_inode)
#define KILL_SIGNALS (bpf_config.kill_signals_mask)
#define STALE_INFO (bpf_config.stale_info_secs)
#define INODE_FILTER (bpf_config.inode_filter)
#define READ_ENVIRON_FROM_EXEC (bpf_config.read_environ_from_exec)
#define ENABLE_CGROUP_V1_RESOLVER (bpf_config.enable_cgroup_v1_resolver)
struct kernfs_iattrs___52 {
struct iattr ia_iattr;
};
struct kernfs_node___52 {
union /* kernfs_node_id */ {
struct {
u32 ino;
u32 generation;
};
u64 id;
} id;
};
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
__uint(max_entries, 1);
__type(key, u32);
__type(value, union any_profiler_data_t);
} data_heap SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
__uint(key_size, sizeof(int));
__uint(value_size, sizeof(int));
} events SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(max_entries, KILL_DATA_ARRAY_SIZE);
__type(key, u32);
__type(value, struct var_kill_data_arr_t);
} var_tpid_to_data SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
__uint(max_entries, profiler_bpf_max_function_id);
__type(key, u32);
__type(value, struct bpf_func_stats_data);
} bpf_func_stats SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u32);
__type(value, bool);
__uint(max_entries, 16);
} allowed_devices SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u64);
__type(value, bool);
__uint(max_entries, 1024);
} allowed_file_inodes SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u64);
__type(value, bool);
__uint(max_entries, 1024);
} allowed_directory_inodes SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u32);
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_core_read.h`, `bpf/bpf_helpers.h`, `bpf/bpf_tracing.h`, `profiler.h`, `err.h`, `bpf_experimental.h`, `bpf_compiler.h`.
- Detected declarations: `struct var_kill_data_arr_t`, `struct kernfs_iattrs___52`, `struct kernfs_node___52`, `enum cgroup_subsys_id___local`, `function IS_ERR`, `function get_userspace_pid`, `function is_init_process`, `function probe_read_lim`, `function get_var_spid_index`, `function populate_ancestors`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.