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

fix an error caused by fd reuse race when starting runc init #4452

Merged
merged 1 commit into from
Oct 21, 2024

Commits on Oct 21, 2024

  1. fix an error caused by fd reuse race when starting runc init

    There is a race situation when we are opening a file, if there is a
    small fd was closed at that time, maybe it will be reused by safeExe.
    Because of Go stdlib fds shuffling bug, if the fd of safeExe is too
    small, go stdlib will dup3 it to another fd, or dup3 a other fd to this
    fd, then it will cause the fd type cmd.Path refers to a random path,
    and it can lead to an error "permission denied" when starting the process.
    Please see opencontainers#4294 and <golang/go#61751>.
    So we should not use the original fd of safeExe, but use the fd after
    shuffled by Go stdlib. Because Go stdlib will guarantee this fd refers to
    the correct file.
    
    Signed-off-by: lfbzhm <[email protected]>
    lifubang committed Oct 21, 2024
    Configuration menu
    Copy the full SHA
    e669926 View commit details
    Browse the repository at this point in the history