-
Notifications
You must be signed in to change notification settings - Fork 107
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
BPF Recorder: Exclude Container Initialization from Recorded Profile #2623
base: main
Are you sure you want to change the base?
Conversation
Hi @mhils. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2623 +/- ##
==========================================
- Coverage 45.50% 41.42% -4.09%
==========================================
Files 79 109 +30
Lines 7782 18227 +10445
==========================================
+ Hits 3541 7550 +4009
- Misses 4099 10177 +6078
- Partials 142 500 +358 |
@mhils: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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-sigs/prow repository. I understand the commands that are listed here. |
5c92641
to
44a3190
Compare
d710ac4
to
ed678c9
Compare
It is an impressive reduction in permissions in both apapmror and secocmp. 🤞 that this works! |
22776c3
to
ecd6cb1
Compare
fd8559b
to
ddee8ef
Compare
4c10716
to
d9e0956
Compare
d9e0956
to
86ae5be
Compare
@@ -51,6 +53,9 @@ char LICENSE[] SEC("license") = "Dual BSD/GPL"; | |||
#define unlikely(x) __builtin_expect((x), 0) | |||
#endif | |||
|
|||
#define trace_hook(...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this look like an empty macro, I would remove it if it is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent here is that one can quickly toggle between no-op and bpf_printk, which makes debugging BPF much nicer. Does that make sense, any better suggestions?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ccojocar, mhils 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 |
86ae5be
to
ba9a899
Compare
New changes are detected. LGTM label has been removed. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR makes us 1) detect when containers are (about to be) initialized, and 2) makes sure the permissions exercised before this point are not included in the recorded profile.
Which issue(s) this PR fixes:
Fixes #2576
Does this PR have test?
Covered by existing E2E tests.
Special notes for your reviewer:
99% sure that some kernels won't supportsched_prepare_exec
, but let's see if it works in the first place before we revise.Switched from sched_prepare_exec to an execve tracepoint.Switched from execve to setsid to make sure we capture the last part of runc startup for seccomp.Switched from execve to getppid in an attempt to make things more reliable.Switched to an approach where we detect the initial
unshare
and then start suppressing events until runc reachesgetppid
. This avoids data races on the Go side.Does this PR introduce a user-facing change?