[CRIU] [PATCH 2/2] files: drop O_TMPFILE from file descriptor flags

Andrei Vagin avagin at openvz.org
Tue Feb 27 00:37:53 MSK 2018


[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

From: Andrei Vagin <avagin at virtuozzo.com>

Unnamed temporary files are restored as ghost files.

If O_TMPFILE is set for the open() syscall, the pathname argument
specifies a directory, but criu gives a path to a ghost file.

(00.107450)     36: Error (criu/files-reg.c:1757): Can't open file tmp/#42274874 on restore: Not a directory

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/files-reg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 5e63b964f..94fd4acaa 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1752,6 +1752,9 @@ int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *ar
        u32 flags = *(u32 *)arg;
        int fd;

+       /* unnamed temporary files are restored as ghost files */
+       flags &= ~O_TMPFILE;
+
        fd = openat(ns_root_fd, rfi->path, flags);
        if (fd < 0) {
                pr_perror("Can't open file %s on restore", rfi->path);
--
2.13.6




More information about the CRIU mailing list