This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using thread-specific credentials on Linux in Samba with glibc.


> Sure, no problem. I want to be able to use this function:
> 
> ----------------------------------------------------------
> int samba_setresuid(uid_t ruid, uid_t euid, uid_t suid)
> {
>         return syscall(SYS_setresuid, ruid, euid, suid);
> }
> ----------------------------------------------------------

That's certainly always going to be fine unless there is a change to the
calling convention of the syscall in question.  All libc says about
'syscall' is that it makes the system call with the number you specified
and fills the argument registers with the arguments you gave.  The rest
of what that means is between you and the kernel.  For example, if the
syscall were to change to take 64-bit arguments on 32-bit platforms,
then the argument encoding would not be reliably correct on all
machines.  But that's existing libc behavior on the affected platforms:
it expects word-sized arguments and passes them along in the
corresponding registers.  Some machines have argument-passing
conventions for larger-sized arguments that make this not do what you
really wanted it to do, e.g. a single argument twice the word size going
into an even/odd register pair, but the 'syscall' function takes an
additional leading argument (the number) that the system call itself
doesn't take, fouling up the even/odd sense of particular argument registers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]