-
Notifications
You must be signed in to change notification settings - Fork 382
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
tetragon: remove unnecessary GetProcessCopy() #1254
Conversation
GetProcessCopy is required when we need to modify the Process info. This is done primarily to update the Tid to reflect the caller of a system call or kprobe. Most other cases shouldn't need to get a fully copy of the process object. The reason a copy is needed in the modification case is to avoid having a writer updating the object while the GRPC stream handler or JSON writer are marshalling the data which can corrupt the streaming logic. This results in either broken messages in JSON export file or the GRPC stream failing. Signed-off-by: John Fastabend <[email protected]>
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
pkg/grpc/exec/exec.go
Outdated
if !msg.RefCntDone[ProcessRefCnt] { | ||
internal.RefDec() | ||
msg.RefCntDone[ProcessRefCnt] = true | ||
} | ||
proc := internal.GetProcessCopy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep the copy in here? there's tid update on the next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update this part so we just use the tid of the exec time or pid as tid, without doing this extra copy , and this code will just make it an assertion of what we get from bpf side...
For keeping the copy or do not evict from cache before we return the event, I have to check the code , no idea now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this patch I'll put that Copy() back so its correct. We can remove them with future solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
536e66d
to
71fee44
Compare
GetProcessCopy is required when we need to modify the Process info. This is done primarily to update the Tid to reflect the caller of a system call or kprobe.
Most other cases shouldn't need to get a fully copy of the process object. The reason a copy is needed in the modification case is to avoid having a writer updating the object while the GRPC stream handler or JSON writer are marshalling the data which can corrupt the streaming logic. This results in either broken messages in JSON export file or the GRPC stream failing.