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

specgen: improve heuristic for /sys bind mount #8949

Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jan 12, 2021

partially revert 95c4577

restrict the cases where /sys is bind mounted from the host.

The heuristic doesn't detect all the cases where the bind mount is not
necessary, but it is an improvement on the previous version where /sys
was always bind mounted for rootless containers unless --net none was
specified.

Signed-off-by: Giuseppe Scrivano [email protected]

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 12, 2021
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 12, 2021
@mheon
Copy link
Member

mheon commented Jan 12, 2021

FYI, our upstream CI did not catch any of these - it was the RHEL8 test suite that @edsantiago maintains.

@giuseppe
Copy link
Member Author

FYI, our upstream CI did not catch any of these - it was the RHEL8 test suite that @edsantiago maintains.

I see, the CI completed successfully. @edsantiago please let me know if there is any reproducer I can use

@edsantiago
Copy link
Member

@giuseppe I think this is the one where rootless podman failed almost every test with:

Cannot get exit code: failed to get cursor: cannot assign requested address

Look in your aos-containers-internal mail archives for my email of 2020-11-05, subject "podman gating tests again", for a link to a log file.

@giuseppe giuseppe force-pushed the sysfs-for-rootless branch 2 times, most recently from b8288c1 to 581ba43 Compare January 13, 2021 14:22
@giuseppe giuseppe changed the title [TEST][WIP] specgen: mount /sys again [TEST][WIP] specgen: improve heuristic for /sys bind mount Jan 13, 2021
@giuseppe
Copy link
Member Author

I am not really sure how to solve correctly this issue.

The previous check was an obvious one as a bind mount is used with --net host.

If we want it to work in all the cases though we'd have to check whether the target network namespace is owned by the target user namespace. The check is running too early (at specgen time) to know these details and in general it is error prone to try to duplicate all the checks the kernel does.

I think crun does it correctly as it tries to mount sysfs and if it fails then it fallbacks to a bind mount, so the container engine doesn't have to worry to detect this case earlier. I wonder if we should add a new RuntimeSupportsSysfsCheck in the common image so we can avoid the heuristic when crun is used.

@mheon
Copy link
Member

mheon commented Jan 13, 2021

I think that seems like a sane solution. Can we also fix runc to use the improved crun logic?

@giuseppe
Copy link
Member Author

I think that seems like a sane solution. Can we also fix runc to use the improved crun logic?

@kolyshkin do you think it is something runc could do?

@giuseppe
Copy link
Member Author

I think once ready this fix should go in 3.0 @mheon @rhatdan

@mheon
Copy link
Member

mheon commented Jan 14, 2021

Deadline for 3.0 is tomorrow, so we don't have long for that, unfortunately.

@mheon
Copy link
Member

mheon commented Jan 14, 2021

Though, since this is a bugfix, we can probably get it in later, as long as it's before the final release

partially revert 95c4577

restrict the cases where /sys is bind mounted from the host.

The heuristic doesn't detect all the cases where the bind mount is not
necessary, but it is an improvement on the previous version where /sys
was always bind mounted for rootless containers unless --net none was
specified.

Signed-off-by: Giuseppe Scrivano <[email protected]>
@giuseppe giuseppe changed the title [TEST][WIP] specgen: improve heuristic for /sys bind mount specgen: improve heuristic for /sys bind mount Jan 15, 2021
@giuseppe giuseppe marked this pull request as ready for review January 15, 2021 09:46
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 15, 2021
@giuseppe
Copy link
Member Author

I am afraid this could introduce some regressions on RHEL and runc, we can deal with it later and better tune the heuristic

@rhatdan
Copy link
Member

rhatdan commented Jan 15, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 15, 2021
@openshift-merge-robot openshift-merge-robot merged commit 53ecda2 into containers:master Jan 15, 2021
edsantiago added a commit to edsantiago/libpod that referenced this pull request Jan 25, 2021
- stop: test --all and --ignore (containers#9051)
- build: test /run/secrets (containers#8679, but see below)
- sensitive mount points: deal with 'stat' failures
- selinux: confirm useful diagnostics on unknown labels (containers#8946)

The 'build' test is intended as a fix for containers#8679, in which
'podman build' does not mount secrets from mounts.conf.
Unfortunately, as of this writing, 'podman build' does
not pass the --default-mounts-file option to buildah,
so there's no reasonable way to test this path. Still,
we can at least confirm /run/secrets on 'podman run'.

The /sys thing is related to containers#8949: RHEL8, rootless, cgroups v1.
It's just a workaround to get gating tests to pass on RHEL.

Signed-off-by: Ed Santiago <[email protected]>
iwita pushed a commit to iwita/podman that referenced this pull request Jan 26, 2021
- stop: test --all and --ignore (containers#9051)
- build: test /run/secrets (containers#8679, but see below)
- sensitive mount points: deal with 'stat' failures
- selinux: confirm useful diagnostics on unknown labels (containers#8946)

The 'build' test is intended as a fix for containers#8679, in which
'podman build' does not mount secrets from mounts.conf.
Unfortunately, as of this writing, 'podman build' does
not pass the --default-mounts-file option to buildah,
so there's no reasonable way to test this path. Still,
we can at least confirm /run/secrets on 'podman run'.

The /sys thing is related to containers#8949: RHEL8, rootless, cgroups v1.
It's just a workaround to get gating tests to pass on RHEL.

Signed-off-by: Ed Santiago <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants