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

network: fix LXC_NET_NONE cleanup #3589

Merged
merged 1 commit into from Dec 2, 2020
Merged

Conversation

tych0
Copy link
Member

@tych0 tych0 commented Dec 2, 2020

We have a case where we have a nested container with LXC_NET_NONE run
inside a container that's also got no network namespace (run by
lxc-usernsexec).

The "am I root" check in this function then does not suffice, since the
euid of the task is 0 but it does not have privilege over its network
namespace, and thus cannot do any of the restore operations:

lxc foo 20201201232059.271 TRACE network - network.c:lxc_restore_phys_nics_to_netns:3299 - Moving physical network devices back to parent network namespace
lxc foo 20201201232059.271 ERROR network - network.c:lxc_restore_phys_nics_to_netns:3307 - Operation not permitted - Failed to enter network namespace
lxc foo 20201201232059.271 ERROR start - start.c:__lxc_start:2045 - Failed to move physical network devices back to parent network namespace

Let's check that we indeed did clone the network namespace, and thus have
things to restore to their correct namespace before attempting to actually
restore them.

I suspect it's possible we can also get rid of some of the network namespace
preservation stuff in start.c in the LXC_NET_NONE case.

Signed-off-by: Tycho Andersen tycho@tycho.pizza

We have a case where we have a nested container with LXC_NET_NONE run
inside a container that's *also* got no network namespace (run by
lxc-usernsexec).

The "am I root" check in this function then does not suffice, since the
euid of the task is 0 but it does not have privilege over its network
namespace, and thus cannot do any of the restore operations:

lxc foo 20201201232059.271 TRACE    network - network.c:lxc_restore_phys_nics_to_netns:3299 - Moving physical network devices back to parent network namespace
lxc foo 20201201232059.271 ERROR    network - network.c:lxc_restore_phys_nics_to_netns:3307 - Operation not permitted - Failed to enter network namespace
lxc foo 20201201232059.271 ERROR    start - start.c:__lxc_start:2045 - Failed to move physical network devices back to parent network namespace

Let's check that we indeed did clone the network namespace, and thus have
things to restore to their correct namespace before attempting to actually
restore them.

I suspect it's possible we can also get rid of some of the network namespace
preservation stuff in start.c in the LXC_NET_NONE case.

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
@tych0
Copy link
Member Author

tych0 commented Dec 2, 2020

Heh, ci failure is,

Receiving objects:  94% (68766/72445), 26.95 MiB | 79.00 KiB/s   
Receiving objects:  95% (68823/72445), 27.01 MiB | 81.00 KiB/s   
Receiving objects:  95% (68981/72445), 27.06 MiB | 87.00 KiB/s   
Receiving objects:  95% (69263/72445), 27.12 MiB | 85.00 KiB/s   
error: index-pack died of signal 15
fatal: index-pack failed

@smoser
Copy link
Contributor

smoser commented May 26, 2021

Just for reference, I had filed a request for this to be SRU'd under LP: #1918955.

(and if anyone is reading... an updated 20.04 would be nice).

@brauner
Copy link
Member

brauner commented May 27, 2021

@stgraber ^^ :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants