2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

uffd: check for exited task when reading uffd_msg

Sometimes there are uffd messages in a queue of a dying task and by the
time these messages are processed in handle_request, the uffd is no
longer valid and reading from it causes errors.

Add processing of EBADF in handle_uffd_event() to gracefully handle such
situation.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
This commit is contained in:
Mike Rapoport
2020-11-19 19:17:35 +02:00
committed by Andrei Vagin
parent 3b22021513
commit 9bdae79d0a

View File

@@ -1213,6 +1213,10 @@ static int handle_uffd_event(struct epoll_rfd *lpfd)
/* we've already handled the page fault for another thread */
if (errno == EAGAIN)
return 0;
if (errno == EBADF && lpi->exited) {
lp_debug(lpi, "excess message in queue: %d", msg.event);
return 0;
}
lp_perror(lpi, "Can't read uffd message");
return -1;
} else if (ret == 0) {