From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [PATCH 7/9] cr: checkpoint saved_auxv as u64s Date: Tue, 09 Feb 2010 12:20:14 -0500 Message-ID: <4B71994E.10105@cs.columbia.edu> References: <1265680806-13295-1-git-send-email-serue@us.ibm.com> <1265680806-13295-8-git-send-email-serue@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1265680806-13295-8-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org List-Id: containers.vger.kernel.org serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org wrote: > From: Serge E. Hallyn > > unsigned longs are not a good value to checkpoint between > x86-32 and x86-64 32-bit tasks :) > > Signed-off-by: Serge E. Hallyn > --- > 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 + if (buf[i] > (u64) ULONG_MAX) goto out; ret = -EINVAL; for (i=0; isaved_auxv[i] == AT_NULL) ret = 0; if (ret < 0) goto out; > + > + for (i=0; i + mm->saved_auxv[i] = buf[i]; > + out: > + kfree(buf); > + return 0; ret; [...] Oren.