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

Avoid race when opening exec fifo #1698

Merged

Commits on Jan 22, 2018

  1. Avoid race when opening exec fifo

    When starting a container with `runc start` or `runc run`, the stub
    process (runc[2:INIT]) opens a fifo for writing. Its parent runc process
    will open the same fifo for reading. In this way, they synchronize.
    
    If the stub process exits at the wrong time, the parent runc process
    will block forever.
    
    This can happen when racing 2 runc operations against each other: `runc
    run/start`, and `runc delete`. It could also happen for other reasons,
    e.g. the kernel's OOM killer may select the stub process.
    
    This commit resolves this race by racing the opening of the exec fifo
    from the runc parent process against the stub process exiting. If the
    stub process exits before we open the fifo, we return an error.
    
    Another solution is to wait on the stub process. However, it seems it
    would require more refactoring to avoid calling wait multiple times on
    the same process, which is an error.
    
    Signed-off-by: Craig Furman <[email protected]>
    williammartin authored and Craig Furman committed Jan 22, 2018
    Configuration menu
    Copy the full SHA
    8d3e6c9 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2018

  1. Return from goroutine when it should terminate

    Signed-off-by: Craig Furman <[email protected]>
    teddyking authored and Craig Furman committed Jan 23, 2018
    Configuration menu
    Copy the full SHA
    5c0af14 View commit details
    Browse the repository at this point in the history