[CRIU] [PATCH 2/3] Open map_files with O_PATH

Pavel Emelyanov xemul at parallels.com
Fri Nov 6 01:00:51 PST 2015


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 at parallels.com>
---
 proc_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proc_parse.c b/proc_parse.c
index 1302cda..d6c3106 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -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
 	 * 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 (errno == ENOENT)
 			/* Just mapping w/o map_files link */
-- 
1.9.3




More information about the CRIU mailing list