mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
coredump: lock down EnterNamespace= mount even more
Let's disable symlink following if we attach a container's mount tree to our own mount namespace. We afte rall mount the tree to a different location in the mount tree than where it was inside the container, hence symlinks (if they exist) will all point to the wrong places (even if relative, some might point to other places). And since symlink attacks are a thing, and we let libdw operate on the tree, let's lock this down as much as we can and simply disable symlink traversal entirely.
This commit is contained in:
@@ -824,7 +824,7 @@ static int attach_mount_tree(int mount_tree_fd) {
|
||||
|
||||
r = mount_setattr(mount_tree_fd, "", AT_EMPTY_PATH,
|
||||
&(struct mount_attr) {
|
||||
.attr_set = MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC,
|
||||
.attr_set = MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOSYMFOLLOW,
|
||||
.propagation = MS_SLAVE,
|
||||
}, sizeof(struct mount_attr));
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user