Debugging this one proved to be pretty tricky. GDB has a nasty habit of loosing control over the debuggee (bug #563361). I've managed to find out that setuid is called from nptl/allocatestack.c:__nptl_setxid in eglibc, but I haven't succeeded in getting a stack trace. If I understand things correctly, this routine is called from a signal handler installed by pthreads.
Debugging this one proved to be pretty tricky. GDB has a nasty habit of loosing control over the debuggee (bug #563361). I've managed to find out that setuid is called from nptl/allocatest ack.c:_ _nptl_setxid in eglibc, but I haven't succeeded in getting a stack trace. If I understand things correctly, this routine is called from a signal handler installed by pthreads.