[CRIU] [PATCH] files: fix clone_service_fd overlap handling
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Tue Apr 17 17:07:32 MSK 2018
Though LOG_FD_OFF < IMG_FD_OFF, get_service_fd(LOG_FD_OFF) is > than
get_service_fd(IMG_FD_OFF), see __get_service_fd, so the check here
should be twisted. Also add bug_on to track possible __get_service_fd
change which can break these check again.
We have a problem when USERNSD_SK replaces LOG_FD_OFF, latter when
writing to log, instead we actually send crazy commands to usernsd,
which failes to handle them and BUG or crash.
https://jira.sw.ru/browse/PSBM-83472
Also we had similar problem when __userns_call received bad repsonse,
likely it has the same background.
https://api.travis-ci.org/v3/job/352164661/log.txt
fixes commit 129bb14611c3 ("files: Prepare clone_service_fd() for
overlaping ranges.")
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
criu/util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/criu/util.c b/criu/util.c
index b19bf5175..4af542a4f 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -617,7 +617,8 @@ int clone_service_fd(struct pstree_item *me)
return 0;
/* Dup sfds in memmove() style: they may overlap */
- if (get_service_fd(LOG_FD_OFF) > new_base - LOG_FD_OFF - SERVICE_FD_MAX * id)
+ BUG_ON(get_service_fd(LOG_FD_OFF) < get_service_fd(IMG_FD_OFF));
+ if (get_service_fd(LOG_FD_OFF) < new_base - LOG_FD_OFF - SERVICE_FD_MAX * id)
for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++)
move_service_fd(me, i, id, new_base);
else
--
2.14.3
More information about the CRIU
mailing list