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

Interaction with bwrap --dev #311

Open
aerusso opened this issue Feb 18, 2023 · 1 comment
Open

Interaction with bwrap --dev #311

aerusso opened this issue Feb 18, 2023 · 1 comment
Labels
question Further information is requested

Comments

@aerusso
Copy link

aerusso commented Feb 18, 2023

First of all, I'm sorry if this is the wrong place for this question. I'm running slirp4netns 1.2 on Debian unstable

$ slirp4netns -v
slirp4netns version 1.2.0
commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
libslirp: 4.7.0
SLIRP_CONFIG_VERSION_MAX: 4
libseccomp: 2.5.4

I'm trying to use slip4netns with bwrap . This works fine: just replace unshare --net with bwrap --unshare-net in the tutorial. However, I want to also use bwrap --dev /dev. This breaks with the error:

% slirp4netns --configure --mtu=35520 --disable-host-loopback $PID tap0
setns(CLONE_NEWNET): Operation not permitted
child failed(1)

What makes this weirder is that I didn't even use bwrap --dev /dev. I used bwrap --unshare-net --dev /tmp/anotherpath, (though it also breaks if you do --dev /dev).

Am I doing something wrong? Before I go dive into the bubblewrap source, does anyone have any ideas how I can use slirp4netns with bubblewrap and a private devtmpfs?

@AkihiroSuda AkihiroSuda added the question Further information is requested label Feb 20, 2023
@igo95862
Copy link

This is because when --dev is used there will an extra unbounded user namespace.

util-linux/util-linux#1592 (comment)

You need to first switch to that user namespace before launching the slirp4netns using NS_GET_PARENT ioctl. This is what my sandbox project does.

https://github.com/igo95862/bubblejail/blob/99b3c72f71b34dbb80dfc9ecdd5882944c733c9c/src/bubblejail/services.py#L831

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants