From d820afefaf1dcb2f68571664f76cdff5cbd2e6b1 Mon Sep 17 00:00:00 2001 From: Anastasios Papagiannis Date: Fri, 28 Jun 2024 14:44:27 +0000 Subject: [PATCH] [grpc/exec] Do not refinc on a nil parent When handling kthreads and we cannot find the parent, we print a warning, but we also call refinc on a nil parent which results in a panic in some cases. This patch fixes that by avoiding the call of refinc in the case where we cannot find a kthread's parent. FIXES: https://github.com/cilium/tetragon/issues/2614 Signed-off-by: Anastasios Papagiannis --- pkg/grpc/exec/kthread_init.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/grpc/exec/kthread_init.go b/pkg/grpc/exec/kthread_init.go index b812eb73098..74d13e29a99 100644 --- a/pkg/grpc/exec/kthread_init.go +++ b/pkg/grpc/exec/kthread_init.go @@ -23,6 +23,7 @@ func (msg *MsgKThreadInitUnix) HandleMessage() *tetragon.GetEventsResponse { parent, err := process.Get(proc.UnsafeGetProcess().ParentExecId) if err != nil { logger.GetLogger().Warnf("Failed to find parent for kernel thread %d", msg.Unix.Msg.Parent.Pid) + return nil } parent.RefInc() return nil