Avoid a race condition in glibc between AIO and setresuid().
authorAndrew Tridgell <tridge@samba.org>
Sun, 24 Aug 2008 03:56:59 +0000 (13:56 +1000)
committerJeremy Allison <jra@samba.org>
Tue, 26 Aug 2008 16:31:54 +0000 (09:31 -0700)
commit319cea52d259e347061658cfbae56ab350b09671
treeb7ad4e932e6ed33c73d0ac1c53c1e30772ab2704
parentec178599d37d6633697650c54c3588afedea9b7e
Avoid a race condition in glibc between AIO and setresuid().

See this test: http://samba.org/~tridge/junkcode/aio_uid.c

The problem is that setresuid() tries to be clever about threads, and
tries to change the euid of any threads that are running. If a AIO read
or write completes while this is going on then the signal from the thread
where the IO completed is lost, as it gets -1/EPERM from rt_sigqueueinfo()

The simplest fix is to try to use setreuid() instead of setresuid(),
as setreuid() doesn't try to be clever. Unfortunately this also means
we must use become_root()/unbecome_root() in the aio code.
source/configure.in