diff --git a/criu/uffd.c b/criu/uffd.c index 7e858903f..740f5e371 100644 --- a/criu/uffd.c +++ b/criu/uffd.c @@ -914,6 +914,15 @@ static int handle_remove(struct lazy_pages_info *lpi, struct uffd_msg *msg) */ if (msg->event == UFFD_EVENT_REMOVE && ioctl(lpi->lpfd.fd, UFFDIO_UNREGISTER, &unreg)) { + /* + * The kernel returns -ENOMEM when unregister is + * called after the process has gone + */ + if (errno == ENOMEM) { + handle_exit(lpi); + return 0; + } + pr_perror("Failed to unregister (%llx - %llx)", unreg.start, unreg.start + unreg.len); return -1;