From: Andi Kleen <andi@firstfloor.org>
To: paul@mad-scientist.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: [2.6.27.24] Kernel coredump to a pipe is failing
Date: Tue, 26 May 2009 22:31:41 +0200 [thread overview]
Message-ID: <878wkjobbm.fsf@basil.nowhere.org> (raw)
In-Reply-To: <1243355634.29250.331.camel@psmith-ubeta.netezza.com> (Paul Smith's message of "Tue, 26 May 2009 12:33:54 -0400")
Paul Smith <paul@mad-scientist.net> writes:
>
> So I annotated dump_write() to printk() if this operation is false, and
> I get:
>
> file ffff8803b95d0180: dump_write: -512 < 4096
>
> Well, -512 is ERESTARTSYS. That, to me, seems like a reasonable error
> code to get when we're trying to dump core to a pipe. Yes? No?
Which signal is it? SIGPIPE?
>
> Shouldn't we be doing some kind of error handling here, at least for
> basic things like signals? Should a process that's dumping core be set
> to ignore signals? Should dump_write() try again on ERESTARTSYS?
I think it should block signals. Here's a untested patch.
It has the disadvantage that it reports the incorrect blocked mask
in the ELF corefile, but that's probably better than truncated
coredumps.
-Andi
---
Block signals during core dump
When a signal happens during core dump the core dump to a pipe
can fail, because the write returns short, but the ELF core dumpers
cannot handle that.
There's no reason to handle signals during core dumping, so just
block them all.
Open issue: ELF puts blocked signals into the core dump and
that will be always fully blocked now. Need to save it somewhere?
Based on debugging by Paul Smith.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
fs/exec.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: linux-2.6.30-rc5-ak/fs/exec.c
===================================================================
--- linux-2.6.30-rc5-ak.orig/fs/exec.c 2009-05-14 11:46:24.000000000 +0200
+++ linux-2.6.30-rc5-ak/fs/exec.c 2009-05-26 22:22:12.000000000 +0200
@@ -1760,6 +1760,12 @@
goto fail;
}
+ /* block all signals */
+ spin_lock_irq(¤t->sighand->siglock);
+ sigfillset(¤t->blocked);
+ /* No recalc sigpending */
+ spin_unlock_irq(¤t->sighand->siglock);
+
down_write(&mm->mmap_sem);
/*
* If another thread got here first, or we are not dumpable, bail out.
--
ak@linux.intel.com -- Speaking for myself only.
next prev parent reply other threads:[~2009-05-26 20:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 16:33 [2.6.27.24] Kernel coredump to a pipe is failing Paul Smith
2009-05-26 18:01 ` Paul Smith
2009-05-26 20:31 ` Andi Kleen [this message]
2009-05-26 21:09 ` Paul Smith
2009-05-26 23:00 ` Andrew Morton
2009-05-26 23:14 ` Andi Kleen
2009-05-26 23:28 ` Andrew Morton
2009-05-26 23:41 ` Andi Kleen
2009-05-26 23:45 ` Andrew Morton
2009-05-27 0:11 ` Andi Kleen
2009-05-27 0:29 ` Andrew Morton
2009-05-27 6:02 ` Paul Smith
2009-05-27 6:17 ` Paul Smith
2009-05-27 7:31 ` Andi Kleen
2009-05-27 7:45 ` Andrew Morton
2009-05-27 8:52 ` Andi Kleen
2009-05-27 8:56 ` Andrew Morton
2009-05-27 20:25 ` Jesper Juhl
2009-05-29 10:34 ` Pavel Machek
2009-05-27 18:31 ` Oleg Nesterov
2009-05-27 18:50 ` Andi Kleen
2009-05-27 19:05 ` Oleg Nesterov
2009-05-27 19:49 ` Paul Smith
2009-05-27 20:34 ` Oleg Nesterov
2009-05-27 20:04 ` Oleg Nesterov
2009-05-27 20:22 ` Paul Smith
-- strict thread matches above, loose matches on Subject: below --
2009-05-22 12:34 Paul Smith
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=878wkjobbm.fsf@basil.nowhere.org \
--to=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@mad-scientist.net \
/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