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

mountinfo: linux: use /proc/thread-self/mountinfo #128

Merged
merged 1 commit into from Nov 5, 2023

Commits on Oct 27, 2023

  1. mountinfo: linux: use /proc/thread-self/mountinfo

    In a Go program with many threads, which goroutine is running on the
    thread-group leader thread is not something programs can controls. Thus,
    even if you use runtime.LockOSThread() for threads that have different
    mount namespaces, it's possible that /proc/self will refer to the
    "wrong" thread.
    
    The solution is to simply use /proc/thread-self, which will always
    provide the correct result for the calling thread. For pre-3.17 kernels
    we use /proc/self/task/<tid> as a fallback.
    
    The usage of /proc/self/mountinfo caused isuses for a patch to runc
    which creates a thread to create id-mapped mounts (which requires
    joining the container mount namespace).
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    12c61a3 View commit details
    Browse the repository at this point in the history