From: "David Schwartz" <davids@webmaster.com>
To: <vda@port.imtp.ilyichevsk.odessa.ua>,
"Mike Fedyk" <mfedyk@matchmail.com>,
"Hank Leininger" <hlein@progressive-comp.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: Dumb question: Why are exceptions such as SIGSEGV not logged
Date: Tue, 19 Aug 2003 11:51:50 -0700 [thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKGEKJFDAA.davids@webmaster.com> (raw)
In-Reply-To: <200308190654.h7J6sIL07040@Port.imtp.ilyichevsk.odessa.ua>
> On 19 August 2003 01:39, David Schwartz wrote:
> > > And why not just catch the ones sent from the kernel? That's
> > > the one that
> > > is killing the program because it crashed, and that's the one the
> > > origional
> > > poster wants logged...
> > Because sometimes a program wants to terminate. And it is
> > perfectly legal
> > for a programmer who needs to terminate his program as quickly
> > as possible
> > to do this:
> >
> > char *j=NULL;
> > signal(SIGSEGV, SIG_DFL);
> > *j++;
> > This is a perfectly sensible thing for a program to do with
> > well-defined
> > semantics. If a program wants to create a child every minute
> > like this and
> > kill it, that's perfectly fine. We should be able to do that in
> > the default
> > configuration without a sysadmin complaining that we're DoSing
> > his syslogs.
> I disagree. _exit(2) is the most sensible way to terminate.
Read the documentation for _exit. You will see that it is useless in the
case of a portable program that needs to terminate as quickly as possible
and, in fact, isn't guaranteed to cause program termination at all:
The function _exit is like exit(), but does not call any
functions registered with the ANSI C atexit function, nor
any registered signal handlers. Whether it flushes stan-
dard I/O buffers and removes temporary files created with
tmpfile(3) is implementation-dependent. On the other
hand, _exit does close open file descriptors, and this may
cause an unknown delay, waiting for pending output to fin-
ish. If the delay is undesired, it may be useful to call
functions like tcflush() before calling _exit(). Whether
any pending I/O is cancelled, and which pending I/O may be
cancelled upon _exit(), is implementation-dependent.
One major problem with _exit() is that it touches various structures. If
the program's execution environment is no longer trusted, calling _exit()
can cause an endless loop. In multithreaded programs, _exit() may need to
acquire mutexes. This can take an indeterminate amount of time. Portable
programs cannot rely on _exit() in a case where they need to terminate as
soon as possible.
Now, if you have a better way for a portable program that needs to
terminate immediately to do so, that's fine, tell me what it is. Otherwise,
you are *forcing* people to DoS your syslog.
DS
next prev parent reply other threads:[~2003-08-19 18:56 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-18 20:50 Hank Leininger
2003-08-18 21:02 ` Mike Fedyk
2003-08-18 21:18 ` Hank Leininger
2003-08-18 21:25 ` Mike Fedyk
2003-08-18 22:12 ` William Lee Irwin III
2003-08-18 22:39 ` David Schwartz
2003-08-18 22:44 ` Mike Fedyk
2003-08-18 22:53 ` David Schwartz
2003-08-19 6:54 ` Denis Vlasenko
2003-08-19 8:31 ` Proposal (was: Why are exceptions such as SIGSEGV not logged) Jakob Oestergaard
2003-08-19 14:52 ` Dumb question: Why are exceptions such as SIGSEGV not logged Valdis.Kletnieks
2003-08-19 18:51 ` David Schwartz [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-08-18 1:56 Hank Leininger
[not found] <lv8Y.2XU.9@gated-at.bofh.it>
[not found] ` <lv8Y.2XU.11@gated-at.bofh.it>
[not found] ` <lv8Y.2XU.13@gated-at.bofh.it>
[not found] ` <lviD.35d.3@gated-at.bofh.it>
[not found] ` <lviD.35d.1@gated-at.bofh.it>
[not found] ` <lvC1.3p9.11@gated-at.bofh.it>
2003-08-17 14:29 ` Ihar 'Philips' Filipau
[not found] <lg0i.6yo.11@gated-at.bofh.it>
[not found] ` <lgjJ.6Oo.5@gated-at.bofh.it>
[not found] ` <lilr.p2.7@gated-at.bofh.it>
[not found] ` <livc.wX.17@gated-at.bofh.it>
2003-08-17 12:43 ` Ihar 'Philips' Filipau
[not found] ` <lj7O.14a.1@gated-at.bofh.it>
2003-08-17 12:52 ` Ihar 'Philips' Filipau
2003-08-17 13:09 ` Alan Cox
[not found] ` <lOll.3Jp.19@gated-at.bofh.it>
2003-08-18 9:34 ` Ihar 'Philips' Filipau
2003-08-18 17:26 ` David Schwartz
2003-08-16 20:10 Michael Frank
2003-08-16 20:49 ` Valdis.Kletnieks
2003-08-16 21:42 ` Jamie Lokier
2003-08-16 23:06 ` David D. Hagood
2003-08-16 23:17 ` Doug McNaught
2003-08-16 23:41 ` Dr. David Alan Gilbert
2003-08-17 8:17 ` Russell King
2003-08-16 23:49 ` Alan Cox
2003-08-17 20:54 ` Jakob Oestergaard
2003-08-18 4:28 ` Michael Frank
2003-08-18 9:15 ` David Schwartz
2003-08-19 2:43 ` H. Peter Anvin
2003-08-19 13:27 ` Jesse Pollard
2003-08-19 19:28 ` David Schwartz
2003-08-19 19:34 ` H. Peter Anvin
2003-08-19 20:01 ` David Schwartz
2003-08-18 14:31 ` William Lee Irwin III
2003-08-18 17:52 ` Michael Frank
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MDEHLPKNGKAHNMBLJOLKGEKJFDAA.davids@webmaster.com \
--to=davids@webmaster.com \
--cc=hlein@progressive-comp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mfedyk@matchmail.com \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®