Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2002 17:31:41 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Dan Langille <dan@langille.org>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: sendmail: File descriptors missing on startup: stderr; Bad file descriptor
Message-ID:  <20020927163141.GA16132@happy-idiot-talk.infracaninophi>
In-Reply-To: <3D941EE0.5166.6FDC7551@localhost>
References:  <3D941EE0.5166.6FDC7551@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 27, 2002 at 09:03:28AM -0400, Dan Langille wrote:
> I keep seeing this in /var/log/maillog but do not know the cause:
> 
>    sendmail[42390]: File descriptors missing on startup: stderr; Bad
>                  file descriptor
> 
> I'm on FreeBSD 4.6-STABLE #0: Thu Sep 26 09:02:16 EDT 2002 with 
> sendmail 8.12.5
> 
> Any ideas on cause/fix?

What command line are you using to start sendmail? That error message
suggests that the stderr file descriptor, which sendmail inherits from
the shell where it is started, is bogus.  The kernel will sanity check
the standard descriptors when starting up SUID or SGID processes, and
if any are closed, will open them up again on /dev/null.  There was an
egregious security bug exploiting that situation going the rounds a
few months ago.  See
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02%3A23.stdio.asc

However, that was fixed before 4.6-RELEASE.  Also I believe that it
was never possible to attack sendmail that way because the first thing
sendmail does when being started in daemon mode is to walk through
it's filedescriptor table and close them all down.  The standard 0, 1,
2 descriptors are then immediately re-opened onto /dev/null. That's
something that should be standard procedure for starting up any
daemonized process and it is built into the daemon(3) function.

	Cheers,

	Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
                                                      Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020927163141.GA16132>