tetragon: avoid segfault of eventcache is disabled #243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exec sensor missed check for execcache != nil and attempts to query the
execcache even though its a nil pointer.
To fix simply check ptr for nil. Perhaps we should hide these behind a
fake interface, but not sure its worth it really.
This fixes the following,
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x15835df]
goroutine 68 [running]:
testing.tRunner.func1.2({0x170cf40, 0x27c6850})
/usr/local/go/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1392 +0x39f
panic({0x170cf40, 0x27c6850})
/usr/local/go/src/runtime/panic.go:838 +0x207
github.com/cilium/tetragon/pkg/eventcache.(*Cache).Add(...)
/home/john/go/src/github.com/cilium/tetragon/pkg/eventcache/eventcache.go:181
github.com/cilium/tetragon/pkg/grpc/exec.(*MsgExecveEventUnix).HandleMessage(0xc000239ad0)
/home/john/go/src/github.com/cilium/tetragon/pkg/grpc/exec/exec.go:79 +0x1ff
github.com/cilium/tetragon/pkg/grpc.(*ProcessManager).Notify(0xf?, {0x1bc9640, 0xc000239ad0})
/home/john/go/src/github.com/cilium/tetragon/pkg/grpc/process_manager.go:68 +0x2c
github.com/cilium/tetragon/pkg/observer.(*Observer).observerListeners(0xc000b0a240, {0x1bc9640, 0xc000239ad0})
/home/john/go/src/github.com/cilium/tetragon/pkg/observer/observer.go:64 +0xb3
Signed-off-by: John Fastabend [email protected]