Repository navigation
Make /proc, /sys, & /dev readonly for readonly containers - #13669
Conversation
ab8b440 to
1d0ad78
Compare
|
Warning that this patch strips the noexec, nosuid flags from /proc and /dev. The risk here is minimized because the paths are (now) read-only, but it's worth noting in case anyone has issue with this. I believe the right fix for that will be in libcontainer, so this code should not need to be changed. |
|
ping @crosbymichael @jfrazelle |
|
design LGTM |
|
Design LGTM |
|
LGTM |
|
Addressed @LK4D4 's nits and rebased. |
|
@ewindisch Compile error :) |
If a container is read-only, also set /proc, /sys, & /dev to read-only. This should apply to both privileged and unprivileged containers. Note that when /dev is read-only, device files may still be written to. This change will simply prevent the device paths from being modified, or performing mknod of new devices within the /dev path. Tests are included for all cases. Also adds a test to ensure that /dev/pts is always mounted read/write, even in the case of a read-write rootfs. The kernel restricts writes here naturally and bad things will happen if we mount it ro. Signed-off-by: Eric Windisch <[email protected]>
|
@LK4D4 FYI, I fixed the compiler error |
|
LGTM |
|
ping @cpuguy83 does this still LGTY (code changes were made since) @ewindisch does this need a mention in the documentation somewhere? I.e., will users run into a change in behavior because of this? |
|
@thaJeztah a change of behavior will be noted, but I'd argue it should have been this way from the beginning. (I have also deleted another comment I had made which was supposed to be submitted on another issue but accidentally posted it here) |
|
@ewindisch ah, that explains! (had this one marked to ask further) |
|
LGTM |
Make /proc, /sys, & /dev readonly for readonly containers
If a container is read-only, also set /proc, /sys,
& /dev to read-only. This should apply to both privileged and
unprivileged containers.
Note that when /dev is read-only, device files may still be
written to. This change will simply prevent the device paths
from being modified, or performing mknod of new devices within
the /dev path.
Tests are included for all cases. Also adds a test to ensure
that /dev/pts is always mounted read/write, even in the case of a
read-write rootfs. The kernel restricts writes here naturally and
bad things will happen if we mount it ro.
Signed-off-by: Eric Windisch [email protected]