-
Notifications
You must be signed in to change notification settings - Fork 202
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
remove mask on /sys/dev/block #2277
remove mask on /sys/dev/block #2277
Comments
It doesn't look like moby mask this; https://github.com/moby/moby/blob/master/oci/defaults.go#L90-L101 |
I think this came from containers/podman#7801 |
You can also do podman run --security-opt unmask=/sys/dev/block ... |
https://bugzilla.redhat.com/show_bug.cgi?id=1772993 |
That's public, the ones it links to aren't, but it seem its sufficiently quoted to follow the story. So its masked to stop lsblk showing the information? Even though /sys/devices is still there. Option 3a: With /sys/dev/block masked as a tmpfs, readd symlinks for the major/minor device ids in the container. Yes, I saw the unmask option. |
A friendly reminder that this issue had no activity for 30 days. |
Is the above 3a option acceptable? |
Makes sense to me, as long as we don't break the bugzilla fix. |
A friendly reminder that this issue had no activity for 30 days. |
@grooverdan Are you expecting us to implement something here? Are you going to open a PR or is the unmask functionality fix the issue. |
I was hoping you'd see the visibility of In the event that this isn't a good enough reason for implementing this slightly over-engineered, but me friendly implementation, or I'm missing something about the ocs environment, I think I'll get back to this eventually. In the mean time I'm just falling back to assuming a 512 sector size even though the |
So you want the links of the block devices that are present in the container. How would I figure this out? |
Iterate the mount points inside the container taking into account; default mounts, volumes, and
Optionally to enhance isolation:
|
Seems like a hell of a lot of work, potentially very error prone, and I am not even sure it is the right thing to do. Might make more sense to expose the mount masks in containers.conf and just allow users to choose. |
If we break this into two tasks, the first and most important, re-populating the Once we have this right, we can think if additional masking of |
Can you do that without breaking the original problem we were striving to fix? |
I think so - containers/podman#13708 as first working POC. I probably need to do a tmpfs mount rather than a volume. Feedback welcome. |
A friendly reminder that this issue had no activity for 30 days. |
Lets move this forward. I tried out your patch and it works for me. |
A friendly reminder that this issue had no activity for 30 days. |
@grooverdan are you going to open a PR? |
User space programs want to access information about the block devices they are operating on. E.g. the block size is an important aspect if doing O_DIRECT filesystem calls. On the other hand, rhbz#1772993 wants to keep the host information as hidden from the container running processes as possible. We expose only the volumes and devices that are mounted into the container by re-generating the symlinks in /sys/dev/block for the block devices that have host based symlinks. These are generated on ctr.state.RunDir/sysdevblock as a mountpoint and mounted ro into the container. The default visibility can changed by the user with --security-opt={u,}mask=/sys/dev/block Consolidate the libpod.mountBind implementation. Closes #12746 Signed-off-by: Daniel Black <[email protected]>
User space programs want to access information about the block devices they are operating on. E.g. the block size is an important aspect if doing O_DIRECT filesystem calls. On the other hand, rhbz#1772993 wants to keep the host information as hidden from the container running processes as possible. We expose only the volumes and devices that are mounted into the container by re-generating the symlinks in /sys/dev/block for the block devices that have host based symlinks. These are generated on ctr.state.RunDir/sysdevblock as a mountpoint and mounted ro into the container. The default visibility can changed by the user with --security-opt={u,}mask=/sys/dev/block Consolidate the libpod.mountBind implementation. Closes #12746 Signed-off-by: Daniel Black <[email protected]>
A friendly reminder that this issue had no activity for 30 days. |
its on containers/podman#13708 I am having difficulty with:
|
Just tell lint to never mind |
coming back to this open issue, why wouldn't |
As a general principle, if storage (extends to other resources too) is available to the container, it should be able to query enough information about these to use them efficiently. While an unmask is a simple resolution, one users can apply, there a simplicity in making sure that information about the storage is always available to the container, without relying on user configuration of things they may not be familiar with or be equipped to assess the consequences of. FYI: the original masking to hide host information is still flawed (v4.7.0): https://bugzilla.redhat.com/show_bug.cgi?id=1884283#c8 |
there is no real advantage in masking this path, since this information is already available under /sys/devices. In fact, the files under /sys/dev/block are just symlinks. [root@953139a2851f /]# ls -l /sys/dev/block/252\:0 lrwxrwxrwx. 1 root root 0 Dec 17 12:47 /sys/dev/block/252:0 -> ../../devices/virtual/block/zram0 Fixes: containers#2277 Fixes: https://issues.redhat.com/browse/RHEL-3115 Signed-off-by: Giuseppe Scrivano <[email protected]>
The masking of /sys/dev/block was added in 0334b6195820f7261f87a4f4e5d739a6d560f4b2 which constrained the previous /sys/dev masking.
The contents of this filesystem (at least on 5.15.7-200.fc35), is as follows, a bunch of symlinks.
The locations where these symlinks point to are still accessible in the container:
The reason this information is useful is that MariaDB uses the major/minor device numbers and follows this path to find the physical size of the blocks used for O_DIRECT calls - https://github.com/MariaDB/server/blob/385842e15bbd51ad6cad9cf3bfb69d93d0c36921/storage/innobase/os/os0file.cc#L1319-L1325.
As a feature request:
Another discussion found: https://bugzilla.redhat.com/show_bug.cgi?id=1884283
Note: the manual of podman-run doesn't list this masking.
The text was updated successfully, but these errors were encountered: