This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] ia64/clone2: make sure child_stack is non-NULL


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;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]