Skip to content

nspawn: skip /sys-as-tmpfs if we don't use private-network#1619

Merged
poettering merged 1 commit intosystemd:masterfrom
iaguis:nspawn-sysfs-netns-3
Oct 20, 2015
Merged

nspawn: skip /sys-as-tmpfs if we don't use private-network#1619
poettering merged 1 commit intosystemd:masterfrom
iaguis:nspawn-sysfs-netns-3

Conversation

@iaguis
Copy link
Member

@iaguis iaguis commented Oct 20, 2015

Since v3.11/7dc5dbc ("sysfs: Restrict mounting sysfs"), the kernel
doesn't allow mounting sysfs if you don't have CAP_SYS_ADMIN rights over
the network namespace.

So the mounting /sys as a tmpfs code introduced in
d8fc6a0 doesn't work with user
namespaces if we don't use private-net. The reason is that we mount
sysfs inside the container and we're in the network namespace of the host
but we don't have CAP_SYS_ADMIN over that namespace.

To fix that, we mount /sys as a sysfs (instead of tmpfs) if we don't use
private network and ignore the /sys-as-a-tmpfs code if we find that /sys
is already mounted as sysfs.

Fixes #1555

Since v3.11/7dc5dbc ("sysfs: Restrict mounting sysfs"), the kernel
doesn't allow mounting sysfs if you don't have CAP_SYS_ADMIN rights over
the network namespace.

So the mounting /sys as a tmpfs code introduced in
d8fc6a0 doesn't work with user
namespaces if we don't use private-net. The reason is that we mount
sysfs inside the container and we're in the network namespace of the host
but we don't have CAP_SYS_ADMIN over that namespace.

To fix that, we mount /sys as a sysfs (instead of tmpfs) if we don't use
private network and ignore the /sys-as-a-tmpfs code if we find that /sys
is already mounted as sysfs.

Fixes systemd#1555
@zonque zonque added the nspawn label Oct 20, 2015
poettering added a commit that referenced this pull request Oct 20, 2015
nspawn: skip /sys-as-tmpfs if we don't use private-network
@poettering poettering merged commit c91960c into systemd:master Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

nspawn-v227: cannot mount /sys with private users but without private net

3 participants