[CRIU] [PATCH] compel: Do not loose sign of result in compat syscall

Cyrill Gorcunov gorcunov at gmail.com
Mon Oct 30 23:22:14 MSK 2017


On Mon, Oct 30, 2017 at 01:14:13PM -0700, Andrey Vagin wrote:
> > 
> > This code has nothing to do with such issues, it's up to a caller
> > to verify the values obtained.
> 
> This code modifies a valid value, so you fix one issue and create a new
> one. Could you fix both of them? ;)

It doesn't create new one but rather reveal arhitecture problem,
which I missed in first place, don't you see? For vz7 instance
the additional fix is. For vanilla instance i will merge them
into one, hopefully tomorrow.
---
From: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date: Mon, 30 Oct 2017 23:16:58 +0300
Subject: [PATCH] compel: x86,compat -- Make sure mmap fits compat task size

In addition to

 | commit 702d51315bdd337b9ab3d32c952bb8a150440d45
 | Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
 |
 |     compel: Do not loose sign of result in compat syscall

It's due to compel interface which operates inside ia-32e mode
where we have to keep sign of syscall up to a caller layer.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 compel/arch/x86/src/lib/infect.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index ac5f8b0..e546ee3 100644
--- a/compel/arch/x86/src/lib/infect.c
+++ b/compel/arch/x86/src/lib/infect.c
@@ -348,6 +348,13 @@ void *remote_mmap(struct parasite_ctl *ctl,
 		return NULL;
 	}
 
+	/*
+	 * For compat tasks the address in foreign process
+	 * must lay inside 4 bytes.
+	 */
+	if (compat_task)
+		map &= 0xfffffffful;
+
 	return (void *)map;
 }
 
-- 
2.7.5



More information about the CRIU mailing list