Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions agent/src/ebpf/user/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ int mount_info_cache_init(const char *name)

struct mount_info *mount_info_cache_lookup(pid_t pid, u64 mntns_id)
{
if (!enable_mount_info_cache())
return MOUNT_INFO_INVAL;

if (mntns_id == 0 && pid > 0) {
if (get_mount_ns_id(pid, &mntns_id))
return MOUNT_INFO_INVAL;
Expand Down Expand Up @@ -552,6 +555,9 @@ static int check_mount_kvp_cb(mount_info_hash_kv * kvp, void *ctx)

void collect_mount_info_stats(bool output_log)
{
if (!enable_mount_info_cache())
return;

u64 elems_count = 0;
mount_info_hash_t *h = &mount_info_hash;
mount_info_hash_foreach_key_value_pair(h,
Expand Down Expand Up @@ -592,6 +598,9 @@ void check_and_cleanup_mount_info(pid_t pid, u64 mntns_id)
// Periodically check whether the host node's mount information has changed.
void check_root_mount_info(bool output_log)
{
if (!enable_mount_info_cache())
return;

u32 new_hash = 0;
hash_mountinfo_file(1, &new_hash);
if (new_hash != 0 && new_hash != host_root_mountinfo_hash) {
Expand Down
5 changes: 4 additions & 1 deletion agent/src/ebpf/user/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,10 @@ void *get_symbol_cache(pid_t pid, bool new_cache)
int create_and_init_proc_info_caches(void)
{
// Initialize the mount information cache.
mount_info_cache_init("mount-info-cache");
if (mount_info_cache_init("mount-info-cache")) {
ebpf_warning("mount_info_cache_init() failed.\n");
return ETR_NOMEM;
}

/*
* Building a 'proc_event_ring' for handling process events.
Expand Down
3 changes: 2 additions & 1 deletion agent/src/ebpf/user/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,8 @@ int running_socket_tracer(tracer_callback_t handle,
socket_tracer_set_probes(tps);
golang_trace_init();
openssl_trace_init();
create_and_init_proc_info_caches();
if ((ret = create_and_init_proc_info_caches()))
return ret;

struct bpf_tracer *tracer =
setup_bpf_tracer(SK_TRACER_NAME, bpf_load_buffer_name,
Expand Down
Loading