-
Notifications
You must be signed in to change notification settings - Fork 97
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
Split tc programs from generic tracer #1267
Conversation
Avoid duplicate or unused symbol generation
49c3e5d
to
e595491
Compare
@@ -98,5 +98,9 @@ func newGoTracersGroup(cfg *beyla.Config, metrics imetrics.Reporter) []ebpf.Trac | |||
} | |||
|
|||
func newGenericTracersGroup(cfg *beyla.Config, metrics imetrics.Reporter) []ebpf.Tracer { | |||
return []ebpf.Tracer{generictracer.New(cfg, metrics), tctracer.New(cfg)} | |||
if cfg.EBPF.UseLinuxTC { | |||
return []ebpf.Tracer{generictracer.New(cfg, metrics), tctracer.New(cfg)} |
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.
This needs to be done here, because simply not calling tctracer.SetupTC()
is not enough. The mere attempt to load the ebpf program (as in ebpf.LoadAndAssign()
), which happens way before SetupTC()
is called, will trigger the kernel verifier in case CAP_NET_ADMIN is not present (which may be a legitmate case when UseLinuxTC is false).
This also keeps the logic giving it visibility where it belongs IMHO.
The original generic_tracer tests comprised just a test for the pid segment bitmap handling functions. It is difficult to test the tracer without privileges, as such test would basically test whether the tracer is being loaded into the kernel and then unloaded. If such a test is nonetheless desired, that can perhaps be worked out by adding one of the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1267 +/- ##
==========================================
- Coverage 80.77% 80.48% -0.30%
==========================================
Files 131 132 +1
Lines 13465 13535 +70
==========================================
+ Hits 10876 10893 +17
- Misses 2079 2127 +48
- Partials 510 515 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
e595491
to
a3ac98b
Compare
a3ac98b
to
538f800
Compare
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.
LGTM! Nice work @rafaelroquetto !
This PR splits the "tc" ebpf programs off
generictracer
. This allows for thetc
programs to be orthogonally loaded, and for more fine grained permissions.In a nutshell, this PR entails:
tc
programs to their own newly created tracer calledtc_tracer
CAP_NET_ADMIN
, which is only required whenBEYLA_BPF_TC=1
.This PR is easier reviewed on a per-commit basis