[CRIU] [PATCH v2 09/11] uffd: Check for uffd event being PF early
Mike Rapoport
rppt at linux.vnet.ibm.com
Sun Nov 13 01:52:42 PST 2016
From: Pavel Emelyanov <xemul at virtuozzo.com>
The event received should be checked to be #PF before
accessing its other arguments.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
Acked-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
criu/uffd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/criu/uffd.c b/criu/uffd.c
index be75744..488cfdd 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -653,6 +653,11 @@ static int handle_user_fault(struct lazy_pages_info *lpi, void *dest)
return -1;
}
+ if (msg.event != UFFD_EVENT_PAGEFAULT) {
+ pr_err("unexpected msg event %u\n", msg.event);
+ return -1;
+ }
+
/* Align requested address to the next page boundary */
address = msg.arg.pagefault.address & ~(page_size() - 1);
pr_debug("msg.arg.pagefault.address 0x%llx\n", address);
@@ -661,11 +666,6 @@ static int handle_user_fault(struct lazy_pages_info *lpi, void *dest)
flags = msg.arg.pagefault.flags;
pr_debug("msg.arg.pagefault.flags 0x%llx\n", flags);
- if (msg.event != UFFD_EVENT_PAGEFAULT) {
- pr_err("unexpected msg event %u\n", msg.event);
- return -1;
- }
-
ret = handle_regular_pages(lpi, dest, address);
if (ret < 0) {
pr_err("Error during regular page copy\n");
--
1.9.1
More information about the CRIU
mailing list