Skip to content

Commit

Permalink
tracing: check for empty returnArg
Browse files Browse the repository at this point in the history
If returnArg is empty, but return is true, the agent will crash with a
sigsegv. This patch adds a check and returns an error.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Sep 28, 2023
1 parent 9a8f892 commit 3c21a7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/sensors/tracing/generickprobe.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ func addKprobe(funcName string, f *v1alpha1.KProbeSpec, in *addKprobeIn) (out *a
// instructs the BPF kretprobe program which type of copy to use. And
// argReturnPrinters tell golang printer piece how to print the event.
if f.Return {
if f.ReturnArg == nil {
return nil, fmt.Errorf("ReturnArg not specified with Return=true")
}
argType := gt.GenericTypeFromString(f.ReturnArg.Type)
if argType == gt.GenericInvalidType {
if f.ReturnArg.Type == "" {
Expand Down

0 comments on commit 3c21a7b

Please sign in to comment.