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

Hook exit only after descriptors are closed. Fixes #216 #218

Merged
merged 3 commits into from
Feb 5, 2025
Merged

Conversation

haesbaert
Copy link
Contributor

@haesbaert haesbaert commented Feb 4, 2025

Previously we were sending exit events before the file descriptors were closed. The tests are likely naive enough to always properly close the socket and then terminate. This is easy to see by connecting and killing it.

The solution is to move the hook down to proc_exit_connector() sched_process_exit(). In order to respect the group_dead dance we have to now keep state of who got it, we use an empty state, meaning the existence of the entry in the map is the state.

Previously we were sending exit events before the file descriptors were closed.
The tests are likely naive enough to always properly close the socket and then
terminate. This is easy to see by connecting and killing it.

The solution is to move the hook down to proc_exit_connector(). In order to
respect the group_dead dance we have to now keep state of who got it, we use an
empty state, meaning the existence of the entry in the map is the state.
@haesbaert haesbaert requested a review from a team as a code owner February 4, 2025 01:18
@haesbaert
Copy link
Contributor Author

haesbaert commented Feb 4, 2025

I think I found a better hook: exit_notify, it also zaps the dead dance.

EDIT: no i did not, it gets inlined.

@haesbaert haesbaert marked this pull request as draft February 4, 2025 07:57
@haesbaert
Copy link
Contributor Author

The CI is failing because I think the kernel doesn't have CONFIG_PROC_EVENTS

@haesbaert haesbaert marked this pull request as ready for review February 4, 2025 20:40
@haesbaert
Copy link
Contributor Author

So we changed to sched_process_exit and CI is happy, I pushed a second commit updating the comments.

Copy link
Contributor

@stanek-michal stanek-michal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haesbaert haesbaert merged commit b73e465 into main Feb 5, 2025
26 checks passed
@haesbaert haesbaert deleted the move-exit branch February 5, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants