-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[hotfix] nsenter: refuse to build with Go 1.22 #4234
Conversation
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.
@lifubang Are you sure that actually solves the issue? Can you try running the test C program from golang/go#65625 with that change? We don't use
In fact,
I think the issue is more likely related to the thread-local storage used by pthreads. From golang/go#65625 it seems that the old TID is stored in the TLS and glibc then tries to do Ultimately, our usage of |
It seems not work for this C program, but I'm curious about why it can work in runc.
I think |
The reason the C program fails is because it kills the original process, and so the wrong PID no longer exists. With runc, the parent process still exists so the old PID still works.
I think the problem is that the TLS contains the old data, and glibc doesn't update it after
It's possible the |
edf8114
to
802b395
Compare
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
We will almost certainly need to eventually rework nsenter to: 1. Figure out a way to make pthread_self() not break after nsenter runs (probably not possible, because the core issue is likely that we are ignoring the rules of signal-safety(7)); or 2. Do an other re-exec of /proc/self/exe to execute the Go half of "runc init" -- after we've done the nsenter setup. This would reset all of the process state and ensure we have a clean glibc state for Go, but it would make runc slower... For now, just block Go 1.22 builds to avoid having broken runcs floating around until we resolve the issue. It seems possible for musl to also have an issue, but it appears to work and so for now just block glibc builds. Note that this will only block builds for anything that uses nsenter -- so users of our (internal) libcontainer libraries should be fine. Only users that are starting containers using nsenter to actually start containers will see the error (which is precisely what we want). Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Wonder how much slower that would be. |
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
1.1 backport: #4240 |
Will this PR break things which are using go1.22 to link / build runc as a library and don't actually exercise the nsenter code at all? If so, that seems unnecessary and really problematic. Asking another way, do we know that everything importing this package is running nsenter? |
@liggitt, for downstream repositories which have a dependency on the runc module but do not call the nsenter package then this hotfix would not prevent those users from linking and building. The easiest method to test if your use case uses nsenter package is to vendor dependencies and check for |
We will almost certainly need to eventually rework nsenter to:
(probably not possible, because the core issue is likely that we are
ignoring the rules of signal-safety(7)); or
"runc init" -- after we've done the nsenter setup. This would reset
all of the process state and ensure we have a clean glibc state for
Go, but it would make runc slower...
For now, just block Go 1.22 builds to avoid having broken runcs floating
around until we resolve the issue. It seems possible for musl to also
have an issue, but it appears to work and so for now just block glibc
builds.
Note that this will only block builds for anything that uses nsenter --
so users of our (internal) libcontainer libraries should be fine. Only
users that are starting containers using nsenter to actually start
containers will see the error (which is precisely what we want).
See #4233
Signed-off-by: Aleksa Sarai cyphar@cyphar.com