-
Notifications
You must be signed in to change notification settings - Fork 43
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
7049be0
to
da2df1c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
I guess this was not backported in the RHEL 3.10 kernels? I think RHEL 7 reaches EOL June next year, so ... it's getting closer. |
(For future reference, this was motivated by opencontainers/runc#3985.) |
da2df1c
to
170c9be
Compare
Wdyt @kolyshkin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 <[email protected]>
170c9be
to
12c61a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@thaJeztah ptal |
Merging as this doesn't seem like a breaking change, and we need it in runc (#3985). |
Ah, it seems that we need the |
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.
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 [email protected]