BEWARE! Linux seteuid is broken!

A.N.Kuznetsov (kuznet@ms2.inr.ac.ru)
Tue, 11 Jun 1996 13:28:31 +0400 (MSD)


Hello!

POSIX seteuid DOES NOT CHANGE saved uid.

As I see, seteuid syscall was deleted from kernel
because someone decided that it is equivalent to setreuid(-1, euid).

kernel/sys.c

if (ruid != (uid_t) -1 ||
(euid != (uid_t) -1 && euid != old_ruid)) <- ?????
current->suid = current->euid;

setreuid changes saved uid, when euid != uid.
It breaks POSIX compliant programs.

Well, we might delete second condition, but I'am
afraid it will break BSD compliance.

Alexey Kuznetsov.