Skip to content

Commit 3c21a7b

Browse files
committed
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 <[email protected]>
1 parent 9a8f892 commit 3c21a7b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/sensors/tracing/generickprobe.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ func addKprobe(funcName string, f *v1alpha1.KProbeSpec, in *addKprobeIn) (out *a
611611
// instructs the BPF kretprobe program which type of copy to use. And
612612
// argReturnPrinters tell golang printer piece how to print the event.
613613
if f.Return {
614+
if f.ReturnArg == nil {
615+
return nil, fmt.Errorf("ReturnArg not specified with Return=true")
616+
}
614617
argType := gt.GenericTypeFromString(f.ReturnArg.Type)
615618
if argType == gt.GenericInvalidType {
616619
if f.ReturnArg.Type == "" {

0 commit comments

Comments
 (0)