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

mount: Allow relative mount destinations on Linux #1225

Merged
merged 1 commit into from
Sep 10, 2023

Conversation

rata
Copy link
Contributor

@rata rata commented Sep 7, 2023

We tried to make runc enforce abs dest path several times, and always had to revert it due to breakin users. The last occurrence is this one, in which we detected a few places not up to date and decided to revert the "throw an error" behavior:
opencontainers/runc#3944 (comment)

I don't see any reason to force abs dst paths on Linux, as far as I know there is no security bug nor anything. Let's just relax the spec wording, matching all the runtimes behavior when the paths is relative, and be done with it.


cc @thaJeztah

config.md Outdated
@@ -69,6 +69,7 @@ For Solaris, the mount entry corresponds to the 'fs' resource in the [zonecfg(1M

* **`destination`** (string, REQUIRED) Destination of mount point: path inside container.
This value MUST be an absolute path.
* Linux: It MAY be a relative path too, in which case it MUST be relative to "/".
Copy link
Member

Choose a reason for hiding this comment

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

Why is this specific to Linux?

Copy link
Member

Choose a reason for hiding this comment

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

Also, relative path should be discouraged/deprecated anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just because I know the problems with the ecosystem exist on linux and I don't know how to do it on Windows (shall we say relative to C:? Or to D:?)

Copy link
Member

Choose a reason for hiding this comment

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

for windows (haven't looked yet at our implementations), but at least I know that Windows containers by default only have a single drive (so only C:\) and any path should be on the C:\ drive)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated. I kept it limited to Linux as that is the only platform I know it can cause issues. If others find out later that other platforms are also affected, we can relax them later too :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've also mentioned relative paths are deprecated. Let me know what you think!

config.md Outdated
Comment on lines 71 to 72
This value MUST be an absolute path.
* Linux: It MAY be a relative path too, in which case it MUST be relative to "/".
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the combination of MUST and MAY here is a bit ambiguous.

As we're differentiating per platform here, perhaps we should

  • make each of these a "complete" requirement 🤔
  • For Linux, I would still consider it to be a SHOULD (strong recommendation), as that's what we'd preferred it to have been (were it not for backward compatibility).
  • If we only define "per platform", I guess we need to add a "For other platforms .... " which would be a MUST (unless we know of implementations on other platforms that use relative paths)

Also wondering if it would be worth mentioning why we allow (MAY) have relative paths on Linux; maybe it doesn't hurt to explain the reason (i.e. "we tried, but had to continue it for backward compatibility"). Not sure if we've had similar cases before, and if there's wording we could use for such cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, will update it tomorrow. Thanks! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thaJeztah Does it looks good now? I was not decided between this version I pushed and another one saying just "This value MUST be an absolute path, except when the platform listed below say otherwise", and then just Linux says otherwise.

Let me know what you think :)

We tried to make runc enforce abs dest path several times, and always
had to revert it due to some tools not yet doing it. The last occurrence
is this one:
	opencontainers/runc#3944 (comment)

I don't see any reason to force abs dst paths on Linux, as far as I know
there is no security bug nor anything. Let's just relax the spec
wording, matching all the runtimes behavior when the paths is relative,
and be done with it.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
@rata
Copy link
Contributor Author

rata commented Sep 8, 2023

@thaJeztah @AkihiroSuda pushed with fixes, PTAL

@AkihiroSuda AkihiroSuda added this to the v1.1.1 milestone Sep 8, 2023
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

Any last objections, @thaJeztah? 👀

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thaJeztah
Copy link
Member

@tianon no objections! 👋 ❤️

@tianon tianon merged commit 418fb47 into opencontainers:main Sep 10, 2023
3 checks passed
@rata rata deleted the rata/mount-rel-path branch September 11, 2023 10:11
rata added a commit to kinvolk/runc that referenced this pull request Oct 31, 2023
We changed it in PR:
	opencontainers/runtime-spec#1225

But we missed to remove this comment.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
rata added a commit to kinvolk/runc that referenced this pull request Nov 1, 2023
We changed it in PR:
	opencontainers/runtime-spec#1225

But we missed to remove this comment.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
@utam0k utam0k mentioned this pull request Jan 5, 2024
12 tasks
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.

None yet

4 participants