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

link: allow retrieving perf event file descriptor #1425

Merged
merged 1 commit into from May 13, 2024

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Apr 10, 2024

link: allow retrieving perf event file descriptor

Tetragon needs access to the underlying perf event file descriptor to
perform black magic on older kernels. Expose this via an additional
PerfEvent interface that users can assert.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

@lmb
Copy link
Collaborator Author

lmb commented Apr 10, 2024

Use would be something like:

kp, _ := Kprobe()

if pe, ok := kp.(link.PerfEvent); ok {
   file, err := pe.PerfEvent()
}

// Same for Uprobe
  • Naming of the method isn't great :(
  • I'll document this in the exported callers of attachPerfEvent, but still hard to discover. Probably OK since this is a power user thing anyways?

@olsajiri
Copy link
Contributor

using it in here cilium/tetragon@9098f1e , seems to work nicely, thanks

@lmb lmb marked this pull request as ready for review May 13, 2024 11:34
@lmb lmb requested a review from mmat11 as a code owner May 13, 2024 11:34
link/perf_event.go Outdated Show resolved Hide resolved
Tetragon needs access to the underlying perf event file descriptor
to perform black magic on older kernels. Expose this via an
additional PerfEvent interface that users can assert.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb merged commit 1e6cad5 into cilium:main May 13, 2024
17 checks passed
@lmb lmb deleted the link-perf-event branch May 13, 2024 16:58
@olsajiri
Copy link
Contributor

great, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants