From 3c21a7b9f653ca73da9f91529b6e2d5f398104f6 Mon Sep 17 00:00:00 2001 From: Kornilios Kourtis Date: Wed, 27 Sep 2023 17:41:51 +0200 Subject: [PATCH] tracing: check for empty returnArg 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 --- pkg/sensors/tracing/generickprobe.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/sensors/tracing/generickprobe.go b/pkg/sensors/tracing/generickprobe.go index 915a8183e16..1a57bbaddcb 100644 --- a/pkg/sensors/tracing/generickprobe.go +++ b/pkg/sensors/tracing/generickprobe.go @@ -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 == "" {