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

Properly handle event ordering constraints for core dump signals #2493

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

Keno
Copy link
Member

@Keno Keno commented Apr 7, 2020

The order of events for coredumping signals is extremely confusing,
so I got it slightly wrong. This commit attempts to remidy that.
For my future reference, here are some breadcrumbs of how the
event ordering works for coredumping signals:

  1. The thread that receives the coredumping signal will block (without
    further event after the injection), until all other threads have passed
    their exit events [1]
  2. After passing their own exit events, all other threads will block until
    the coredump is complete (equivalently until all threads have passed their
    exit events). Note that in this state, these tasks are also ignoring SIGKILL.
  3. Once the coredump is complete, each task may proceed. The first task to
    its exit events, the other tasks to their zombie state.

Of course hidden zombie state applies for exits by thread group leaders.

[1] https://github.com/torvalds/linux/blob/7e63420847ae5f1036e4f7c42f0b3282e73efbc2/fs/coredump.c#L457
[2] https://github.com/torvalds/linux/blob/7e63420847ae5f1036e4f7c42f0b3282e73efbc2/kernel/exit.c#L461-L466

The order of events for coredumping signals is extremely confusing,
so I got it slightly wrong. This commit attempts to remidy that.
For my future reference, here are some breadcrumbs of how the
event ordering works for coredumping signals:

1) The thread that receives the coredumping signal will block (without
further event after the injection), until all other threads have passed
their exit events [1]
2) After passing their own exit events, all other threads will block until
the coredump is complete (equivalently until all threads have passed their
exit events). Note that in this state, these tasks are also ignoring SIGKILL.
3) Once the coredump is complete, each task may proceed. The first task to
its exit events, the other tasks to their zombie state.

Of course hidden zombie state applies for exits by thread group leaders.

[1] https://github.com/torvalds/linux/blob/7e63420847ae5f1036e4f7c42f0b3282e73efbc2/fs/coredump.c#L457
[2] https://github.com/torvalds/linux/blob/7e63420847ae5f1036e4f7c42f0b3282e73efbc2/kernel/exit.c#L461-L466
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.

2 participants