You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support new pid namespace or ability to kill all children #65
This is a follow up to our discussion at DockerCon.
Rootlesskit (and the usernetes work) has been integrated it k3s but results in several usability issues. For now it seems the simplest approach to making rootless with k3s more user friendly would be if rootkit could ensure some way that if the children of executed process died when the process died. This could be done by creating a new pid namespace or possibly with cgroup (although I don't know if rootless can modify cgroups).
@cyphar@giuseppe
Is this by design or bug (of Go? kernel?) ?
Is there any workaround?
it seems the kernel resets the flag when the credentials for the process are changed. The prctl(PR_SET_PDEATHSIG) should be done once the user namespace is configured and the setresuid completed. It is trivial in C, but I am not sure how to achieve it in Go, maybe re-execing the process once in the namespace?
With the merging of #67 for the --pidns flag, does that mean that this section of the docs is no longer valid?
Once you kill K3s and then start a new instance of K3s it will create a new network namespace, but it doesn’t kill the old pods. So you are left with a fairly broken setup.
The usage of Pdeathsig in #66 isn't quite right. It will guarantee that the child dies, but it won't ensure that the parent doesn't accidentally kill the child. See golang/go#27505 for details.
The correct way to use Pdeathsig would be to launch a goroutine, lock it to the OS thread, start the child in that goroutine, and don't exit the goroutine until the child exits. There's a more complete example in the issue I linked above.
FWIW, if you're launching lots of children, it might make sense to use a single goroutine locked to an OS thread to launch all of the potential children.
Activity
AkihiroSuda commentedon May 13, 2019
I'm just curious, why Pdeathsig doesn't work?
AkihiroSuda commentedon May 14, 2019
Minimal reproducer for the issue
@cyphar @giuseppe
Is this by design
or bug (of Go? kernel?) ?Is there any workaround?
child: reconfigure Pdeathsig
AkihiroSuda commentedon May 14, 2019
PR for the Pdeathsig issue: #66
@ibuildthecloud
Does it work for you?
giuseppe commentedon May 15, 2019
it seems the kernel resets the flag when the credentials for the process are changed. The prctl(PR_SET_PDEATHSIG) should be done once the user namespace is configured and the setresuid completed. It is trivial in C, but I am not sure how to achieve it in Go, maybe re-execing the process once in the namespace?
AkihiroSuda commentedon May 15, 2019
#66 seems working, though not sure correct
AkihiroSuda commentedon May 15, 2019
Released v0.4.1.
I'm closing this issue but let me know if there is still problem.
AkihiroSuda commentedon May 29, 2019
reopening, as we need a way to kill grandchildren under the rootlesskit child process...
support unsharing PIDNS (--pidns)
AkihiroSuda commentedon May 29, 2019
PR for creating PIDNS: #67
magikid commentedon Mar 15, 2020
With the merging of #67 for the
--pidnsflag, does that mean that this section of the docs is no longer valid?gldraphael commentedon Apr 30, 2020
@magikid I'm wondering the same too, since they link to this issue.
virtuald commentedon Oct 21, 2020
The usage of
Pdeathsigin #66 isn't quite right. It will guarantee that the child dies, but it won't ensure that the parent doesn't accidentally kill the child. See golang/go#27505 for details.The correct way to use
Pdeathsigwould be to launch a goroutine, lock it to the OS thread, start the child in that goroutine, and don't exit the goroutine until the child exits. There's a more complete example in the issue I linked above.FWIW, if you're launching lots of children, it might make sense to use a single goroutine locked to an OS thread to launch all of the potential children.
AkihiroSuda commentedon Oct 22, 2020
Thanks, opened #182 for tracking