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

Filter out host processes by host mntns to prevent ebpf map from filling up during recording #1166

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

neblen
Copy link
Contributor

@neblen neblen commented Sep 13, 2022

Filter out host processes by host mntns to prevent ebpf map from filling up during recording

What type of PR is this?

/kind bug

What this PR does / why we need it:

The current ebpf code saves a lot of host process information, but none of this information is needed. This will cause the ebpf map to fill up during recording. I use the host mntns to filter out the host process so that the data in the ebpf map is only the pid we need to record

Which issue(s) this PR fixes:

Fixes #1165
#1165

Does this PR have test?

N

Special notes for your reviewer:

Does this PR introduce a user-facing change?

N

Filtering host processes by host mount namespace to prevent ebpf map from filling up during recording.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 13, 2022
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 13, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 13, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @neblen!

It looks like this is your first PR to kubernetes-sigs/security-profiles-operator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/security-profiles-operator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 13, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @neblen. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 13, 2022
@saschagrunert
Copy link
Member

Thank you for the PR @neblen, we really appreciate that! May I ask you to sign your commits by signing the EasyCLA?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 13, 2022
@neblen neblen force-pushed the fix/ebpf-with-mntns branch from ee75717 to b38063e Compare September 13, 2022 11:48
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 13, 2022
@saschagrunert
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 13, 2022
@neblen neblen force-pushed the fix/ebpf-with-mntns branch from b38063e to 1b81911 Compare September 13, 2022 15:15
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Lets run make update-mocks to re-generate the code.

internal/pkg/daemon/bpfrecorder/bpfrecorder.go Outdated Show resolved Hide resolved
internal/pkg/daemon/bpfrecorder/bpfrecorder.go Outdated Show resolved Hide resolved
@neblen neblen force-pushed the fix/ebpf-with-mntns branch 2 times, most recently from 6f9d5d2 to ed7aea1 Compare September 14, 2022 12:38
@saschagrunert
Copy link
Member

The CI does not seem to be happy about the changes :)

@neblen
Copy link
Contributor Author

neblen commented Sep 14, 2022

The CI does not seem to be happy about the changes :)

It seems that some test cases have not been run, I will check first

@neblen neblen force-pushed the fix/ebpf-with-mntns branch from ed7aea1 to 8bc3258 Compare September 15, 2022 14:11
@neblen
Copy link
Contributor Author

neblen commented Sep 15, 2022

/retest

@neblen neblen removed the request for review from jhrozek September 15, 2022 14:23
@neblen
Copy link
Contributor Author

neblen commented Sep 15, 2022

The CI does not seem to be happy about the changes :)

It seems that some test cases have not been run, I will check first
Here is a test case for systemmntns, it seems that it is not needed at present, I deleted it.Please retest again.Thanks.

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2022

Codecov Report

Merging #1166 (8ee4226) into main (9a9836f) will decrease coverage by 0.06%.
The diff coverage is 50.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1166      +/-   ##
==========================================
- Coverage   48.65%   48.58%   -0.07%     
==========================================
  Files          43       43              
  Lines        4779     4794      +15     
==========================================
+ Hits         2325     2329       +4     
- Misses       2358     2367       +9     
- Partials       96       98       +2     

@neblen
Copy link
Contributor Author

neblen commented Sep 16, 2022

@saschagrunert Hi~ There are still some use cases that fail. I don't know why it didn't pass, would you help me watch it? I'm not particularly familiar with spo's test case flow

@saschagrunert
Copy link
Member

@neblen please rebase, this should fix the CI now. :)

@neblen neblen force-pushed the fix/ebpf-with-mntns branch from 8bc3258 to 905a7a4 Compare September 16, 2022 15:10
@neblen
Copy link
Contributor Author

neblen commented Sep 16, 2022

@neblen please rebase, this should fix the CI now. :)

@saschagrunert Ok, I have updated the main branch code to the fix/ebpf-with-mntns branch.

@neblen
Copy link
Contributor Author

neblen commented Sep 17, 2022

@neblen please rebase, this should fix the CI now. :)

@saschagrunert Hi~ The pull-security-profiles-operator-verify pipeline didn't pass.But I can't see what is directly causing the failure.
image

@neblen neblen force-pushed the fix/ebpf-with-mntns branch 2 times, most recently from 238d39b to ac11d7a Compare September 17, 2022 12:59
@saschagrunert
Copy link
Member

saschagrunert commented Sep 19, 2022

@neblen the linter times-out:

level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
make: *** [Makefile:344: verify-go-lint] Error 4

I assume thats because the diff of internal/pkg/daemon/bpfrecorder/generated.go looks way too huge, I run make update-bpf and re-commit it.

@saschagrunert
Copy link
Member

/lgtm

Thank you again for you contribution, we really appreciate you time and effort on this topic!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 19, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neblen, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 19, 2022
@k8s-ci-robot k8s-ci-robot merged commit 52a91a1 into kubernetes-sigs:main Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When profilerecording is running, the ebpf map may be full, causing the recording to fail
4 participants