[CRIU] [PATCH] restore: Use in_vma_area helper in restore_priv_vma_content

Cyrill Gorcunov gorcunov at openvz.org
Mon Mar 25 07:26:47 EDT 2013


On Mon, Mar 25, 2013 at 03:21:33PM +0400, Pavel Emelyanov wrote:
> On 03/25/2013 03:18 PM, Cyrill Gorcunov wrote:
> > Because a sequence of VMAs is not obligated to not have
> > holes inbetween, plain vma.end check is not enough, use
> > in_vma_area instead to make sure that page addres we're
> > using to restore page contents do belong to particular
> > vma.
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  cr-restore.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/cr-restore.c b/cr-restore.c
> > index 13273c1..ae66668 100644
> > --- a/cr-restore.c
> > +++ b/cr-restore.c
> > @@ -301,7 +301,7 @@ static int restore_priv_vma_content(pid_t pid)
> >  			unsigned char buf[PAGE_SIZE];
> >  			void *p;
> >  
> > -			while (va >= vma->vma.end) {
> > +			while (!(in_vma_area(vma, va))) {
> 
> This will lead to total crap, as val _below_ vma will exit from this
> while right at once and will result in negative off and other shit.

The va must belong to particular vma, thus if you pass va less than any
of vma provided or the reverse, the va greater than any vma in list,
you'll exit the cycle with error, isn't it?


More information about the CRIU mailing list