LWN.net Logo

O_NOSTD

O_NOSTD

Posted Aug 27, 2009 2:13 UTC (Thu) by BenHutchings (subscriber, #37955)
In reply to: O_NOSTD by corbet
Parent article: In brief

SUS also says that exec() of a setuid executable may assign file descriptors 0, 1, and 2 to unspecified files if they are not already assigned.

O_NOSTD is utterly pointless as it would need to be added all over the place, including libraries outside the application programmer's control.


(Log in to post comments)

O_NOSTD

Posted Aug 27, 2009 9:47 UTC (Thu) by epa (subscriber, #39769) [Link]

I think if the kernel developers don't have the guts to just turn on O_NOSTD
for all open() calls by default, then maybe the C library will. (With an
O_ALLOW_STD flag for those cases like the shell where you really do want to
fiddle with the standard file descriptors.)

O_NOSTD

Posted Aug 28, 2009 0:53 UTC (Fri) by willy (subscriber, #9762) [Link]

This was already fixed years ago after Chuck Lever came up with the problem originally. Try running a setuid program with a standard file descriptor closed. You'll find that libcrt0 opens them again.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds