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, 8 Sep 2008 11:44:03 +0000 (13:44 +0200)
commit85dc4e7f4da77c329051c3de4ab0a23b321181e5
tree95c325c76d183c5fe38c0ef3462d82b5679bc765
parent0b7e88066a765a975c69079d4c62b1545fb9e2aa
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 56c5a6f024875bb79b0104beb36f6b0ec1e1e9f9)
(cherry picked from commit 6b1291bdd4f8145c73684a679f895d0958df4e66)
source/configure.in