This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] ia64/clone2: make sure child_stack is non-NULL
- From: Mike Frysinger <vapier at gentoo dot org>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Wed, 22 Feb 2006 21:37:04 -0500
- Subject: Re: [patch] ia64/clone2: make sure child_stack is non-NULL
- Geoman: IS A RETARD
- References: <200602222019.56305.vapier@gentoo.org> <20060223022340.GA18034@lucon.org>
On Wednesday 22 February 2006 21:23, H. J. Lu wrote:
> On Wed, Feb 22, 2006 at 08:19:56PM -0500, Mike Frysinger wrote:
> > playing with uClibc/ia64 and i noticed that a test case we have for
> > testing the return value of clone() when given bum arguments was failing
> > ... seems the clone2() function in ia64 never verifies child_stack like
> > all other architectures
> >
> > attached patch adds a check for child_stack alongside the check for
> > child_fn ... i know squat about ia64 assembly so i'd be surprised if this
> > was correct :)
>
> Can you also provide a patch for testcase?
testcase from uClibc is attached (not as a patch though)
-mike
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sched.h>
int child_fn(void *arg)
{
fprintf(stderr, "in child_fn\n");
exit(1);
}
int main(void)
{
int r_clone, ret_errno;
#ifdef __ia64__
r_clone = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL);
#else
r_clone = clone(child_fn, NULL, (int) NULL, NULL);
#endif
ret_errno = errno;
if (ret_errno != EINVAL || r_clone != -1) {
fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n",
r_clone, errno, EINVAL);
return 1;
}
return 0;
}