Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore enters infinite "preadv" loop #424

Closed
nbald opened this issue Dec 10, 2017 · 4 comments
Closed

restore enters infinite "preadv" loop #424

nbald opened this issue Dec 10, 2017 · 4 comments

Comments

@nbald
Copy link

nbald commented Dec 10, 2017

CRIU seems to enter an infinite loop when trying to restore.
It always prints the same line and never stops.
I have the same behaviour with any program I test.

I am using CRIU v3.6
Raspberrypi 3, kernel 4.9.67-v7+

Do you have any idea how to debug?

(00.243146)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243163)pie: 1281: `- returned 0
(00.243171)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243182)pie: 1281: `- returned 0
(00.243189)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243200)pie: 1281: `- returned 0
(00.243208)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243218)pie: 1281: `- returned 0
(00.243226)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243236)pie: 1281: `- returned 0
(00.243244)pie: 1281: Preadv 0x7574213e:208578... (26 iovs)
(00.243254)pie: 1281: `- returned 0

restore.log
dump.log

@avagin
Copy link
Member

avagin commented Dec 12, 2017

Could you collect a strace log for criu restore?
$ strace -fo strace.log -s 256 criu restore ....?

@avagin
Copy link
Member

avagin commented Dec 14, 2017

I've reproduced this issue on my hardware, will fix soon. Thank you for this report.

@avagin
Copy link
Member

avagin commented Dec 14, 2017

Here is a quick fix for this problem:

diff --git a/compel/arch/arm/plugins/std/syscalls/syscall.def b/compel/arch/arm/plugins/std/syscalls/syscall.def
index 91213e0e..85c8fa20 100644
--- a/compel/arch/arm/plugins/std/syscalls/syscall.def
+++ b/compel/arch/arm/plugins/std/syscalls/syscall.def
@@ -107,4 +107,4 @@ io_submit                   2       246     (aio_context_t ctx_id, long nr, struct iocb **iocbpp)
 io_getevents                   4       245     (aio_context_t ctx, long min_nr, long nr, struct io_event *evs, struct timespec *tmo)
 seccomp                                277     383     (unsigned int op, unsigned int flags, const char *uargs)
 gettimeofday                   169     78      (struct timeval *tv, struct timezone *tz)
-preadv                         69      361     (int fd, struct iovec *iov, unsigned long nr, loff_t off)
+preadv                         69      361     (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h)
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 6216e43e..008ca592 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1214,8 +1214,9 @@ long __export_restore_task(struct task_restore_args *args)
                        pr_debug("Preadv %lx:%d... (%d iovs)\n",
                                        (unsigned long)iovs->iov_base,
                                        (int)iovs->iov_len, nr);
-                       r = sys_preadv(args->vma_ios_fd, iovs, nr, rio->off);
-                       if (r < 0) {
+
+                       r = sys_preadv(args->vma_ios_fd, iovs, nr, rio->off, 0);
+                       if (r <= 0) {
                                pr_err("Can't read pages data (%d)\n", (int)r);
                                goto core_restore_end;
                        }

criupatchwork pushed a commit to criupatchwork/criu that referenced this issue Dec 15, 2017
It has two arguments "pos_l and "pos_h" instead of one "off". It is used
to handle 64-bit offsets on 32-bit kernels.

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
                unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

checkpoint-restore#424
Signed-off-by: Andrei Vagin <avagin@openvz.org>
avagin added a commit that referenced this issue Dec 15, 2017
It has two arguments "pos_l and "pos_h" instead of one "off". It is used
to handle 64-bit offsets on 32-bit kernels.

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
                unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

#424
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
avagin added a commit that referenced this issue Dec 15, 2017
It has two arguments "pos_l and "pos_h" instead of one "off". It is used
to handle 64-bit offsets on 32-bit kernels.

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
                unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

#424
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
avagin added a commit to avagin/criu that referenced this issue Dec 19, 2017
It has two arguments "pos_l and "pos_h" instead of one "off". It is used
to handle 64-bit offsets on 32-bit kernels.

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
                unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

checkpoint-restore#424
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
@avagin
Copy link
Member

avagin commented Dec 30, 2017

03fb0b8

@avagin avagin closed this as completed Dec 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants