diff --git a/libbpf-tools/profile.c b/libbpf-tools/profile.c index dc27b400aa42..84d3bed57093 100644 --- a/libbpf-tools/profile.c +++ b/libbpf-tools/profile.c @@ -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;