-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Support recursive read-only bind mounts (kernel >= 5.12) #24229
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
Comments
@giuseppe WDYT? |
I think it is a great idea, and crun already supports it. @danishprakash would you like to work on a patch to add this functionality? I am not sure if it should be done automatically in the way Docker does, or if it should be an explicit flag like |
It feels like it ought to be the default, but we should also have the ability to turn it off via volume options |
I think the fact that Of course backwards compatibility is tricky with that behavior. If we need a why out what should we name such a option @giuseppe Do the oci runtimes crun/runc just hard error if we request |
yes, if we request
fair. Then we could have a check like containers/storage does for several kernel features and convert |
Yes, I can pick this up. I agree that this should be the default, but given that backwards compatibility is going to be an issue, we can perhaps consider the approach taken by mount(8), they introduced |
A friendly reminder that this issue had no activity for 30 days. |
@danishprakash still interested to work on this issue? |
Yes @giuseppe, just got back to it yesterday. Sorry about the long silence on this. |
Do we have a provision for a list of supported feature by the runtime-- |
we could cache the result of |
How about fetching and caching the features as part of |
yes, that seems like a good place to me |
Storing features in the runtime is fine, but using that while generating the spec isn't as straightforward given that we don't have access to the runtime while we create the spec. Possibilities include:
Ideally, I would have loved for the runtime to be available while parsing the spec so as to be able to appropriately generate the spec. Docker does this currently and I believe this would also be extensible in the future if we need to consult with the runtime while we creating the spec. Thoughts? |
Given the alternatives, I'd do this. Why do you think it is wrong? @containers/podman-maintainers any other suggestions? |
We don't have a daemon to store a cache and even if we only do it once on first start and write it to the rundir we then would have to always read an unmarshal it (likely not to noticeable but still some overhead). But the IMO worse problem with a cache like this is lifetime. So far we are using this to perform some kernel feature checks which makes sense to have them on tmpfs as a new boot could mean new kernel. However the oci runtime on the other hand might get updated without a reboot. As such we then cache the old features even when a newer runtime with the features might be in use. Also we support many different runtimes via Kernel 5.12 is quite old now, could be just set this as baseline for our support an always add rro? What oci runtime versions started to support rro? AFAIK it doesn't only depend on the kernel version as the runtimes must set it via mount_setattr()? As far as specgen generation goes I think it would be wrong to make decisions based on the runtime. If we were to add runtime specific stuff to the spec then IMO it should be part of generateSpec() in libpod and never pkg/specgen. @mheon WDYT? |
I agree with @Luap99 - this doesn't sound like a Specgen thing, but a |
With kernel < 5.12, recursive read-only bind mount would set the read-only flag on the top-level mount, not the sub-mounts, as a result, submounts remain
rw
:With kernel >= 5.12, it's possible to achieve this with the introduction of
mount_setattr
[1].runc
andcrun
supportsrro
[2] and docker forwards therro
mount option iff the kernel supports it[3].We can do something similar I believe as part of
generateSpec
, unless I'm missing something here. Open to implementing this once there's approval.cc/ @cyphar
[1] - torvalds/linux@2a18672
[2] - https://github.com/opencontainers/runc/blob/9112335fb2bb9eb93d1f21c267cd5599d0d199e7/libcontainer/specconv/spec_linux.go#L112
[3] - https://github.com/moby/moby/blob/810c7c1dce5bbf76af4ed5c6bac8c47fead4f6c6/daemon/oci_linux.go#L643-L647
The text was updated successfully, but these errors were encountered: