Discussion:
Unable to generate core dumps for a program
(too old to reply)
Frank Meerkötter
2006-06-03 14:40:27 UTC
Permalink
Hi,

i'm having trouble generating core dumps for a certain program.
In general i can get a core dump. When running "kill -SIGILL $$" i
end up with a nice shining core file of my current shell. So in
principal it works but when doing the same thing to the program
i would like to debug no core dump is generated (it just quits).

The ulimit for core files is unlimited and the current working
directory is writeable. What else could be the problem that no
core dump is generated?

Can a program do something that prevents coredump generation?

Thanks.

Regards,
Frank
Bjorn Reese
2006-06-03 15:39:39 UTC
Permalink
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
On AIX a program can prevent coredumping by setting the SA_NODUMP flag
with sigaction() for every appropriate signal.
--
mail1dotstofanetdotdk
Frank Meerkötter
2006-06-03 16:40:16 UTC
Permalink
Hi,
Post by Bjorn Reese
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
On AIX a program can prevent coredumping by setting the SA_NODUMP flag
with sigaction() for every appropriate signal.
The system i'm running on is linux (2.6) which doesn't have this flag.

Thanks for reply.

Regards,
Frank
Paul Pluzhnikov
2006-06-03 17:00:27 UTC
Permalink
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
On any UNIX system, a program can establish signal handler for all
core-dumping signals, and call _exit() when that handler is invoked.

Since you are on linux, run the program under strace and see if in
fact it does that for SIGILL. If so, see if it also does that for
other core-dumping signals (usually SIGQUIT is the signal you'll
want to send -- its *only* reason is to stop program with a core).

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Maxim Yegorushkin
2006-06-03 18:17:58 UTC
Permalink
Post by Paul Pluzhnikov
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
On any UNIX system, a program can establish signal handler for all
core-dumping signals, and call _exit() when that handler is invoked.
One can also block all ignorable signals using sigprocmask().
Paul Pluzhnikov
2006-06-03 19:24:22 UTC
Permalink
Post by Maxim Yegorushkin
One can also block all ignorable signals using sigprocmask().
True. However that is *not* what's happening to the OP program, since
it "just quits". If it blocked SIGILL, it would "just keep running".

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Maxim Yegorushkin
2006-06-05 07:28:18 UTC
Permalink
Post by Paul Pluzhnikov
Post by Maxim Yegorushkin
One can also block all ignorable signals using sigprocmask().
True. However that is *not* what's happening to the OP program, since
it "just quits". If it blocked SIGILL, it would "just keep running".
Sorry, I missed "just quits" bit.
Jordan Abel
2006-06-03 17:42:38 UTC
Permalink
Post by Frank Meerkötter
Hi,
i'm having trouble generating core dumps for a certain program.
In general i can get a core dump. When running "kill -SIGILL $$" i
end up with a nice shining core file of my current shell. So in
principal it works but when doing the same thing to the program
i would like to debug no core dump is generated (it just quits).
The ulimit for core files is unlimited and the current working
directory is writeable. What else could be the problem that no
core dump is generated?
Can a program do something that prevents coredump generation?
it might be setting its own ulimit.
Bas
2006-06-03 22:37:01 UTC
Permalink
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Barry Margolin
2006-06-04 01:42:47 UTC
Permalink
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Jordan Abel
2006-06-04 02:11:10 UTC
Permalink
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
Barry Margolin
2006-06-04 19:37:15 UTC
Permalink
Post by Jordan Abel
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
I thought you could send signals if your UID matches the saved UID. Or
can you only send keyboard-generated signals to processes you started?
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Michael Kerrisk
2006-06-04 20:36:42 UTC
Permalink
On Sun, 04 Jun 2006 15:37:15 -0400, Barry Margolin
Post by Barry Margolin
Post by Jordan Abel
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
I thought you could send signals if your UID matches the saved UID. Or
can you only send keyboard-generated signals to processes you started?
Barry, you are correct: an unprivileged process can signal another
process if the real or effective UID of the sender matches the real
UID or saved set-user-ID of the receiver.

Cheers,

Michael
Jordan Abel
2006-06-04 21:14:33 UTC
Permalink
Post by Michael Kerrisk
On Sun, 04 Jun 2006 15:37:15 -0400, Barry Margolin
Post by Barry Margolin
Post by Jordan Abel
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
I thought you could send signals if your UID matches the saved UID. Or
can you only send keyboard-generated signals to processes you started?
Barry, you are correct: an unprivileged process can signal another
process if the real or effective UID of the sender matches the real
UID or saved set-user-ID of the receiver.
Doesn't that open the door to easy exploitation of race conditions via
SIGSTOP/SIGCONT?
Barry Margolin
2006-06-06 00:48:15 UTC
Permalink
Post by Jordan Abel
Post by Michael Kerrisk
On Sun, 04 Jun 2006 15:37:15 -0400, Barry Margolin
Post by Barry Margolin
Post by Jordan Abel
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
I thought you could send signals if your UID matches the saved UID. Or
can you only send keyboard-generated signals to processes you started?
Barry, you are correct: an unprivileged process can signal another
process if the real or effective UID of the sender matches the real
UID or saved set-user-ID of the receiver.
Doesn't that open the door to easy exploitation of race conditions via
SIGSTOP/SIGCONT?
It makes the window larger, but it was already there to begin with. So
setuid programs have to be programmed to defend against this possibility.
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Jordan Abel
2006-06-04 21:13:50 UTC
Permalink
Post by Barry Margolin
Post by Jordan Abel
Post by Barry Margolin
Post by Bas
Post by Frank Meerkötter
Can a program do something that prevents coredump generation?
Yes. The program can prevent coredump generation by calling setrlimit.
Another thing that will prevent core dumps is if the program is setuid.
That would also prevent him sending signals
I thought you could send signals if your UID matches the saved UID. Or
can you only send keyboard-generated signals to processes you started?
Keyboard-generated signals don't come from you, they come from the tty
driver.
Steven Ding
2006-06-10 14:41:41 UTC
Permalink
Post by Frank Meerkötter
Hi,
i'm having trouble generating core dumps for a certain program.
In general i can get a core dump. When running "kill -SIGILL $$" i
end up with a nice shining core file of my current shell. So in
principal it works but when doing the same thing to the program
i would like to debug no core dump is generated (it just quits).
The ulimit for core files is unlimited and the current working
directory is writeable. What else could be the problem that no
core dump is generated?
Can a program do something that prevents coredump generation?
Thanks.
Regards,
Frank
You can try to set rlimit. I remember (but not sure) on some systems
such as solaris, core can't be generated if rlimit is unlimited?
--
Steven Ding
Email: wjding<at>gmail.com
Michael Paoli
2006-06-12 03:52:39 UTC
Permalink
Post by Frank Meerkötter
i'm having trouble generating core dumps for a certain program.
Make sure all the prerequisite conditions are met,
e.g. is the program able to write file named core in the current
working directory.
http://www.fastcgi.com/archives/fastcgi-developers/2001-June/001290.html
Seems I've run across some man page before that spelled out all the
sufficient and necessary conditions for program to dump core, but at
present I'm not quickly and easily locating such.

Loading...