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

fix: oci: enter cgroup before executing crun as non-root #1539

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Apr 11, 2023

Description of the Pull Request (PR):

When executed from a root-owned cgroup, such as the session scope resulting from a bare ssh login, crun will fail to create our requested container cgroup.

If we are running as non-root, create and move into a user-owned cgroup, so that there's a common user-owned ancestor. This avoids the crun error.

Note that no workaround is needed for runc as it is able to create the requested container cgroup without any issue.

This fixes or addresses the following GitHub issues:

Before submitting a PR, make sure you have done the following:

@dtrudg dtrudg added bug Something isn't working ci:e2e backport Backport this to stable version labels Apr 11, 2023
@dtrudg dtrudg self-assigned this Apr 11, 2023
When executed from a root-owned cgroup, such as the session scope
resulting from a bare ssh login, crun will fail to create our
requested container cgroup.

If we are running as non-root, create and move into a user-owned
cgroup, so that there's a common user-owned ancestor. This avoids the
`crun` error.

Note that no workaround is needed for `runc` as it is able to create
the requested container cgroup without any issue.

Fixes sylabs#1538
@dtrudg dtrudg marked this pull request as ready for review April 11, 2023 16:07
@dtrudg dtrudg requested a review from preminger April 11, 2023 16:07
Copy link
Contributor

@preminger preminger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Also ran it in the environment where I first stumbled on the problem (and with the tmux-based fix I had been using disabled), and all tests passed.

@dtrudg dtrudg merged commit e0ab9fe into sylabs:main Apr 12, 2023
@dtrudg dtrudg deleted the issue1538 branch April 12, 2023 08:39
dtrudg added a commit to dtrudg/singularity that referenced this pull request Apr 17, 2023
If we are running under cgroups v1 or with the cgroupfs
manager (i.e. not systemd as cgroup manager), do not attempt to enter
a cgroup at startup with crun. We cannot create a cgroup unprivileged
in this situation.

Under cgroups v1, crun will not perform the cgroups manipulation that
leads to the issue we worked around in sylabs#1539. Any other issue with the
cgroup that we are in at launch cannot be rectified, either.

Fixes sylabs#1569
dtrudg added a commit to dtrudg/singularity that referenced this pull request Apr 17, 2023
Pick sylabs#1570

If we are running under cgroups v1 or with the cgroupfs
manager (i.e. not systemd as cgroup manager), do not attempt to enter
a cgroup at startup with crun. We cannot create a cgroup unprivileged
in this situation.

Under cgroups v1, crun will not perform the cgroups manipulation that
leads to the issue we worked around in sylabs#1539. Any other issue with the
cgroup that we are in at launch cannot be rectified, either.

Fixes sylabs#1569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Backport this to stable version bug Something isn't working ci:e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

oci: cgroup error in bare ssh session with crun only
2 participants