-
Notifications
You must be signed in to change notification settings - Fork 95
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
Wrap bpf_prog_attach
and bpf_prog_detach2
#335
Wrap bpf_prog_attach
and bpf_prog_detach2
#335
Conversation
libbpfgo.go
Outdated
) | ||
|
||
// Attach attaches the BPFProgram to a targetFd at the specified attachType hook. | ||
func (p *BPFProg) Attach(targetFd int, attachType BPFAttachType, flags AttachFlag) error { |
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.
We have AttachGeneric
which is similar, but does not allow to specify a fd to attach to. Should we name this AttachGenericFD
?
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.
I also see that you're using it for attaching a program to a cgroupFD (Which could be done by the attach_cgroup method, no ?). I want to understand if:
-
should we make attachgeneric generic enough to allow a fd to attach to ? (or is it just the cgroup case and then we already have an attachment function for it that could be used and/or changed)
-
this is a specific need for something else (then we should either change AttachGeneric OR the selftest to differentiate between the cgroup attachment).
WDYT ?
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.
We have
AttachGeneric
which is similar, but does not allow to specify a fd to attach to. Should we name thisAttachGenericFD
?
SGTM. I'll rename it to AttachGenericFD
.
I also see that you're using it for attaching a program to a cgroupFD (Which could be done by the attach_cgroup method, no ?)
That program can't be attached by the attach_cgroup method.
should we make attachgeneric generic enough to allow a fd to attach to ? (or is it just the cgroup case and then we already have an attachment function for it that could be used and/or changed)
That would be a breaking change and would make the attachgeneric method very complex. we should avoid it.
this is a specific need for something else (then we should either change AttachGeneric OR the selftest to differentiate between the cgroup attachment).
Yes, This is a specific method for attaching cgroup, sockops, flow_dissector, lirc_mode2, and sockmap programs.
I'll change the selftest to attach a sockmap program.
6c516ad
to
a2bbae9
Compare
a2bbae9
to
47888e0
Compare
@rafaeldtinoco ping~ |
@mozillazg sorry, been busy with our tracee release. |
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
Thanks for your contribution, as always. |
…-libbpf-1.2 (#2013) [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/aquasecurity/libbpfgo](https://github.com/aquasecurity/libbpfgo) | require | minor | `v0.4.9-libbpf-1.2.0.0.20230817212518-21cf435d454e` -> `v0.5.0-libbpf-1.2` | --- ### Release Notes <details> <summary>aquasecurity/libbpfgo (github.com/aquasecurity/libbpfgo)</summary> ### [`v0.5.0-libbpf-1.2`](https://github.com/aquasecurity/libbpfgo/releases/tag/v0.5.0-libbpf-1.2) #### What's Changed - revive: update revive rules by [@​rafaeldtinoco](https://github.com/rafaeldtinoco) in [https://github.com/aquasecurity/libbpfgo/pull/333](https://github.com/aquasecurity/libbpfgo/pull/333) - Wrap `bpf_prog_attach` and `bpf_prog_detach2` by [@​mozillazg](https://github.com/mozillazg) in [https://github.com/aquasecurity/libbpfgo/pull/335](https://github.com/aquasecurity/libbpfgo/pull/335) - ci: running tests on multiple go versions by [@​mozillazg](https://github.com/mozillazg) in [https://github.com/aquasecurity/libbpfgo/pull/336](https://github.com/aquasecurity/libbpfgo/pull/336) - libbpf: bump to v1.2.2 by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/342](https://github.com/aquasecurity/libbpfgo/pull/342) - fix: vagrant image install by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/341](https://github.com/aquasecurity/libbpfgo/pull/341) - Add SkipMemlockBump to NewModuleArgs by [@​bobrik](https://github.com/bobrik) in [https://github.com/aquasecurity/libbpfgo/pull/337](https://github.com/aquasecurity/libbpfgo/pull/337) - fix: trim quote characters in osinfo by [@​NDStrahilevitz](https://github.com/NDStrahilevitz) in [https://github.com/aquasecurity/libbpfgo/pull/344](https://github.com/aquasecurity/libbpfgo/pull/344) - helpers: handle non numeric kernel versions by [@​NDStrahilevitz](https://github.com/NDStrahilevitz) in [https://github.com/aquasecurity/libbpfgo/pull/345](https://github.com/aquasecurity/libbpfgo/pull/345) - osinfo: add support for rhel by [@​NDStrahilevitz](https://github.com/NDStrahilevitz) in [https://github.com/aquasecurity/libbpfgo/pull/347](https://github.com/aquasecurity/libbpfgo/pull/347) - osinfo: support additional alma linux id by [@​NDStrahilevitz](https://github.com/NDStrahilevitz) in [https://github.com/aquasecurity/libbpfgo/pull/348](https://github.com/aquasecurity/libbpfgo/pull/348) - chore: increase timeout for selftests by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/349](https://github.com/aquasecurity/libbpfgo/pull/349) - fix(selftest): handle arm64 function names by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/350](https://github.com/aquasecurity/libbpfgo/pull/350) - dependabot add by [@​gitworkflows](https://github.com/gitworkflows) in [https://github.com/aquasecurity/libbpfgo/pull/351](https://github.com/aquasecurity/libbpfgo/pull/351) - build(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/353](https://github.com/aquasecurity/libbpfgo/pull/353) - build(deps): bump actions/checkout from 2 to 3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/352](https://github.com/aquasecurity/libbpfgo/pull/352) - chore: minor clang format and tidy adjustments by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/358](https://github.com/aquasecurity/libbpfgo/pull/358) - chore: add helpers to dependabot by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/359](https://github.com/aquasecurity/libbpfgo/pull/359) - build(deps): bump github.com/stretchr/testify from 1.8.0 to 1.8.4 in /helpers by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/360](https://github.com/aquasecurity/libbpfgo/pull/360) - build(deps): bump golang.org/x/sys from 0.1.0 to 0.11.0 in /helpers by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/361](https://github.com/aquasecurity/libbpfgo/pull/361) - fix(selftest): kern_version logic by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/362](https://github.com/aquasecurity/libbpfgo/pull/362) - fix(selftest): use channel for sync by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/364](https://github.com/aquasecurity/libbpfgo/pull/364) - Split BPFMap API into managed and unmanaged by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/356](https://github.com/aquasecurity/libbpfgo/pull/356) - fix(map): fix error wrap by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/368](https://github.com/aquasecurity/libbpfgo/pull/368) - fix(helpers): lint err regarding return statement by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/369](https://github.com/aquasecurity/libbpfgo/pull/369) - chore(github): add workflow test by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/370](https://github.com/aquasecurity/libbpfgo/pull/370) - fix: `GetMap()` comment by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/371](https://github.com/aquasecurity/libbpfgo/pull/371) - Map of maps by [@​geyslan](https://github.com/geyslan) in [https://github.com/aquasecurity/libbpfgo/pull/366](https://github.com/aquasecurity/libbpfgo/pull/366) - build(deps): bump golang.org/x/sys from 0.11.0 to 0.12.0 in /helpers by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/375](https://github.com/aquasecurity/libbpfgo/pull/375) - build(deps): bump actions/checkout from 3 to 4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/aquasecurity/libbpfgo/pull/376](https://github.com/aquasecurity/libbpfgo/pull/376) #### New Contributors - [@​bobrik](https://github.com/bobrik) made their first contribution in [https://github.com/aquasecurity/libbpfgo/pull/337](https://github.com/aquasecurity/libbpfgo/pull/337) - [@​gitworkflows](https://github.com/gitworkflows) made their first contribution in [https://github.com/aquasecurity/libbpfgo/pull/351](https://github.com/aquasecurity/libbpfgo/pull/351) - [@​dependabot](https://github.com/dependabot) made their first contribution in [https://github.com/aquasecurity/libbpfgo/pull/353](https://github.com/aquasecurity/libbpfgo/pull/353) **Full Changelog**: aquasecurity/libbpfgo@v0.4.9-libbpf-1.2.0...v0.5.0-libbpf-1.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/parca-dev/parca-agent). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
#91