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)
committerKarolin Seeger <kseeger@samba.org>
Mon, 12 Jan 2009 09:11:48 +0000 (10:11 +0100)
commitc1ef3b8e28777f70086c8d2ee851e3a0b5b4ca4c
tree36a444b49310a8539de94a588de6b9668064d8db
parentb12957121da913f9c0bfb9bf376fca87c2090485
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 5e3b978c51e741d413b856adafa1b1090ed8dd7b)
source/configure.in