Skip to content

Comments

link: allow retrieving perf event file descriptor#1425

Merged
lmb merged 1 commit intocilium:mainfrom
lmb:link-perf-event
May 13, 2024
Merged

link: allow retrieving perf event file descriptor#1425
lmb merged 1 commit intocilium:mainfrom
lmb:link-perf-event

Conversation

@lmb
Copy link
Contributor

@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 <[email protected]>

@lmb
Copy link
Contributor 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 force-pushed the link-perf-event branch from 1b31772 to 79f84b6 Compare May 13, 2024 11:34
@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
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 <[email protected]>
@lmb lmb force-pushed the link-perf-event branch from 79f84b6 to ed63650 Compare May 13, 2024 15:57
@lmb lmb merged commit 1e6cad5 into cilium:main May 13, 2024
@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.

3 participants