mirror of
https://github.com/opencontainers/runc.git
synced 2026-06-30 19:58:25 +00:00
rootfs: make cgroupv1 subsystem symlinks fd-based
As with /dev symlinks, this was missed in commitd40b3439a9("rootfs: switch to fd-based handling of mountpoint targets"). It's not really clear to what extent this was exploitable (/sys/fs/cgroup is a tmpfs we create) but it's better to just fix this anyway. Fixes:d40b3439a9("rootfs: switch to fd-based handling of mountpoint targets") Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
This commit is contained in:
@@ -387,7 +387,8 @@ func mountCgroupV1(m mountEntry, c *mountConfig) error {
|
||||
// symlink(2) is very dumb, it will just shove the path into
|
||||
// the link and doesn't do any checks or relative path
|
||||
// conversion. Also, don't error out if the cgroup already exists.
|
||||
if err := os.Symlink(mc, filepath.Join(c.root.Name(), m.Destination, ss)); err != nil && !errors.Is(err, os.ErrExist) {
|
||||
ssPath := filepath.Join(m.Destination, ss)
|
||||
if err := pathrs.SymlinkInRoot(mc, c.root, ssPath); err != nil && !errors.Is(err, os.ErrExist) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user