public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [2.6.27.24] Kernel coredump to a pipe is failing
Date: Tue, 26 May 2009 17:09:16 -0400	[thread overview]
Message-ID: <1243372156.7369.119.camel@homebase.localnet> (raw)
In-Reply-To: <878wkjobbm.fsf@basil.nowhere.org>

On Tue, 2009-05-26 at 22:31 +0200, Andi Kleen wrote:
> Paul Smith <paul@mad-scientist.net> writes:
> > 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?

I'm not sure; I'll have to dig in a little further.  I'm not sure
offhand how to determine which signal it was from inside the kernel but
it shouldn't be hard to find.

> >
> > 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.

As a quick test I changed dump_write() to retry on ERESTARTSYS after
disabling the pending signal, like:

        static int dump_write(struct file *file, const void *addr, int nr)
        {
                while (1) {
                        int r = file->f_op->write(file, addr, nr, &file->f_pos);
                        if (r != -ERESTARTSYS)
                                return r == nr;
        
                        /* We don't handle signals while dumping core. */
                        clear_thread_flag(TIF_SIGPENDING);
                }
        }

I don't know if this is right, but in some quick tests I ran it did
work: my cores were full size.  I haven't finished testing (and I have
to go to soccer practice right now).

This obviously doesn't reset the signal mask in the dumping process, but
it makes the dump_write() more complex and it may cause other issues so
I can't say whether this is the way to go.

> -
> Block signals during core dump

Cool, I'll test this one as well.


  reply	other threads:[~2009-05-26 21:09 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
2009-05-26 21:09   ` Paul Smith [this message]
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=1243372156.7369.119.camel@homebase.localnet \
    --to=paul@mad-scientist.net \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /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