Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Signed-off-by: David Windsor <[email protected]>
  • Loading branch information
dwindsor committed Jun 27, 2024
1 parent ef27820 commit 56d6858
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 35 deletions.
6 changes: 3 additions & 3 deletions pkg/api/tracingapi/client_kprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ func (m MsgGenericKprobeArgLinuxBinprm) IsReturnArg() bool {
}

type MsgGenericKprobeArgDentry struct {
Index uint64
Value string
Label string
Index uint64
Value string
Label string
}

func (m MsgGenericKprobeArgDentry) GetIndex() uint64 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/generictypes/generictypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var GenericStringToType = map[string]int{
"linux_binprm": GenericLinuxBinprmType,
"data_loc": GenericDataLoc,
"net_device": GenericNetDev,
"dentry": GenericDentryType,
"dentry": GenericDentryType,
}

var GenericTypeToStringTable = map[int]string{
Expand Down Expand Up @@ -153,7 +153,7 @@ var GenericTypeToStringTable = map[int]string{
GenericLinuxBinprmType: "linux_binprm",
GenericDataLoc: "data_loc",
GenericNetDev: "net_device",
GenericDentryType: "dentry",
GenericDentryType: "dentry",
GenericInvalidType: "",
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/grpc/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func getKprobeArgument(arg tracingapi.MsgGenericKprobeArg) *tetragon.KprobeArgum
case api.MsgGenericKprobeArgDentry:
lArg := &tetragon.KprobeDentry{
Name: e.Value,
};
}
a.Arg = &tetragon.KprobeArgument_DentryArg{DentryArg: lArg}
a.Label = e.Label
default:
Expand Down
57 changes: 28 additions & 29 deletions pkg/sensors/tracing/kprobe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4235,45 +4235,45 @@ spec:
func TestLoadKprobeSensor(t *testing.T) {
var sensorProgs = []tus.SensorProg{
// kprobe
0: tus.SensorProg{Name: "generic_kprobe_event", Type: ebpf.Kprobe},
1: tus.SensorProg{Name: "generic_kprobe_setup_event", Type: ebpf.Kprobe},
2: tus.SensorProg{Name: "generic_kprobe_process_event", Type: ebpf.Kprobe},
3: tus.SensorProg{Name: "generic_kprobe_filter_arg", Type: ebpf.Kprobe},
4: tus.SensorProg{Name: "generic_kprobe_process_filter", Type: ebpf.Kprobe},
5: tus.SensorProg{Name: "generic_kprobe_actions", Type: ebpf.Kprobe},
6: tus.SensorProg{Name: "generic_kprobe_output", Type: ebpf.Kprobe},
0: {Name: "generic_kprobe_event", Type: ebpf.Kprobe},
1: {Name: "generic_kprobe_setup_event", Type: ebpf.Kprobe},
2: {Name: "generic_kprobe_process_event", Type: ebpf.Kprobe},
3: {Name: "generic_kprobe_filter_arg", Type: ebpf.Kprobe},
4: {Name: "generic_kprobe_process_filter", Type: ebpf.Kprobe},
5: {Name: "generic_kprobe_actions", Type: ebpf.Kprobe},
6: {Name: "generic_kprobe_output", Type: ebpf.Kprobe},
// retkprobe
7: tus.SensorProg{Name: "generic_retkprobe_event", Type: ebpf.Kprobe},
8: tus.SensorProg{Name: "generic_retkprobe_filter_arg", Type: ebpf.Kprobe},
9: tus.SensorProg{Name: "generic_retkprobe_actions", Type: ebpf.Kprobe},
10: tus.SensorProg{Name: "generic_retkprobe_output", Type: ebpf.Kprobe},
7: {Name: "generic_retkprobe_event", Type: ebpf.Kprobe},
8: {Name: "generic_retkprobe_filter_arg", Type: ebpf.Kprobe},
9: {Name: "generic_retkprobe_actions", Type: ebpf.Kprobe},
10: {Name: "generic_retkprobe_output", Type: ebpf.Kprobe},
}

var sensorMaps = []tus.SensorMap{
// all kprobe programs
tus.SensorMap{Name: "process_call_heap", Progs: []uint{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}},
{Name: "process_call_heap", Progs: []uint{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}},

// all but generic_kprobe_output
tus.SensorMap{Name: "kprobe_calls", Progs: []uint{0, 1, 2, 3, 4, 5}},
{Name: "kprobe_calls", Progs: []uint{0, 1, 2, 3, 4, 5}},

// generic_retkprobe_event
tus.SensorMap{Name: "retkprobe_calls", Progs: []uint{7, 8, 9}},
{Name: "retkprobe_calls", Progs: []uint{7, 8, 9}},

// generic_kprobe_process_filter,generic_kprobe_filter_arg,
// generic_kprobe_actions,generic_kprobe_output
tus.SensorMap{Name: "filter_map", Progs: []uint{3, 4, 5}},
{Name: "filter_map", Progs: []uint{3, 4, 5}},

// generic_kprobe_actions
tus.SensorMap{Name: "override_tasks", Progs: []uint{5}},
{Name: "override_tasks", Progs: []uint{5}},

// all kprobe but generic_kprobe_process_filter,generic_retkprobe_event
tus.SensorMap{Name: "config_map", Progs: []uint{0, 1, 2}},
{Name: "config_map", Progs: []uint{0, 1, 2}},

// generic_kprobe_process_event*,generic_kprobe_actions,retkprobe
tus.SensorMap{Name: "fdinstall_map", Progs: []uint{1, 2, 5, 7, 9}},
{Name: "fdinstall_map", Progs: []uint{1, 2, 5, 7, 9}},

// generic_kprobe_event
tus.SensorMap{Name: "tg_conf_map", Progs: []uint{0}},
{Name: "tg_conf_map", Progs: []uint{0}},
}

if kernels.EnableLargeProgs() {
Expand Down Expand Up @@ -6003,7 +6003,7 @@ func TestDentryExtractPath(t *testing.T) {
tus.LoadSensor(t, testsensor.GetTestSensor())
sm := tus.GetTestSensorManager(ctx, t)

testSymlink := testutils.RepoRootPath("contrib/tester-progs/symlink-tester")
testSymlink := testutils.RepoRootPath("contrib/tester-progs/symlink-tester")
dentryTracingPolicy := tracingpolicy.GenericTracingPolicy{
Metadata: v1.ObjectMeta{
Name: "dentry-extract-path",
Expand Down Expand Up @@ -6031,7 +6031,7 @@ func TestDentryExtractPath(t *testing.T) {
MatchBinaries: []v1alpha1.BinarySelector{
{
Operator: "In",
Values: []string{testSymlink},
Values: []string{testSymlink},
},
},
},
Expand All @@ -6043,14 +6043,14 @@ func TestDentryExtractPath(t *testing.T) {

err := sm.Manager.AddTracingPolicy(ctx, &dentryTracingPolicy)
assert.NoError(t, err)

command := exec.Command(testSymlink)
ops := func() {
err = command.Start()
assert.NoError(t, err)
defer command.Process.Kill()
}

ops := func() {
err = command.Start()
assert.NoError(t, err)
defer command.Process.Kill()
}

events := perfring.RunTestEvents(t, ctx, ops)

Expand All @@ -6064,7 +6064,6 @@ func TestDentryExtractPath(t *testing.T) {
t.Error("dentry error")
}


func TestLinuxBinprmExtractPath(t *testing.T) {
testutils.CaptureLog(t, logger.GetLogger().(*logrus.Logger))
ctx, cancel := context.WithTimeout(context.Background(), tus.Conf().CmdWaitTime)
Expand Down

0 comments on commit 56d6858

Please sign in to comment.