exec

package
v0.8.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright Authors of Tetragon

Index

Constants

View Source
const (
	ParentRefCnt  = 0
	ProcessRefCnt = 1
)
View Source
const (
	CacheTimerMs = 100
)

Variables

View Source
var (
	AllEvents []*tetragon.GetEventsResponse
	BasePid   uint32 = 46987
)

Functions

func CheckCloneEvents

func CheckCloneEvents(t *testing.T, events []*tetragon.GetEventsResponse, currentPid uint32, clonePid uint32)

func CheckExecEvents

func CheckExecEvents(t *testing.T, events []*tetragon.GetEventsResponse, parentPid uint32, currentPid uint32)

func CheckPodEvents

func CheckPodEvents(t *testing.T, events []*tetragon.GetEventsResponse)

func CheckProcessEqual

func CheckProcessEqual(t *testing.T, p1, p2 *tetragon.Process)

func CreateCloneEvents

func CreateCloneEvents[CLONE notify.Message, EXIT notify.Message](Pid uint32, Ktime uint64, ParentPid uint32, ParentKtime uint64) (*CLONE, *EXIT)

func CreateEvents

func CreateEvents[EXEC notify.Message, EXIT notify.Message](Pid uint32, Ktime uint64, ParentPid uint32, ParentKtime uint64, Docker string) (*EXEC, *EXEC, *EXEC, *EXIT)

func GetProcessExec

func GetProcessExec(event *MsgExecveEventUnix, useCache bool) *tetragon.ProcessExec

GetProcessExec returns Exec protobuf message for a given process, including the ancestor list.

func GetProcessExit

func GetProcessExit(event *MsgExitEventUnix) *tetragon.ProcessExit

GetProcessExit returns Exit protobuf message for a given process.

func GetProcessRefcntFromCache

func GetProcessRefcntFromCache(t *testing.T, Pid uint32, Ktime uint64) uint32

func GrpcDelayedExecK8sOutOfOrder

func GrpcDelayedExecK8sOutOfOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exit and an exex event (out-of-order). We get the appopriate pod info after the exit event.

func GrpcExecCloneInOrder

