Skip to content

runtime: use Unshare on Linux #1954

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

Closed
gopherbot opened this issue Jun 14, 2011 · 10 comments
Closed

runtime: use Unshare on Linux #1954

gopherbot opened this issue Jun 14, 2011 · 10 comments

Comments

@gopherbot
Copy link
Contributor

by jdnurmi@qwe.cc:

While the current 'hidden' flags to syscall.ProcAttr allow great flexibility when
executing a child process, it would be nice if we could also control the 'Unshare'
attributes of the child.

I've attached a patch that works on Linux, but it will break all other *NIX builds (and
thus I'd like some outside advice on how to best re-write this patch)

Unshare is a Linux specific call, so I _think_ the right way to apply this (if others
desire it) would be an exec_linux.go fork of exec_unix.go;  The attached is just a
straight patch to exec_unix.go

Attachments:

  1. unshare.patch (702 bytes)
@alberts
Copy link
Contributor

alberts commented Jun 15, 2011

Comment 1:

Try submitting a CL.
http://golang.org/doc/contribute.html

@adg
Copy link
Contributor

adg commented Jun 27, 2011

Comment 2:

Labels changed: added packagechange.

Status changed to HelpWanted.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2011

Comment 3:

Labels changed: added priority-low, removed priority-medium.

@davecheney
Copy link
Contributor

Comment 4:

Hello, please take a look at http://golang.org/cl/5246052/

@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 5:

Labels changed: added priority-someday.

@alberts
Copy link
Contributor

alberts commented May 22, 2012

Comment 7:

In related news, it seems you can't really use Unshare once goroutines have been started.
iant:
"""
The unshare system call effectively undoes parts of the clone system call.  The clone
system call is used to create new threads.  So I would expect the unshare system call to
only affect the calling thread.  I would not expect it to affect all threads in a
process.  That seems to more or less match the high level description in
http://www.kernel.org/doc/Documentation/unshare.txt , although I agree that matters are
not entirely clear.
Since goroutines are free to move between threads (unless you call
runtime.LockOSThread), and since the Go runtime creates new threads as needed, I don't
think there is any reliable way to use syscall.Unshare in a Go program.
"""

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 9:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

@ianlancetaylor
Copy link
Member

Comment 10:

I'm not sure why this CL was never submitted.  It should be possible to use unshare for
the specific case of a child process running after fork, which is what the CL did.

@gopherbot
Copy link
Contributor Author

CL https://golang.org/cl/23233 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants