Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from kinvolk/mauricio/fix-filtering-by-containe…
Browse files Browse the repository at this point in the history
…rs-opensnoop

src/python: fix filtering by containers when kfunc are supported
  • Loading branch information
mauriciovasquezbernal authored Sep 8, 2021
2 parents fca607f + 7d07e08 commit f0558a8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/python/bcc/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,22 @@
static inline u64 get_mntns_id() {
struct task_struct *current_task;
struct nsproxy *nsproxy;
struct mnt_namespace *mnt_ns;
unsigned int inum;
current_task = (struct task_struct *)bpf_get_current_task();
return current_task->nsproxy->mnt_ns->ns.inum;
if (bpf_probe_read_kernel(&nsproxy, sizeof(nsproxy), &current_task->nsproxy))
return 0;
if (bpf_probe_read_kernel(&mnt_ns, sizeof(mnt_ns), &nsproxy->mnt_ns))
return 0;
if (bpf_probe_read_kernel(&inum, sizeof(inum), &mnt_ns->ns.inum))
return 0;
return (u64) inum;
}
#endif // __GET_MTN_NS_ID
"""
Expand Down

0 comments on commit f0558a8

Please sign in to comment.