On Tue, Sep 18, 2012 at 03:32:04PM -0400, Ted Unangst wrote: > On Tue, Sep 18, 2012 at 19:40, Alexey Suslikov wrote: > > > This one being discovered by Roman Kravchuk using Kannel port (see > > https://github.com/jasperla/openbsd-wip/tree/master/net/kannel). > > > > While stress testing, Kannel components die with > > > > Program received signal SIGSEGV, Segmentation fault. > > [Switching to thread 1006387] > > 0x00000cb33345cf6e in random () at /usr/src/lib/libc/stdlib/random.c:387 > > 387 *fptr += *rptr; > > > > We suspect threading issue because of the following trace: > > > Is it normal to not have a mutex protected *random in OpenBSD? > > No, according to posix it should be thread safe. I don't know why, > since rand() is one of the exempted functions, but random() is not. > Standards gods are capricious gods.
I think you should stress *should* here. Looking at the implementation, I cannot believe it's actually thread-safe. -Otto