2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

Open map_files with O_PATH

This descriptor is stat()-ed and used to dump file information.
In both cases even read access is not required. Even if we decide
to go dump ghost file out of it we'll re-open one with O_RDONLY.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov 2015-11-06 12:00:51 +03:00
parent 427ea60bba
commit a3a10c44af

View File

@ -214,7 +214,7 @@ static int vma_get_mapfile(char *fname, struct vma_area *vma, DIR *mfd,
* so later we might refer to it via /proc/self/fd/vm_file_fd * so later we might refer to it via /proc/self/fd/vm_file_fd
* if needed. * if needed.
*/ */
vma->vm_file_fd = openat(dirfd(mfd), path, O_RDONLY); vma->vm_file_fd = openat(dirfd(mfd), path, O_PATH);
if (vma->vm_file_fd < 0) { if (vma->vm_file_fd < 0) {
if (errno == ENOENT) if (errno == ENOENT)
/* Just mapping w/o map_files link */ /* Just mapping w/o map_files link */