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: make KprobeMultiOptions.Addresses a []uintptr #913

Merged
merged 1 commit into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion link/kprobe_multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type KprobeMultiOptions struct {
// limits the attach point to the function entry or return.
//
// Mutually exclusive with Symbols.
Addresses []uint64
Addresses []uintptr

// Cookies specifies arbitrary values that can be fetched from an eBPF
// program via `bpf_get_attach_cookie()`.
Expand Down
5 changes: 2 additions & 3 deletions link/kprobe_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package link

import (
"errors"
"math"
"os"
"testing"

Expand Down Expand Up @@ -40,7 +39,7 @@ func TestKprobeMultiInput(t *testing.T) {
// Symbols and Addresses are mutually exclusive.
_, err = KprobeMulti(prog, KprobeMultiOptions{
Symbols: []string{"foo"},
Addresses: []uint64{1},
Addresses: []uintptr{1},
})
if !errors.Is(err, errInvalidInput) {
t.Fatalf("expected errInvalidInput, got: %v", err)
Expand Down Expand Up @@ -70,7 +69,7 @@ func TestKprobeMultiErrors(t *testing.T) {
// Only have a negative test for addresses as it would be hard to maintain a
// proper one.
if _, err := KprobeMulti(prog, KprobeMultiOptions{
Addresses: []uint64{math.MaxUint64},
Addresses: []uintptr{^uintptr(0)},
}); !errors.Is(err, unix.EINVAL) {
t.Fatalf("expected EINVAL, got: %s", err)
}
Expand Down