Linux Container Development
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH 7/9] cr: checkpoint saved_auxv as u64s
Date: Tue, 9 Feb 2010 14:20:35 -0600	[thread overview]
Message-ID: <20100209202035.GC29094@us.ibm.com> (raw)
In-Reply-To: <4B71994E.10105-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>

Quoting Oren Laadan (orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org):
> 
> 
> serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote:
> > From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > 
> > 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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > ---
> >  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.

  parent reply	other threads:[~2010-02-09 20:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09  1:59 [PATCH 0/9] ckpt-v19-rc3 cleanups serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <1265680806-13295-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09  1:59   ` [PATCH 1/9] Use CKPT_ARCH_X86_32 for all x86 CKPT_ARCH_IDs serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1265680806-13295-2-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09  2:04       ` Serge E. Hallyn
2010-02-09  3:40       ` Oren Laadan
2010-02-09  1:59   ` [PATCH 2/9] restart only same bit-ness serue-r/Jw6+rmf7HQT0dZR+AlfA
2010-02-09  2:00   ` [PATCH 3/9] x86_64: keep __u32s in even groups serue-r/Jw6+rmf7HQT0dZR+AlfA
2010-02-09  2:00   ` [PATCH 4/9] x86_32: add TIF_IA32 to thread flags serue-r/Jw6+rmf7HQT0dZR+AlfA
2010-02-09  2:00   ` [PATCH 5/9] use ckpt_err for architecture mismatch errors serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1265680806-13295-6-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09  3:52       ` Oren Laadan
     [not found]         ` <4B70DBF9.30105-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-02-09  3:59           ` Serge E. Hallyn
2010-02-09  2:00   ` [PATCH 6/9] Make AT_VECTOR_SIZE_ARCH 2 for x86-32 serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1265680806-13295-7-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09  3:42       ` Oren Laadan
     [not found]         ` <4B70D98F.20303-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-02-09  3:58           ` Serge E. Hallyn
2010-02-09  2:00   ` [PATCH 7/9] cr: checkpoint saved_auxv as u64s serue-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]     ` <1265680806-13295-8-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09 17:20       ` Oren Laadan
     [not found]         ` <4B71994E.10105-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-02-09 20:20           ` Serge E. Hallyn [this message]
     [not found]             ` <20100209202035.GC29094-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-09 20:43               ` Oren Laadan
2010-02-09  2:00   ` [PATCH 8/9] fix potential use-before-set ret in arch/x86/vdso/vma.c serue-r/Jw6+rmf7HQT0dZR+AlfA
2010-02-09  2:00   ` [PATCH 9/9] mm/mmap.c:do_munmap(): remove unused local vars serue-r/Jw6+rmf7HQT0dZR+AlfA
2010-02-09 22:04   ` [PATCH 0/9] ckpt-v19-rc3 cleanups Oren Laadan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100209202035.GC29094@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox