Skip to content

Create bind mount mountpoints during restore#1968

Merged
crosbymichael merged 2 commits intoopencontainers:masterfrom
adrianreber:podman
Mar 4, 2019
Merged

Create bind mount mountpoints during restore#1968
crosbymichael merged 2 commits intoopencontainers:masterfrom
adrianreber:podman

Conversation

@adrianreber
Copy link
Contributor

runc creates all bind mount mountpoints when it starts a container, this commit also creates those mountpoints during restore. Now it is possible to restore a container using the same, but newly created rootfs just as during container start.

Additionally this PR wires the CRIU option --ext-mount-map auto through to make it available during container restore using runc restore --autodetect-external-mounts.

These changes are necessary for containers/podman#1618

CC: @avagin, @rst0git this are some of the necessary changes as described on the mailing list

@adrianreber
Copy link
Contributor Author

Any other comments? From my point of view runc restore --autodetect-external-mounts does not block this PR from being merged as it only optionally exposes a CRIU feature, but it does not change runc's current behaviour.

@rst0git
Copy link
Contributor

rst0git commented Feb 5, 2019

LGTM

@adrianreber
Copy link
Contributor Author

@rst0git I just pushed one more commit which now also creates /proc and /sys on restore just as they are created during initial container creation. With this your migration test from containers/podman#2272 should now work.

@rst0git
Copy link
Contributor

rst0git commented Feb 6, 2019

@adrianreber I can confirm that the new commit resolves the issue, but is there a more generic solution, rather than specifying proc and sysfs?

@adrianreber
Copy link
Contributor Author

@adrianreber I can confirm that the new commit resolves the issue, but is there a more generic solution, rather than specifying proc and sysfs?

Not sure, I just tried to do the same as in rootfs_linux.go.

@avagin
Copy link
Contributor

avagin commented Feb 7, 2019

So skipping bind mount mountpoints would be useful, correct. Need to check what I need to do, to do that correctly.

This patch set will look good to me when you fix this issue. Thanks!

@adrianreber
Copy link
Contributor Author

@avagin Thanks for your feedback.

During rootfs setup all mountpoints (directory and files) are created
before bind mounting the bind mounts. This does not happen during
container restore via CRIU. If restoring in an identical but newly created
rootfs, the restore fails right now. This just factors out the code to
create the bind mount mountpoints so that it also can be used during
restore.

Signed-off-by: Adrian Reber <areber@redhat.com>
runc creates all missing mountpoints when it starts a container, this
commit also creates those mountpoints during restore. Now it is possible
to restore a container using the same, but newly created rootfs just as
during container start.

Signed-off-by: Adrian Reber <areber@redhat.com>
@adrianreber
Copy link
Contributor Author

Updated and force pushed. This time mountpoints for all type of mounts are created during restore (just as during creation), but this time no mountpoints are made if the are overmounted by tmpfs.

@adrianreber
Copy link
Contributor Author

Any comments for someone else?

@adrianreber
Copy link
Contributor Author

Can I get two more reviews to get this merged if ready?

@adrianreber
Copy link
Contributor Author

Any more comments from reviewers for this?

@mrunalp
Copy link
Contributor

mrunalp commented Feb 25, 2019

LGTM

Approved with PullApprove

@mrunalp
Copy link
Contributor

mrunalp commented Feb 25, 2019

@opencontainers/runc-maintainers ptal.

@crosbymichael
Copy link
Member

crosbymichael commented Mar 4, 2019

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit f739110 into opencontainers:master Mar 4, 2019
func isPathInPrefixList(path string, prefix []string) bool {
for _, p := range prefix {
if strings.HasPrefix(path, p+"/") {
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the function name, it has to return true in this cases, doesn't it?

thaJeztah added a commit to thaJeztah/containerd that referenced this pull request Mar 7, 2019
This includes an improved fix for CVE-2019-5736 to reduce the
increased memory-consumption introduced by the original patch,
RHEL 7.6 getting into a loop due to a kernel bug in those kernels,
and improve compatibility with older kernels.

changes included:

- opencontainers/runc#1973 Vendor opencontainers/runtime-spec 29686dbc
- opencontainers/runc#1978 Remove detection for scope properties, which have always been broken
- opencontainers/runc#1963 Vendor in go-criu and use it for CRIU's RPC definition
- opencontainers/runc#1995 exec: expose --preserve-fds
- opencontainers/runc#2000 fix preserve-fds flag may cause runc hang
- opencontainers/runc#1968 Create bind mount mountpoints during restore
- opencontainers/runc#1984 nsenter: cloned_binary: "memfd" cleanups

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/containerd that referenced this pull request Mar 7, 2019
This includes an improved fix for CVE-2019-5736 to reduce the
increased memory-consumption introduced by the original patch,
RHEL 7.6 getting into a loop due to a kernel bug in those kernels,
and improve compatibility with older kernels.

changes included:

- opencontainers/runc#1973 Vendor opencontainers/runtime-spec 29686dbc
- opencontainers/runc#1978 Remove detection for scope properties, which have always been broken
- opencontainers/runc#1963 Vendor in go-criu and use it for CRIU's RPC definition
- opencontainers/runc#1995 exec: expose --preserve-fds
- opencontainers/runc#2000 fix preserve-fds flag may cause runc hang
- opencontainers/runc#1968 Create bind mount mountpoints during restore
- opencontainers/runc#1984 nsenter: cloned_binary: "memfd" cleanups

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8d40b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/containerd that referenced this pull request Mar 7, 2019
This includes an improved fix for CVE-2019-5736 to reduce the
increased memory-consumption introduced by the original patch,
RHEL 7.6 getting into a loop due to a kernel bug in those kernels,
and improve compatibility with older kernels.

changes included:

- opencontainers/runc#1973 Vendor opencontainers/runtime-spec 29686dbc
- opencontainers/runc#1978 Remove detection for scope properties, which have always been broken
- opencontainers/runc#1963 Vendor in go-criu and use it for CRIU's RPC definition
- opencontainers/runc#1995 exec: expose --preserve-fds
- opencontainers/runc#2000 fix preserve-fds flag may cause runc hang
- opencontainers/runc#1968 Create bind mount mountpoints during restore
- opencontainers/runc#1984 nsenter: cloned_binary: "memfd" cleanups

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8d40b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants