Avoid a race condition in glibc between AIO and setresuid().
commitf04844aa7d50aa5e12c8cc6170d71239422113d1
authorAndrew Tridgell <tridge@samba.org>
Sun, 24 Aug 2008 03:56:59 +0000 (24 13:56 +1000)
committerKarolin Seeger <kseeger@samba.org>
Thu, 28 Aug 2008 14:07:32 +0000 (28 16:07 +0200)
tree755f17188b90d6e20c47d5ef1602993c38707f5a
parentdb52767917fd1f4557e662ab241ec4e1df16332b
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.
(cherry picked from commit 319cea52d259e347061658cfbae56ab350b09671)
source/configure.in