Messages in this thread | | | From | Rusty Russell <> | Subject | Re: [PATCH] Prevent setting 32 uids/gids in the error range | Date | Tue, 18 Feb 2003 15:01:29 +1100 |
| |
In message <1045493720.19397.4.camel@irongate.swansea.linux.org.uk> you write: > On Mon, 2003-02-17 at 07:41, Rusty Russell wrote: > > Tridge noticed that getegid() was returning EPERM. > > > > I used -1000 since that's what PTR_ERR uses, but i386 _syscall macros > > use -125: I don't suppose it really matters. > > Thats a bug in the interface. getegid/getgid/setegid/setuid() is not permitted to fail. > If libc is setting errno and returning -1 the libc wrapper is wrong.
OK, thanks. Note that out asm-i386/unistd.h syscallX macros do it wrong, too.
AFAICT, glibc (2.3.1) gets this wrong, and interprets 0xffffffff return from geteuid() as an error (ie. it's not just an strace bug). Tested by Tridge.
Paulus points out that this also means special handling on archs (PPC and PPC64 that I know of) which set a condition code on error: this can be sidestepped in glibc, as well.
Other archs beware.
Thanks for the clarification, Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |