-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSM] Track image tags of syscalls in activity trees (#27483)
Co-authored-by: safchain <[email protected]>
- Loading branch information
Showing
12 changed files
with
316 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
pkg/security/security_profile/activity_tree/syscalls_node.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build linux | ||
|
||
// Package activitytree holds activitytree related files | ||
package activitytree | ||
|
||
// SyscallNode is used to store a syscall node | ||
type SyscallNode struct { | ||
ImageTags []string | ||
GenerationType NodeGenerationType | ||
|
||
Syscall int | ||
} | ||
|
||
func (sn *SyscallNode) appendImageTag(imageTag string) { | ||
sn.ImageTags, _ = AppendIfNotPresent(sn.ImageTags, imageTag) | ||
} | ||
|
||
func (sn *SyscallNode) evictImageTag(imageTag string) bool { | ||
imageTags, removed := removeImageTagFromList(sn.ImageTags, imageTag) | ||
if !removed { | ||
return false | ||
} | ||
if len(imageTags) == 0 { | ||
return true | ||
} | ||
sn.ImageTags = imageTags | ||
return false | ||
} | ||
|
||
// NewSyscallNode returns a new SyscallNode instance | ||
func NewSyscallNode(syscall int, imageTag string, generationType NodeGenerationType) *SyscallNode { | ||
var imageTags []string | ||
if len(imageTag) != 0 { | ||
imageTags = append(imageTags, imageTag) | ||
} | ||
return &SyscallNode{ | ||
Syscall: syscall, | ||
GenerationType: generationType, | ||
ImageTags: imageTags, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.