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

Cyrill Gorcunov gorcunov at virtuozzo.com
Tue Oct 31 14:53:35 MSK 2017


On Tue, Oct 31, 2017 at 11:47:32AM +0000, Dmitry Safonov wrote:
> > 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;
> 
> A nit:
> TASK_SIZE_IA32?

Not exactly. We could generate a mask from it but I think it's not that required,
at least by now.


More information about the CRIU mailing list