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

refactor: getStackAddresses doesn't return an err #3414

Merged
Merged
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
9 changes: 5 additions & 4 deletions pkg/ebpf/events_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (t *Tracee) decodeEvents(outerCtx context.Context, sourceChan chan []byte)
// Add stack trace if needed
var stackAddresses []uint64
if t.config.Output.StackAddresses {
stackAddresses, _ = t.getStackAddresses(ctx.StackID)
stackAddresses = t.getStackAddresses(ctx.StackID)
}

// Currently, the timestamp received from the bpf code is of the monotonic clock.
Expand Down Expand Up @@ -594,7 +594,7 @@ func (t *Tracee) sinkEvents(ctx context.Context, in <-chan *trace.Event) <-chan
return errc
}

func (t *Tracee) getStackAddresses(stackID uint32) ([]uint64, error) {
func (t *Tracee) getStackAddresses(stackID uint32) []uint64 {
stackAddresses := make([]uint64, maxStackDepth)
stackFrameSize := (strconv.IntSize / 8)

Expand All @@ -603,7 +603,8 @@ func (t *Tracee) getStackAddresses(stackID uint32) ([]uint64, error) {
// Stack IDs in it's Map
stackBytes, err := t.StackAddressesMap.GetValue(unsafe.Pointer(&stackID))
if err != nil {
return stackAddresses[0:0], nil
logger.Debugw("failed to get StackAddress", "error", err)
return stackAddresses[0:0]
josedonizetti marked this conversation as resolved.
Show resolved Hide resolved
}

stackCounter := 0
Expand All @@ -621,7 +622,7 @@ func (t *Tracee) getStackAddresses(stackID uint32) ([]uint64, error) {
// But if this fails continue on
_ = t.StackAddressesMap.DeleteKey(unsafe.Pointer(&stackID))

return stackAddresses[0:stackCounter], nil
return stackAddresses[0:stackCounter]
}

// WaitForPipeline waits for results from all error channels.
Expand Down