-
Notifications
You must be signed in to change notification settings - Fork 386
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
v0.9 backports 20230627 #1149
Merged
Merged
v0.9 backports 20230627 #1149
Conversation
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
[ upstream commit efbcfa1 ] Hooking on do_task_dead kernel function, which is the last one the task would execute after exiting. It's stable since v4.19, so it's safe to hook for us. To find out if we are the last thread of execution in the task we use current->signal->live counter (thanks Djalal! ;-) ) It's initialized for thread leader: clone { copy_process copy_signal atomic_set(&sig->live, 1); } Incremented for each new thread: clone { copy_process atomic_inc(¤t->signal->live); ... wake_up_new_task } Decremented for each exiting thread: do_exit { atomic_dec_and_test(&tsk->signal->live); ... do_task_dead __schedule BUG } If task->signal->live == 0 we are the last thread of execution and we won't race with another clone, because there's no other thread to call it (current thread is in do_exit). Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Kornilios Kourtis <[email protected]>
[ upstream commit 0646c56 ] Adding extra threads to the exit-leader test prog. Spawning 2 threads directly from leader and another 2 from the newly created threads. Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Kornilios Kourtis <[email protected]>
[ upstream commit 590a524 ] Close fds in case of returning with an error. Signed-off-by: Kornilios Kourtis <[email protected]>
[ upstream commit 2df044e ] runtime.NumCPU() returns the number of CPUs available to the process. This excludes offline CPUs, but also does not take into acount task CPU affinity. For example: ``` $ cat numcpus.go package main import ( "fmt" "runtime" ) func main() { fmt.Printf("%d\n", runtime.NumCPU()) } $ go run numcpus.go 16 $ taskset --cpu-list 0 go run numcpus.go 1 ``` This leads to memory corruption because we pass to the bpf() call a buffer smaller than the write it will perform, leading to data being overwritten. Reducing the timeout of the goroutine that reads stat maps will reproduce this quickly and lead to SIGSEGVs, corrupted prometheus metrics or other symptoms. Signed-off-by: Kornilios Kourtis <[email protected]>
[ upstream commit 0ffc6c6 ] create updateMapMetric() function to update the metrics for a single map. This allows to use defer() to do proper cleanup in case of an error. Signed-off-by: Kornilios Kourtis <[email protected]>
olsajiri
approved these changes
Jun 28, 2023
mtardy
approved these changes
Jun 28, 2023
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.
looked quickly but the backports seem 👌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commits for pr #1012 (tetragon: Use do_task_dead probe for exit sensor):
Commits for pr #1090 (Fix memory corruption bug):
8f19ada testObserverOptions: remove unused pretty fieldwas not backported, due to conflicts