Re: [PATCH 7/9] cr: checkpoint saved_auxv as u64s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Oren Laadan (orenl@xxxxxxxxxxxxxxx):
> 
> 
> serue@xxxxxxxxxx wrote:
> > From: Serge E. Hallyn <serue@xxxxxxxxxx>
> > 
> > unsigned longs are not a good value to checkpoint between
> > x86-32 and x86-64 32-bit tasks :)
> > 
> > Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>
> > ---
> >  checkpoint/checkpoint.c        |    5 +--
> >  checkpoint/memory.c            |   53 +++++++++++++++++++++++++++++++++++++--
> >  checkpoint/restart.c           |    6 ++--
> >  include/linux/checkpoint_hdr.h |    2 +-
> >  4 files changed, 56 insertions(+), 10 deletions(-)
> 
> [...]
> 
> Sketch for a sanity check:
> 
> > +static int ckpt_read_auxv(struct ckpt_ctx *ctx, struct mm_struct *mm)
> > +{
> > +	int i, ret;
> > +	u64 *buf = kmalloc(CKPT_AT_SZ, GFP_KERNEL);
> > +
> > +	if (!buf)
> > +		return -ENOMEM;
> > +	ret = _ckpt_read_buffer(ctx, buf, CKPT_AT_SZ);
> > +	if (ret < 0) {
> > +		kfree(buf);
> > +		return ret;
> > +	}
> > +
> 
> 	ret = -E2BIG;
> > +	for (i=0; i<AT_VECTOR_SIZE; i++)
> > +		if (buf[i] > (u64) ULONG_MAX)
> 			goto out;
> 
> 	ret = -EINVAL;
> 	for (i=0; i<AT_VECTOR_SIZE; i++)
> 		if (mm->saved_auxv[i] == AT_NULL)
> 			ret = 0;
> 	if (ret < 0)
> 		goto out;

Yup, that would work.

Alternatively, do you think it would be safe to just
always set the last entry to AT_NULL?

> > +
> > +	for (i=0; i<AT_VECTOR_SIZE; i++)
> > +		mm->saved_auxv[i] = buf[i];
> > +
>  out:
> > +	kfree(buf);
> > +	return 0;
> 	       ret;
> 
> [...]
> 
> Oren.
_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux