All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: paul@mad-scientist.net, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>
Subject: Re: [2.6.27.24] Kernel coredump to a pipe is failing
Date: Wed, 27 May 2009 20:31:09 +0200	[thread overview]
Message-ID: <20090527183109.GA30574@redhat.com> (raw)
In-Reply-To: <878wkjobbm.fsf@basil.nowhere.org>

On 05/26, Andi Kleen wrote:
>
> 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.

Actually, I think there is a strong reason to handle signals during
core dumping. The coredump can take a lot of time/resources, not good
it looks like unkillable procees to users.

Please look at

	killable/interruptible coredumps
	http://marc.info/?l=linux-kernel&m=121665710711931

at least, I think SIGKILL should terminate core dumping.

> Open issue: ELF puts blocked signals into the core dump and
> that will be always fully blocked now.  Need to save it somewhere?
>
> --- 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(&current->sighand->siglock);
> +	sigfillset(&current->blocked);
> +	/* No recalc sigpending */
> +	spin_unlock_irq(&current->sighand->siglock);

Perhaps it makes sense to do

	--- a/kernel/signal.c
	+++ b/kernel/signal.c
	@@ -644,6 +644,7 @@ static int prepare_signal(int sig, struc
			/*
			 * The process is in the middle of dying, nothing to do.
			 */
	+		 return 0;
		} else if (sig_kernel_stop(sig)) {
			/*
			 * This is a stop signal.  Remove SIGCONT from all queues.

instead, this was discussed before. This way the exiting/coredumping
task ignores all signals, and we cab simplify complete_signal() a bit.


This all needs more discussion, but imho for now something like
Paul's patch http://marc.info/?l=linux-kernel&m=124340506200729
is the best workaround. Note that we have the same dump_write()
in binfmt_elf.c and binfmt_aout.c, perhaps it makes sense to
create coredump_file_write() helper in fs/exec.c.

Oleg.


  parent reply	other threads:[~2009-05-27 18:35 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
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 [this message]
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=20090527183109.GA30574@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@mad-scientist.net \
    --cc=roland@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.