func GrpcExecCloneInOrder[EXEC notify.Message, CLONE notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecCloneOutOfOrder

func GrpcExecCloneOutOfOrder[EXEC notify.Message, CLONE notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecInOrder

func GrpcExecInOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecMisingParent

func GrpcExecMisingParent[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecOutOfOrder

func GrpcExecOutOfOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecParentOutOfOrder

func GrpcExecParentOutOfOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func GrpcExecPodInfoDelayedInOrder

func GrpcExecPodInfoDelayedInOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exec and an exit event (in-order). During both events we also miss pod info. We get pod info after at least one cache GC round.

func GrpcExecPodInfoDelayedOutOfOrder

func GrpcExecPodInfoDelayedOutOfOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exit and an exec event (out-of-order). During the exit event we also miss pod info. We get pod info after at least one cache GC round. In this case exit event should go through the eventcache (missed pod and process info). Once we get the exec info we still have to keep the exit event in the eventcache.

func GrpcExecPodInfoInOrder

func GrpcExecPodInfoInOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exec and an exit event (in-order) but we miss Pod info. Both of these go through the eventcache to get the pod info. At the end both should have correct pod info and the exit event should also have full process info.

func GrpcExecPodInfoInOrderAfter

func GrpcExecPodInfoInOrderAfter[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exec and an exit event (in-order). During the exec event we miss pod info. We get pod info before getting the exit event. In this case exec event should go through the eventcache (missed pod info) and exit event should also go through the cache as the procCache has not been updated yet. At the end both should have correct pod info and the exit event should also have full process info.

func GrpcExecPodInfoOutOfOrder

func GrpcExecPodInfoOutOfOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exit and an exec event (out-of-order) and we also miss Pod info. Both of these go through the eventcache to get the pod info and process info. At the end both should have correct pod info and the exit event should also have full process info.

func GrpcExecPodInfoOutOfOrderAfter

func GrpcExecPodInfoOutOfOrderAfter[EXEC notify.Message, EXIT notify.Message](t *testing.T)

In this case, we get an exit and an exec event (out-of-order). During the exit event we also miss pod info. We get pod info before getting the exec event. In this case exit event should go through the eventcache (missed pod and process info) and exec event should not go through the cache as we have everything. At the end both should have correct pod info and the exit event should also have full process info.

func GrpcMissingExec

func GrpcMissingExec[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func GrpcParentInOrder

func GrpcParentInOrder[EXEC notify.Message, EXIT notify.Message](t *testing.T)

func InitEnv

func InitEnv[EXEC notify.Message, EXIT notify.Message](t *testing.T, cancelWg *sync.WaitGroup, watcher watcher.K8sResourceWatcher) context.CancelFunc

Types

type DummyNotifier

type DummyNotifier[EXEC notify.Message, EXIT notify.Message] struct {
	// contains filtered or unexported fields
}

func (DummyNotifier[EXEC, EXIT]) AddListener

func (n DummyNotifier[EXEC, EXIT]) AddListener(listener server.Listener)

func (DummyNotifier[EXEC, EXIT]) NotifyListener

func (n DummyNotifier[EXEC, EXIT]) NotifyListener(original interface{}, processed *tetragon.GetEventsResponse)

func (DummyNotifier[EXEC, EXIT]) RemoveListener

func (n DummyNotifier[EXEC, EXIT]) RemoveListener(listener server.Listener)

type MsgCgroupEventUnix

type MsgCgroupEventUnix struct {
	processapi.MsgCgroupEvent
}

func (*MsgCgroupEventUnix) Cast

func (msg *MsgCgroupEventUnix) Cast(o interface{}) notify.Message

func (*MsgCgroupEventUnix) HandleMessage

func (msg *MsgCgroupEventUnix) HandleMessage() *tetragon.GetEventsResponse

func (*MsgCgroupEventUnix) Notify

func (msg *MsgCgroupEventUnix) Notify() bool

func (*MsgCgroupEventUnix) Retry

func (msg *MsgCgroupEventUnix) Retry(internal *process.ProcessInternal, ev notify.Event) error

func (*MsgCgroupEventUnix) RetryInternal

func (msg *MsgCgroupEventUnix) RetryInternal(ev notify.Event, timestamp uint64) (*process.ProcessInternal, error)

type MsgCloneEventUnix

type MsgCloneEventUnix struct {
	processapi.MsgCloneEvent
}

func (*MsgCloneEventUnix) Cast

func (msg *MsgCloneEventUnix) Cast(o interface{}) notify.Message

func (*MsgCloneEventUnix) HandleMessage

func (msg *MsgCloneEventUnix) HandleMessage() *tetragon.GetEventsResponse

func (*MsgCloneEventUnix) Notify

func (msg *MsgCloneEventUnix) Notify() bool

func (*MsgCloneEventUnix) Retry

func (msg *MsgCloneEventUnix) Retry(internal *process.ProcessInternal, ev notify.Event) error

func (*MsgCloneEventUnix) RetryInternal

func (msg *MsgCloneEventUnix) RetryInternal(ev notify.Event, timestamp uint64) (*process.ProcessInternal, error)

type MsgExecveEventUnix

type MsgExecveEventUnix struct {
	processapi.MsgExecveEventUnix
}

func (*MsgExecveEventUnix) Cast

func (msg *MsgExecveEventUnix) Cast(o interface{}) notify.Message

func (*MsgExecveEventUnix) HandleMessage

func (msg *MsgExecveEventUnix) HandleMessage() *tetragon.GetEventsResponse

func (*MsgExecveEventUnix) Notify

func (msg *MsgExecveEventUnix) Notify() bool

func (*MsgExecveEventUnix) Retry

func (msg *MsgExecveEventUnix) Retry(internal *process.ProcessInternal, ev notify.Event) error

func (*MsgExecveEventUnix) RetryInternal

func (msg *MsgExecveEventUnix) RetryInternal(ev notify.Event, timestamp uint64) (*process.ProcessInternal, error)

type MsgExitEventUnix

type MsgExitEventUnix struct {
	tetragonAPI.MsgExitEvent
	RefCntDone [2]bool
}

func (*MsgExitEventUnix) Cast

func (msg *MsgExitEventUnix) Cast(o interface{}) notify.Message

func (*MsgExitEventUnix) HandleMessage

func (msg *MsgExitEventUnix) HandleMessage() *tetragon.GetEventsResponse

func (*MsgExitEventUnix) Notify

func (msg *MsgExitEventUnix) Notify() bool

func (*MsgExitEventUnix) Retry

func (msg *MsgExitEventUnix) Retry(internal *process.ProcessInternal, ev notify.Event) error

func (*MsgExitEventUnix) RetryInternal

func (msg *MsgExitEventUnix) RetryInternal(ev notify.Event, timestamp uint64) (*process.ProcessInternal, error)

type MsgProcessCleanupEventUnix

type MsgProcessCleanupEventUnix struct {
	PID        uint32
	Ktime      uint64
	RefCntDone [2]bool
}

func (*MsgProcessCleanupEventUnix) Cast

func (msg *MsgProcessCleanupEventUnix) Cast(o interface{}) notify.Message

func (*MsgProcessCleanupEventUnix) HandleMessage

func (*MsgProcessCleanupEventUnix) Notify

func (msg *MsgProcessCleanupEventUnix) Notify() bool

func (*MsgProcessCleanupEventUnix) Retry

func (*MsgProcessCleanupEventUnix) RetryInternal

func (msg *MsgProcessCleanupEventUnix) RetryInternal(ev notify.Event, timestamp uint64) (*process.ProcessInternal, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL