Skip to content

Is it normal for tracepoint eBPF program inside the container to spit out stuff on the host OS? #1547

Answered by florianl
pedestrianlove asked this question in Q&A
Discussion options

You must be logged in to vote

eBPF programs are attached to events in the Linux kernel. Container environments (e.g. docker) often share the kernel with the host environment. In such scenarios the described behavior is expected.

To limit the eBPF program to a specified virtualized environment, you could check the cgroup of the environment, communicate this cgroup to the eBPF program (e.g. via eBPF maps), and check at the beginning of the eBPF program the cgroup. If the cgroup from user space matches the cgroup from bpf_get_current_cgroup_id then continue your program, otherwise return early.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pedestrianlove
Comment options

@kwakubiney
Comment options

Answer selected by pedestrianlove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants