Patchset to add asynchronous open/close to master
Stefan (metze) Metzmacher
metze at samba.org
Thu Jun 21 00:18:33 MDT 2012
Hi Jeremy,
>> 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.
I think you need to test with the full unix token,
not only uid and gid.
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20120621/4b8a181d/attachment.pgp>
More information about the samba-technical
mailing list