Skip to content

Commit

Permalink
libbpf_tools/profile: Support PID namespace mapping if available in t…
Browse files Browse the repository at this point in the history
…he kernel

Support PID namespace mapping only in kernels where bpf_get_ns_current_pid_tgid
is available.
  • Loading branch information
ekyooo committed Dec 13, 2024
1 parent 257b04c commit 1b40174
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libbpf-tools/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ static int set_pidns(const struct profile_bpf *obj)
{
struct stat statbuf;

if (!probe_bpf_ns_current_pid_tgid())
return -EPERM;

if (stat("/proc/self/ns/pid", &statbuf) == -1)
return -errno;

Expand Down

0 comments on commit 1b40174

Please sign in to comment.