Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys document a hack about setuid programs and fd 0, ...



details:   https://anonhg.NetBSD.org/src/rev/dcc51d441c0b
branches:  trunk
changeset: 535150:dcc51d441c0b
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Aug 11 10:27:49 2002 +0000

description:
document a hack about setuid programs and fd 0, 1 and 2.
from OpenBSD.

diffstat:

 lib/libc/sys/execve.2 |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 07b412fde6c4 -r dcc51d441c0b lib/libc/sys/execve.2
--- a/lib/libc/sys/execve.2     Sun Aug 11 09:39:10 2002 +0000
+++ b/lib/libc/sys/execve.2     Sun Aug 11 10:27:49 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: execve.2,v 1.22 2002/02/08 01:28:17 ross Exp $
+.\"    $NetBSD: execve.2,v 1.23 2002/08/11 10:27:49 yamt Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -126,6 +126,14 @@
 Descriptors that remain open are unaffected by
 .Fn execve .
 .Pp
+In the case of a new setuid or setgid executable being executed, if
+file descriptors 0, 1, or 2 (representing stdin, stdout, and stderr)
+are currently unallocated, these descriptors will be opened to point to
+some system file like
+.Pa /dev/null .
+The intent is to ensure these descriptors are not unallocated, since
+many libraries make assumptions about the use of these 3 file descriptors.
+.Pp
 Signals set to be ignored in the calling process are set to be ignored in
 the
 new process. Signals which are set to be caught in the calling process image



Home | Main Index | Thread Index | Old Index