Skip to content

Commit

Permalink
link: disable uprobe tests on v4.9
Browse files Browse the repository at this point in the history
Running v4.9 in vimto, trying to create a perf event via perf_event_open
returns EIO. I've tracked this down to a check in uprobe_register:

    if (!inode->i_mapping->a_ops->readpage && !shmem_mapping(inode->i_mapping))
        return -EIO;

See https://elixir.bootlin.com/linux/v4.9.337/source/kernel/events/uprobes.c#L880

My hunch is that this is related to how vimto sets up the overlayfs mount: if
the probed binary is below the overlayfs the setup fails.

Instead of fixing vimto, stop testing these code paths on v4.9. That kernel
is already EOL so there is not much use in investing more time.

Signed-off-by: Lorenz Bauer <[email protected]>
  • Loading branch information
lmb committed Mar 26, 2024
1 parent a65f3dc commit 73b877d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions link/uprobe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func TestExecutableOffset(t *testing.T) {
}

func TestExecutableLazyLoadSymbols(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

ex, err := OpenExecutable("/bin/bash")
qt.Assert(t, qt.IsNil(err))
// Addresses must be empty, will be lazy loaded.
Expand All @@ -93,6 +95,8 @@ func TestExecutableLazyLoadSymbols(t *testing.T) {
}

func TestUprobe(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

prog := mustLoadProgram(t, ebpf.Kprobe, 0, "")

up, err := bashEx.Uprobe(bashSym, prog, nil)
Expand All @@ -113,6 +117,8 @@ func TestUprobeExtNotFound(t *testing.T) {
}

func TestUprobeExtWithOpts(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

prog := mustLoadProgram(t, ebpf.Kprobe, 0, "")

// NB: It's not possible to invoke the uprobe since we use an arbitrary
Expand All @@ -128,6 +134,8 @@ func TestUprobeExtWithOpts(t *testing.T) {
}

func TestUprobeWithPID(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

prog := mustLoadProgram(t, ebpf.Kprobe, 0, "")

up, err := bashEx.Uprobe(bashSym, prog, &UprobeOptions{PID: os.Getpid()})
Expand All @@ -148,6 +156,8 @@ func TestUprobeWithNonExistentPID(t *testing.T) {
}

func TestUretprobe(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

prog := mustLoadProgram(t, ebpf.Kprobe, 0, "")

up, err := bashEx.Uretprobe(bashSym, prog, nil)
Expand Down Expand Up @@ -214,6 +224,8 @@ func TestUprobePMUUnavailable(t *testing.T) {

// Test tracefs u(ret)probe creation on all kernel versions.
func TestUprobeTraceFS(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

// Fetch the offset from the /bin/bash Executable already defined.
off, err := bashEx.address(bashSym, 0, 0)
qt.Assert(t, qt.IsNil(err))
Expand Down Expand Up @@ -265,6 +277,8 @@ func TestUprobeTraceFS(t *testing.T) {
}

func TestUprobeProgramCall(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

tests := []struct {
name string
elf string
Expand Down Expand Up @@ -345,6 +359,8 @@ func TestUprobeProgramCall(t *testing.T) {
}

func TestUprobeProgramWrongPID(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.14", "uprobe on v4.9 returns EIO on vimto")

m, p := newUpdaterMapProg(t, ebpf.Kprobe, 0)

// Load the '/bin/bash' executable.
Expand Down

0 comments on commit 73b877d

Please sign in to comment.