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

[btf] Cleanup AddModulesToSpec #2627

Merged
merged 1 commit into from
Jul 12, 2024
Merged

Conversation

tpapagian
Copy link
Member

@tpapagian tpapagian commented Jul 3, 2024

Thanks for contributing! Please ensure your pull request adheres to the following guidelines:

  • All commits contain a well written commit message and are signed-off (see Submitting a pull request).
  • All code is covered by unit and/or end-to-end tests where feasible.
  • All generated files are updated if needed (see Making changes).
  • Provide a title or release-note blurb suitable for the release notes (see guidelines).
  • Update documentation and write an upgrade note if needed (see guidelines).
  • Are you a user of Tetragon? Please add yourself to the Users doc in the Cilium repository.

Now (as of 0.14.0) cilium/ebpf handles kmod BTFs natively (https://pkg.go.dev/github.com/cilium/ebpf#ProgramOptions.KernelModuleTypes).

Thus we can remove some duplicate code (i.e. mainly function AddModulesToSpec). This patch does this cleanup.

In Tetragon, we used kmod BTF in 2 places:

  1. In order to attach to a function which is now handled automatically by cilium/ebpf.
  2. In order to validate if the function name exists in the BTF and to check the argument types. In that case, we need to manually load the spec from the kmod that we care about. This is because cilium/ebpf checks (and loads the appropriate BTF) during the attach phase (i.e. https://github.com/cilium/ebpf/blob/5976561b28aabf23df00f3507cc3b240305b531b/prog.go#L157-L177).
Cleanup code related to handling kmod BTFs.

@tpapagian tpapagian added the release-note/misc This PR makes changes that have no direct user impact. label Jul 3, 2024
Copy link

netlify bot commented Jul 3, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit d2b5292
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/668d0c9b650c5a000751921b
😎 Deploy Preview https://deploy-preview-2627--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tpapagian tpapagian force-pushed the pr/apapag/remove-manual-kmod-handling branch 3 times, most recently from d2b5292 to f7f8557 Compare July 9, 2024 11:34
Now (as of 0.14.0) cilium/ebpf handles kmod BTFs natively
(https://pkg.go.dev/github.com/cilium/ebpf#ProgramOptions.KernelModuleTypes).

Thus we can remove some duplicate code (i.e. mainly function
AddModulesToSpec). This patch does this cleanup.

In Tetragon, we used kmod BTF in 2 places:
1. In order to attach to a function which is now handled automatically by
   cilium/ebpf.
2. In order to validate if the function name exists in the BTF and to check
   the argument types. In that case, we need to manually load the spec
   from the kmod that we care about. This is because cilium/ebpf checks
   (and loads the appropriate BTF) during the attach phase (i.e.
   https://github.com/cilium/ebpf/blob/5976561b28aabf23df00f3507cc3b240305b531b/prog.go#L157-L177)..

Signed-off-by: Anastasios Papagiannis <[email protected]>
@tpapagian tpapagian force-pushed the pr/apapag/remove-manual-kmod-handling branch from f7f8557 to 6194235 Compare July 9, 2024 12:36
@tpapagian tpapagian changed the title WIP: Remove AddModulesToSpec [btf] Cleanup AddModulesToSpec Jul 10, 2024
@tpapagian tpapagian marked this pull request as ready for review July 10, 2024 08:44
@tpapagian tpapagian requested review from mtardy and a team as code owners July 10, 2024 08:44
@tpapagian tpapagian merged commit f44ce8c into main Jul 12, 2024
47 checks passed
@tpapagian tpapagian deleted the pr/apapag/remove-manual-kmod-handling branch July 12, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants