Patchset to add asynchronous open/close to master
Jeremy Allison
jra at samba.org
Wed Jun 20 19:42:10 MDT 2012
On Wed, Jun 20, 2012 at 05:42:13PM -0700, Jeremy Allison wrote:
>
> What I'm planning is to write some test code that
> checks if on modern glibc systems that setreuid()
> only changes the euid/egid of the specific thread
> it is called from, and if so we're already good
> for the aio open code.
>
> If (as appears possible now I've looked at the
> glibc code) they have changed this to cause
> setreuid() to do the SETXID signalling (which
> is what glibc uses internally to request individual
> threads change their own uid/gids) then we will
> need to change source3/lib/util_sec.c to use
> the raw system setreuid() system call directly
> instead of going through the glibc wrapper, in
> order to keep the same functionalty we are
> already depending on in Linux.
>
> I'll report back once I've tested things more.
Ok, attached is some test code (run as root :-).
Looks like glibc has changed setreuid to use
the SETXID call.
Using setreuid:
# ./a.out
MAIN THREAD 1: uid = 0, gid = 0
CHILD THREAD 1: uid = 0, gid = 0
MAIN THREAD 2: uid = 300, gid = 300
CHILD THREAD 2: uid = 300, gid = 300
Using syscall(SYS_setreuid,...)
# ./a.out
MAIN THREAD 1: uid = 0, gid = 0
CHILD THREAD 1: uid = 0, gid = 0
MAIN THREAD 2: uid = 300, gid = 300
CHILD THREAD 2: uid = 0, gid = 0
So looks like we need to change to using
syscall(SYS_setreuid,...) in Samba on Linux
instead of calling setreuid() directly, as
the current glibc breaks the assumptions
of we're using inside the aio code.
I'll prepare a patch for master/3.6.x
to fix this issue.
Jeremy.
More information about the samba-technical
mailing list