Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added syscalls consts #426

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/containerwatcher/v1/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package containerwatcher

// The numbers can be arbitrary identifiers since they're not actually used for system calls,
// so we don't need to handle other architecture specifically.
const (
SYS_LINKAT = 265
SYS_LINK = 86
SYS_SYMLINKAT = 266
SYS_SYMLINK = 88
SYS_OPEN = 2
SYS_OPENAT = 257
SYS_EXECVE = 59
)
3 changes: 1 addition & 2 deletions pkg/containerwatcher/v1/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
tracerexectype "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/exec/types"
"github.com/inspektor-gadget/inspektor-gadget/pkg/types"
events "github.com/kubescape/node-agent/pkg/ebpf/events"
"golang.org/x/sys/unix"
)

func (ch *IGContainerWatcher) execEventCallback(event *tracerexectype.Event) {
Expand All @@ -16,7 +15,7 @@ func (ch *IGContainerWatcher) execEventCallback(event *tracerexectype.Event) {
}

execEvent := &events.ExecEvent{Event: *event}
ch.enrichEvent(execEvent, []uint64{unix.SYS_EXECVE, unix.SYS_EXECVEAT})
ch.enrichEvent(execEvent, []uint64{SYS_EXECVE})

if event.Retval > -1 && event.Comm != "" {
ch.execWorkerChan <- execEvent
Expand Down
3 changes: 1 addition & 2 deletions pkg/containerwatcher/v1/hardlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

tracerhardlink "github.com/kubescape/node-agent/pkg/ebpf/gadgets/hardlink/tracer"
tracerhardlinktype "github.com/kubescape/node-agent/pkg/ebpf/gadgets/hardlink/types"
"golang.org/x/sys/unix"

"github.com/inspektor-gadget/inspektor-gadget/pkg/types"
"github.com/kubescape/go-logger"
Expand All @@ -22,7 +21,7 @@ func (ch *IGContainerWatcher) hardlinkEventCallback(event *tracerhardlinktype.Ev
return
}

ch.enrichEvent(event, []uint64{unix.SYS_LINK, unix.SYS_LINKAT})
ch.enrichEvent(event, []uint64{SYS_LINK, SYS_LINKAT})

ch.hardlinkWorkerChan <- event
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/containerwatcher/v1/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
traceropentype "github.com/inspektor-gadget/inspektor-gadget/pkg/gadgets/trace/open/types"
"github.com/inspektor-gadget/inspektor-gadget/pkg/types"
events "github.com/kubescape/node-agent/pkg/ebpf/events"
"golang.org/x/sys/unix"
)

func (ch *IGContainerWatcher) openEventCallback(event *traceropentype.Event) {
Expand All @@ -16,7 +15,7 @@ func (ch *IGContainerWatcher) openEventCallback(event *traceropentype.Event) {
}

openEvent := &events.OpenEvent{Event: *event}
ch.enrichEvent(openEvent, []uint64{unix.SYS_OPEN, unix.SYS_OPENAT})
ch.enrichEvent(openEvent, []uint64{SYS_OPEN, SYS_OPENAT})

if event.Err > -1 && event.FullPath != "" {
ch.openWorkerChan <- openEvent
Expand Down
3 changes: 1 addition & 2 deletions pkg/containerwatcher/v1/symlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

tracersymlink "github.com/kubescape/node-agent/pkg/ebpf/gadgets/symlink/tracer"
tracersymlinktype "github.com/kubescape/node-agent/pkg/ebpf/gadgets/symlink/types"
"golang.org/x/sys/unix"

"github.com/inspektor-gadget/inspektor-gadget/pkg/types"
"github.com/kubescape/go-logger"
Expand All @@ -17,7 +16,7 @@ func (ch *IGContainerWatcher) symlinkEventCallback(event *tracersymlinktype.Even
return
}

ch.enrichEvent(event, []uint64{unix.SYS_SYMLINK, unix.SYS_SYMLINKAT})
ch.enrichEvent(event, []uint64{SYS_SYMLINK, SYS_SYMLINKAT})

if isDroppedEvent(event.Type, event.Message) {
logger.L().Ctx(ch.ctx).Warning("symlink tracer got drop events - we may miss some realtime data", helpers.Interface("event", event), helpers.String("error", event.Message))
Expand Down
Loading