Skip to contentSkip to conversation

Dumb question: Why are exceptions such as SIGSEGV not logged

DISCUSSION Ihar 'Philips' Filipau 3 participants 5 messages Aug 17, 2003 – Aug 18, 2003 6 messages not in the archive

lore
Share & tools
lore
#4 lore raw
In reply to a message not in the archive
Quoted 4 lines · Doug McNaught

You can still DoS by forking repeatedly and having the child die with SEGV...

We had a problems with synchronization between CPU and memory. But the problem was showing up us random crashes of applications with
SIGSEGV and (rarely) SIGILL.

But still to prove bug is not in Linux kernel and not in software we
have killed three weeks, just to find out that Motorola has forgotten to publish one errata for their CPU.

Probably to have an option to log this kind of signals would be
useful. Because just blindly killing applications - is not correct too.

I will vote for 'if unhandled -> log it' ;-)

#6 lore raw
In reply to a message not in the archive
Quoted 10 lines · Alan Cox
Quoted 4 lines · David D. Hagood
Quoted 1 line

Your logfiles just got DoS'ed....

Why not then just log uncaught exceptions?

man acct

Sorry, probably I'm missing smth. man acct(2) says:

"DESCRIPTION
"When called with the name of an existing file as argument,
ccounting is turned on, records for each terminating process are appended to filename as it terminates. An argument of NULL causes accounting to be turned off".

I do not see how it relates to abends.
It logs _everything_, what is not that useful. Having some kind of
filter what to log - whould be just great. Or alternatively ability to pass file descriptor - not file name.

And this mysterious NOTES:

"No accounting is produced for programs running when a crash
occurs. In particular, nonterminating processes are never accounted for".

Sounds like acct() does reverse? No crashes are logged. Or it is about Linux crash?

#7 lore raw
Quoted 9 lines · Ihar 'Philips' Filipau

"When called with the name of an existing file as argument,
ccounting is turned on, records for each terminating process are appended to filename as it terminates. An argument of NULL causes accounting to be turned off".

I do not see how it relates to abends.
It logs _everything_, what is not that useful. Having some kind of
filter what to log - whould be just great. Or alternatively ability to pass file descriptor - not file name.

It generates a small record for each exit, its trivial to parse the exit codes for exits caused by an exception.

Quoted 2 lines

Sounds like acct() does reverse? No crashes are logged. Or it is about Linux crash?

Linux crash

#9 lore raw
In reply to a message not in the archive
Quoted 13 lines · David Schwartz
Quoted 7 lines
Quoted 6 lines
	char *foo = 0;
	sigset(SIGSEGV,SIG_IGNORE);
	for(;;) { *foo = '\5'; }

Your logfiles just got DoS'ed....

Why not then just log uncaught exceptions?

Because deliberately creating an uncaught exception is a perfectly sane,
reasonable thing to do with well-defined semantics. Applications should feel free to do such reasonable things without getting complaints from the system administrator that their log is being flooded with garbage.

Quoted 5 lines

There is no mechanism that is guaranteed to terminate a process other than
sending yourself an exception that is not caught. So in cases where you must guarantee that your process terminates, it is perfectly reasonable to send yourself a SIGILL.

You probably have missed some postings on this thread. This one:

----------------------------------------------

Quoted 28 lines · Jakob Oestergaard
Quoted 10 lines · David D. Hagood
Quoted 7 lines · [email protected] wrote:

Consider this code:

	char *foo = 0;
	sigset(SIGSEGV,SIG_IGNORE);
	for(;;) { *foo = '\5'; }

Your logfiles just got DoS'ed....

...

Consider this code:
for (;;) syslog(LOG_INFO, "root, hurt me please!");

My point being, that if a user wishes to spam the syslog he can.

Please read the syslogd man page - see under "SECURITY THREATS". Especially option 5 in that section:

----------------
5. Use step 4 and if the problem persists and is not secondary to a rogue
program/daemon get a 3.5 ft (approx. 1 meter) length of sucker rod* and have a chat with the user in question.

Quoted 7 lines

Sucker rod def. -- 3/4, 7/8 or 1in. hardened steel rod, male threaded on each end. Primary use in the oil industry in Western North Dakota and other locations to pump 'suck' oil from oil wells. Secondary uses are for the construction of cattle feed lots and for dealing with the occasional recalcitrant or belligerent individual.
----------------

----------------------------------------------

So you can flood syslog in any way. and syslog(2) I beleive is much
faster than SIGSEGV+kernel solution in this respect ;-)))

Quoted 7 lines

FreeBSD logs any number of normal things that sane, reasonable processes do
and it's very annoying. A very annoying example is FreeBSD's desire to log calls to 'wait' functions with 'SIGCHLD' ignored. How else can portable programs say, "I want you to automatically reap my zombies if you can, but otherwise, I'll reap them if needed by calling waitpid(WNOHANG) every once in a while".

If application cannot be responsible for its children - it is just
bad programming practice. Fix applications.
Reapping zombies 'just in case if any' sounds really bad.

#10 lore raw
Quoted 3 lines

You probably have missed some postings on this thread. This one:

[snip]

If you think those posts are relvent, you misunderstand my point. Those
posts are from the view "if someone wants to DoS the log files, they already can", my argument is more, "if someone doesn't want to DoS the log files, but you make this patch, how can they avoid it?"

Quoted 3 lines

If application cannot be responsible for its children - it is just
bad programming practice. Fix applications.
Reapping zombies 'just in case if any' sounds really bad.

If we were to write code to detect bad programming practices and syslog
them, it would be nearly impossible to prevent syslog DoSes. Looping on 'waitpid(WNOHANG)' periodically is a perfectly sane way to reap zombies, especially in cases where there are issues with signal handling and in multithreaded programs.

If an application does something that a programmer could sensibly decide to
and that solves problems that can't always be solved in another way, it should not result in a syslog entry in the default configuration (unless it's something the system administrator needs to keep track of for security/audit reasons).

An application should be free to terminate however it likes without
programmers getting calls from sysadmins that the application is DoSing the syslog. If you want a special debug mode, that's fine.

DS