Re: [patch 4/4] c/r: prctl: Extend PR_SET_MM to set up more mm_struct entries

On Fri, Feb 03, 2012 at 08:56:20AM -0800, Kees Cook wrote:> On Fri, Feb 3, 2012 at 7:19 AM, Cyrill Gorcunov <gorcunov@openvz.org> wrote:> > + case PR_SET_MM_AUXV: {> > + unsigned long user_auxv[AT_VECTOR_SIZE];> > +> > + if (arg4 > sizeof(mm->saved_auxv))> > + goto out;> > While these are both AT_VECTOR_SIZE, I think it might be better to use> sizeof(mm->saved_auxv) instead of AT_VECTOR_SIZE, just so that they> can never get out sync and there's a single reference for the size.>

I suppose you meant ARRAY_SIZE rather since plain sizeof will give youthe summary size in bytes, but I think I have better idea -- lets putBUILD_BUG_ON here, like below.

During checkpoint we dump whole process memory to a file andthe dump includes process stack memory. But among stack dataitself, the stack carries additional parameters such as commandline arguments, environment data and auxiliary vector.

So when we do restore procedure and once we've restored stackdata itself we need to setup mm_struct::arg_start/end,env_start/end, so restored process would be able to findcommand line arguments and environment data it had at checkpointtime. The same applies to auxiliary vector.