Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/operators: Fix tracing host events for mount namespace ID attache… #2879

Merged
merged 1 commit into from
May 24, 2024

Conversation

eiffel-fl
Copy link
Member

Hi.

This PR fixes --host for attacher-based gadgets relying on the mount namespace ID, like traceloop and advise seccomp-profile:

$ sudo ./ig traceloop --host > /tmp/out
^C%
$ grep ig /tmp/out
                               4   47530            ig               nanosleep                                                   un…
                               7   47530            ig               bpf                cmd=3, uattr=0xc0004eb4f0, size=32       0  
                               6   47530            ig               bpf                cmd=3, uattr=0xc0035394f0, size=32       0  
                               7   47530            ig               bpf                cmd=3, uattr=0xc0004eb4f0, size=32       0  
                               6   47530            ig               bpf                cmd=3, uattr=0xc0035394f0, size=32       0  
                               7   47530            ig               bpf                cmd=3, uattr=0xc0004eb4f0, size=32       0  
                               6   47530            ig               bpf                cmd=3, uattr=0xc0035394f0, size=32       0  
                               6   47530            ig               bpf                                                         un…
                               7   47530            ig               bpf                cmd=3, uattr=0xc0004eb4f0, size=32       0  
                               7   47530            ig               bpf

Best regards.

@eiffel-fl eiffel-fl requested a review from flyth as a code owner May 21, 2024 13:45
@eiffel-fl eiffel-fl linked an issue May 21, 2024 that may be closed by this pull request
…r gadgets.

Some attacher-based gadgets, like traceloop and advise seccomp-profile, need
the mount namespace ID of the container to bet set.
With --host, we only created a fake container structure containing only PID 1.
So, traceloop and advise seccomp-profile would not work correctly as their
required information were not set.

To cope with this, we extend the fake container structure to also contain the
mount namespace ID of PID 1.

Fixes: 740976d ("pkg/operators: Enable tracing hosts events for attacher gadgets.")
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from code inspection.

@eiffel-fl eiffel-fl merged commit 7fcc15d into main May 24, 2024
60 checks passed
@eiffel-fl eiffel-fl deleted the francis/fix-traceloop-host branch May 24, 2024 08:22
@eiffel-fl
Copy link
Member Author

Thank you for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

traceloop does not work with --host
3 participants