[CRIU] [PATCH 05/12] lib/infect: Check if compel succeed in executing munmap

Dmitry Safonov dima at arista.com
Sun Nov 10 01:20:38 MSK 2019


Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 compel/arch/s390/src/lib/infect.c |  4 +++-
 compel/src/lib/infect.c           | 10 +++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/compel/arch/s390/src/lib/infect.c b/compel/arch/s390/src/lib/infect.c
index 00e9c36d21a1..7e7d24ce215f 100644
--- a/compel/arch/s390/src/lib/infect.c
+++ b/compel/arch/s390/src/lib/infect.c
@@ -453,8 +453,10 @@ void *remote_mmap(struct parasite_ctl *ctl,
 	if (ptrace_poke_area(pid, &arg_struct, where, sizeof(arg_struct))) {
 		pr_err("Can't restore mmap args (pid: %d)\n", pid);
 		if (map != 0) {
-			compel_syscall(ctl, __NR_munmap, NULL, map,
+			err = compel_syscall(ctl, __NR_munmap, NULL, map,
 					     length, 0, 0, 0, 0);
+			if (err)
+				pr_err("Can't munmap %d\n", err);
 			map = 0;
 		}
 	}
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 656cc030d402..8b377e7d22d8 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -1303,6 +1303,7 @@ int compel_stop_daemon(struct parasite_ctl *ctl)
 int compel_cure_remote(struct parasite_ctl *ctl)
 {
 	long ret;
+	int err;
 
 	if (compel_stop_daemon(ctl))
 		return -1;
@@ -1310,9 +1311,12 @@ int compel_cure_remote(struct parasite_ctl *ctl)
 	if (!ctl->remote_map)
 		return 0;
 
-	compel_syscall(ctl, __NR(munmap, !compel_mode_native(ctl)), &ret,
-			(unsigned long)ctl->remote_map, ctl->map_length,
-			0, 0, 0, 0);
+	err = compel_syscall(ctl, __NR(munmap, !compel_mode_native(ctl)), &ret,
+			     (unsigned long)ctl->remote_map, ctl->map_length,
+			     0, 0, 0, 0);
+	if (err)
+		return err;
+
 	if (ret) {
 		pr_err("munmap for remote map %p, %lu returned %lu\n",
 				ctl->remote_map, ctl->map_length, ret);
-- 
2.24.0



More information about the CRIU mailing list