Re: [PATCH 1/1] implement s390 clone_with_pids syscall

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

 



On Wed, 2009-11-11 at 08:46 -0600, Serge E. Hallyn wrote:
> Quoting Nathan Lynch (nathanl@xxxxxxxxxxxxxx):
> > 
> > > +	parent_tid_ptr = (int *)kca.parent_tid_ptr;
> > > +	child_tid_ptr =  (int *)kca.child_tid_ptr;
> > > +
> > > +	stack_size = (unsigned long)kca.child_stack_size;
> > > +	child_stack = (unsigned long)kca.child_stack_base;
> > > +	if (child_stack)
> > > +		child_stack += stack_size;
> > 
> > Should this calculation not be of the form:
> > child_stack = arch_dependent_alignment(child_stack + stack_size - 1)
> > ?
> > 
> > Is overflow a concern?
> > 
> > Same questions apply to the x86 version.
> 
> Hmm...  if the stack isn't valid, the task will just segfault, so
> it's not dangerous for the kernel, right?  Note that for instance
> arch/s390/kernel/process.c:SYS_clone() doesn't check the validity
> of the new stack pointer passed in either.

clone expects the stack argument to be the desired value of the stack
pointer in the child.  cwp is different in that the clone_args struct
specifies the base and size of the region the child is to use for stack,
meaning that the kernel must derive from these a sane value for the
child's stack pointer (on every arch where the stack grows down).

Your current calculation results in an unaligned SP outside of the
region that the caller has presumably allocated for the child stack.
How is that useful behavior?


_______________________________________________
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