sys_setuid [kernel/sys.c]
Sets the effective user ID of the current process. If the effective UID of the caller is root, the real UID and saved set-user-ID are also set. Arguments
eax | 23
ebx | New effective user ID. If it is different from the old effective UID, the process will be forbidden from leaving core dumps.
Return values If the system call succeeds the return value is 0. If the system call fails the return value is one of the following errno values:
`-EAGAIN` | `ebx does not match the current UID and ebx brings process over it's NPROC rlimit.`
`-EPERM` | `The user is not privileged (does not have the CAP_SETUID capability) and ebx does not match the real UID or saved set-user-ID of the calling process.`
Remarks Under Linux, sys_setuid is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a set-user-ID (other than root) program to drop all of its user privileges, do some un-privileged work, and then re-engage the original effective user ID in a secure manner. If the user is root or the program is set-user-ID-root, special care must be taken. The sys_setuid function checks the effective user ID of the caller and if it is the superuser, all process related user ID's are set to ebx. After this has occurred, it is impossible for the program to regain root privileges. Thus, a set-user-ID-root program wishing to temporarily drop root privileges, assume the identity of a non-root user, and then regain root privileges afterwards cannot use sys_setuid. Linux has the concept of filesystem user ID, normally equal to the effective user ID. The sys_setuid call also sets the filesystem user ID of the current process. See sys_setfsuid. Compatibility n/a