Skip to content

Commit

Permalink
tetragon: Fix TestCopyFd test on new v5.10 kernels
Browse files Browse the repository at this point in the history
Latest 5.10 kernel merged [1] change that removes __fd_install.

Making the test to check on __fd_install/fd_install function
and use related spec accordingly.

[1] 89f9e529643a ("file: Merge __fd_install into fd_install")

Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
olsajiri authored and kkourt committed Oct 24, 2024
1 parent c0e513f commit 63d8f81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sensors/tracing/kprobe_copyfd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/cilium/tetragon/api/v1/tetragon"
ec "github.com/cilium/tetragon/api/v1/tetragon/codegen/eventchecker"
"github.com/cilium/tetragon/pkg/arch"
"github.com/cilium/tetragon/pkg/ftrace"
"github.com/cilium/tetragon/pkg/jsonchecker"
"github.com/cilium/tetragon/pkg/kernels"
bc "github.com/cilium/tetragon/pkg/matchers/bytesmatcher"
Expand Down Expand Up @@ -55,7 +56,7 @@ func TestCopyFd(t *testing.T) {
// __fd_install. fd_install is inlined and if we hook there we miss
// the dup event. For kernels > 5.10 __fd_install is removed.
templatePath := "copyfd-fd_install.yaml.tmpl"
if kernels.IsKernelVersionLessThan("5.11.0") {
if _, err := ftrace.ReadAvailFuncs("^__fd_install$"); err == nil {
templatePath = "copyfd-__fd_install.yaml.tmpl"
}
specName, err := testutils.GetSpecFromTemplate(templatePath, data)
Expand Down

0 comments on commit 63d8f81

Please sign in to comment.