Skip to content

Commit

Permalink
pkg/sensors: fix kprobeEntry.pinPathPrefix for multi kprobes
Browse files Browse the repository at this point in the history
Here is the issue, for example:
- In the case of simple kprobe: map name is: `gkp-sensor-1-gkp-0-name_map`
  with `gk.pinPathPrefix = gkp-sensor-1-gkp-0`
- In the case of multi kprobe: map name is `gkp-sensor-1-multi_kprobe-name_map`
  with `gk.pinPathPrefix = gkp-sensor-1` in the second.

In the case of multi kprobe, the pinPathPrefix is wrong, it should be
`gk.pinPathPrefix = gkp-sensor-1-multi_kprobe`.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
  • Loading branch information
mtardy committed Oct 10, 2023
1 parent 1d73177 commit 8958dbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sensors/tracing/generickprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,10 @@ func addKprobe(funcName string, f *v1alpha1.KProbeSpec, in *addKprobeIn) (out *a
genericKprobeTable.AddEntry(&kprobeEntry)
tidx := kprobeEntry.tableId.ID
out.tableEntryIndex = tidx
kprobeEntry.pinPathPrefix = sensors.PathJoin(in.sensorPath, fmt.Sprintf("gkp-%d", tidx))
config.FuncId = uint32(tidx)

if in.useMulti {
kprobeEntry.pinPathPrefix = sensors.PathJoin(in.sensorPath, "multi_kprobe")
if setRetprobe {
out.multiRetIDs = append(out.multiRetIDs, kprobeEntry.tableId)
}
Expand All @@ -772,6 +772,7 @@ func addKprobe(funcName string, f *v1alpha1.KProbeSpec, in *addKprobeIn) (out *a
return out, nil
}

kprobeEntry.pinPathPrefix = sensors.PathJoin(in.sensorPath, fmt.Sprintf("gkp-%d", tidx))
pinPath := kprobeEntry.pinPathPrefix
pinProg := sensors.PathJoin(pinPath, fmt.Sprintf("%s_prog", kprobeEntry.funcName))

Expand Down

0 comments on commit 8958dbc

Please sign in to comment.