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

checkpoint: resolve symlink for external bind mount (take II) #3047

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

liusdu
Copy link

@liusdu liusdu commented Jun 28, 2021

[From @kolyshkin: This is a respin of #2902 which was reverted in #3043]

runc resolves symlink before doing bind mount. So
we should save original path while formatting CriuReq for
dump and restore.

"checkpoint: resolve symlink for external bind mount" is merged as
da22625 (PR #2902) previously. And reverted
in commit 70fdc05 (PR #3043) duo to behavior changes
caused by commit 0ca91f4 (Fixes: CVE-2021-30465)

Signed-off-by: Liu Hua [email protected]

Changelog entry

(by @kolyshkin)

* runc checkpoint/restore: fixed for containers with an external bind mount
  which destination is a symlink. (#3047).

@liusdu
Copy link
Author

liusdu commented Jun 28, 2021

Hi @kolyshkin and @cyphar Sorry for broking CI system in the weekend..

When #2902 is merge, issue #3042 shows that CI is broken, with error message No mapping for /real/conf mountpoint.
After a quick bisect search, I found it is cause by changes from commit 0ca91f4.

diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go
index 945a0fa..849bf4a 100644
--- a/libcontainer/container_linux.go
+++ b/libcontainer/container_linux.go
@@ -1217,7 +1217,6 @@ func (c *linuxContainer) makeCriuRestoreMountpoints(m *configs.Mount) error {
                if err := checkProcMount(c.config.Rootfs, dest, ""); err != nil {
                        return err
                }
-               m.Destination = dest
                if err := os.MkdirAll(dest, 0755); err != nil {
                        return err
                }

I am not sure whether it is introduced due to security issue. So I choose Solution 2 described in #3042

@kolyshkin kolyshkin requested a review from cyphar June 28, 2021 18:38
kolyshkin
kolyshkin previously approved these changes Jun 28, 2021
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin changed the title [FIX CI broken]checkpoint: resolve symlink for external bind mount xheckpoint: resolve symlink for external bind mount (take II) Jul 12, 2021
@kolyshkin kolyshkin added this to the 1.1.0 milestone Jul 12, 2021
@kolyshkin kolyshkin changed the title xheckpoint: resolve symlink for external bind mount (take II) checkpoint: resolve symlink for external bind mount (take II) Jul 12, 2021
kolyshkin
kolyshkin previously approved these changes Jul 12, 2021
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin requested a review from AkihiroSuda July 12, 2021 00:06
@kolyshkin
Copy link
Contributor

@cyphar @AkihiroSuda PTAL

@liusdu
Copy link
Author

liusdu commented Jul 12, 2021

Thanks @kolyshkin , @cyphar @AkihiroSuda rebased and tested with newest master.

@liusdu liusdu closed this Jul 12, 2021
@liusdu liusdu reopened this Jul 12, 2021
@kolyshkin
Copy link
Contributor

@liusdu can you please rebase? we did some changes to CI that unfortunately require an explicit rebase.

@liusdu
Copy link
Author

liusdu commented Jul 21, 2021

@kolyshkin rebased~

@liusdu liusdu requested a review from kolyshkin July 22, 2021 02:48
@kolyshkin
Copy link
Contributor

@liusdu needs another rebase (we're tackling with CI lately)

@liusdu
Copy link
Author

liusdu commented Jul 29, 2021

rebased

kolyshkin
kolyshkin previously approved these changes Jul 29, 2021
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

runc resolves symlink before doing bind mount. So
we should save original path while formatting CriuReq for
dump and restore.

"checkpoint: resolve symlink for external bind mount" is merged as
da22625(PR 2902) previously. And reverted
in commit 70fdc05(PR 3043) duo to behavior changes
caused by commit 0ca91f4(Fixes: CVE-2021-30465)

Signed-off-by: Liu Hua <[email protected]>
@liusdu
Copy link
Author

liusdu commented Aug 19, 2021

@kolyshkin @cyphar @crosbymichael rebased, please take a look at this patch.

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

Still LGTM

@kolyshkin kolyshkin requested a review from thaJeztah September 3, 2021 21:10
Copy link
Member

@cyphar cyphar left a comment

Choose a reason for hiding this comment

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

LGTM. Tbh I'm still not sure I understand why it's necessary, but if it fixes stuff for CRIU I'm happy.

@cyphar cyphar merged commit 8bf0326 into opencontainers:master Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants