NetBSD-Users archive

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

Re: child process is not created using clone()

On Fri, Apr 15, 2011 at 05:21:58PM -0400, Christos Zoulas wrote:
> I really don't know why it fails for you. Could it be i386 related?
> Or simple changes I made to the code?

I can reproduce the failure for -pthread dynamic case on 5.1/i386
with your version of the code (only <sys/wait.h> added to appeas -Wall).

The child dies with a segfault:

 17297      1 a.out    CALL  __clone(0x14,0xbb90370c)
 17297      1 a.out    RET   __clone 27753/0x6c69
 17297      1 a.out    CALL  wait4(0xffffffff,0xbfbfe7fc,0,0)
 27753      1 a.out    EMUL  "netbsd"
 27753      1 a.out    RET   fork 0
 27753      1 a.out    PSIG  SIGSEGV SIG_DFL: code=SEGV_MAPERR, addr=0xbb800018,
 27753      1 a.out    NAMI  "a.out.core"
 17297      1 a.out    RET   wait4 27753/0x6c69
 17297      1 a.out    CALL  exit(0)

Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
#0  0xbbbe3960 in pthread_mutex_lock () from /usr/lib/
(gdb) bt
#0  0xbbbe3960 in pthread_mutex_lock () from /usr/lib/
#1  0xbbbe70f8 in pthread_setcancelstate () from /usr/lib/
#2  0xbbbb8aa4 in __flockfile_internal () from /usr/lib/
#3  0xbbb86d05 in puts () from /usr/lib/
#4  0x080488dc in fun (arg=0x0) at test.c:16
#5  0xbbb11684 in clone () from /usr/lib/

The program should have __isthreaded == 0, so it should not be in that
code path at all.


Home | Main Index | Thread Index | Old Index