diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-08-24 13:56:59 +1000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-09-08 13:44:03 +0200 |
commit | 85dc4e7f4da77c329051c3de4ab0a23b321181e5 (patch) | |
tree | 95c325c76d183c5fe38c0ef3462d82b5679bc765 /source/configure.in | |
parent | 0b7e88066a765a975c69079d4c62b1545fb9e2aa (diff) | |
download | samba-85dc4e7f4da77c329051c3de4ab0a23b321181e5.tar.gz samba-85dc4e7f4da77c329051c3de4ab0a23b321181e5.tar.xz samba-85dc4e7f4da77c329051c3de4ab0a23b321181e5.zip |
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)
Diffstat (limited to 'source/configure.in')
-rw-r--r-- | source/configure.in | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source/configure.in b/source/configure.in index 7647594634a..bc5a827b8c7 100644 --- a/source/configure.in +++ b/source/configure.in @@ -2717,30 +2717,32 @@ AC_CHECK_FUNCS(getpagesize) ################################################ # look for a method of setting the effective uid seteuid=no; + if test $seteuid = no; then -AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[ +AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[ AC_TRY_RUN([ #define AUTOCONF_TEST 1 -#define USE_SETRESUID 1 +#define USE_SETREUID 1 #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c"], - samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)]) -if test x"$samba_cv_USE_SETRESUID" = x"yes"; then - seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available]) + samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)]) +if test x"$samba_cv_USE_SETREUID" = x"yes"; then + seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available]) fi fi - +# we check for setresuid second as it conflicts with AIO on Linux. +# see http://samba.org/~tridge/junkcode/aio_uid.c if test $seteuid = no; then -AC_CACHE_CHECK([for setreuid],samba_cv_USE_SETREUID,[ +AC_CACHE_CHECK([for setresuid],samba_cv_USE_SETRESUID,[ AC_TRY_RUN([ #define AUTOCONF_TEST 1 -#define USE_SETREUID 1 +#define USE_SETRESUID 1 #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c"], - samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)]) -if test x"$samba_cv_USE_SETREUID" = x"yes"; then - seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available]) + samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)]) +if test x"$samba_cv_USE_SETRESUID" = x"yes"; then + seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available]) fi fi |