Skip to content

Commit

Permalink
link/uprobe: allow specifying bpf cookie via options
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Meleleo <mattia.meleleo@elastic.co>
  • Loading branch information
mmat11 committed Feb 14, 2022
1 parent 5eb6852 commit 5eb7ec2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions link/uprobe.go
Expand Up @@ -70,6 +70,11 @@ type UprobeOptions struct {
// github.com/torvalds/linux/commit/1cc33161a83d
// github.com/torvalds/linux/commit/a6ca88b241d5
RefCtrOffset uint64
// Arbitrary value that can be fetched from an eBPF program
// via `bpf_get_attach_cookie()`.
//
// Needs kernel 5.15+.
BpfCookie uint64
}

// To open a new Executable, use:
Expand Down Expand Up @@ -278,6 +283,7 @@ func (ex *Executable) uprobe(symbol string, prog *ebpf.Program, opts *UprobeOpti
pid: pid,
refCtrOffset: opts.RefCtrOffset,
ret: ret,
bpfCookie: opts.BpfCookie,
}

// Use uprobe PMU if the kernel has it available.
Expand Down

0 comments on commit 5eb7ec2

Please sign in to comment.