From: Oleg Nesterov <oleg@redhat.com>
To: Mandeep Singh Baines <msb@chromium.org>
Cc: linux-kernel@vger.kernel.org, Ben Chan <benchan@chromium.org>,
Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 5/5] coredump: ignore non-fatal signals when core dumping to a pipe
Date: Sat, 16 Feb 2013 18:10:10 +0100 [thread overview]
Message-ID: <20130216171010.GE4910@redhat.com> (raw)
In-Reply-To: <1361008406-2307-5-git-send-email-msb@chromium.org>
On 02/16, Mandeep Singh Baines wrote:
>
> Make wait_for_dump_helpers() not abort piping the core dump data when the
> crashing process has received a non-fatal signal. The abort still occurs
> in the case of SIGKILL.
>
> Testing:
>
> localhost ~ # echo "|/usr/bin/sleep 1d" > /proc/sys/kernel/core_pattern
> localhost ~ # sleep 1d &
As I already said, this is not enough. And if we change send_signal() paths
to "ignore" the non-fatal signals sent to the dumping process (and I think
we should do this anyway), this change is not needed.
Except we have other problems with the freezer.
> +static int sigkill_pending(struct task_struct *tsk)
> +{
> + return signal_pending(tsk) &&
> + (sigismember(&tsk->pending.signal, SIGKILL) ||
> + sigismember(&tsk->signal->shared_pending.signal, SIGKILL));
> +}
Why? __fatal_signal_pending() is enough, you do not need to check
->shared_pending. And once again, ignoring the freezer problems I
do not think we need this check at all.
IOW. Yes, we will probably need to do this change but only to be
freezer-friendly.
> static void wait_for_dump_helpers(struct file *file)
> {
> struct pipe_inode_info *pipe;
> + sigset_t blocked, previous;
> +
> + /* Block all but fatal signals. */
> + siginitsetinv(&blocked, sigmask(SIGKILL));
> + sigprocmask(SIG_BLOCK, &blocked, &previous);
(sigprocmask() must die, please never use, we have set_current_blocked().
Although in this particular case this doesn't matter...)
Heh. When I suggested this change a looong ago, my attempt was NACK'ed
because the core handler looks at /proc/pid/status.
If we could do this, we could simply ignore all signals except SIGKILL
at the start, in zap_threads(). This could solve almost all problems
with the signals/SIGKILL.
But see above, we can't.
Anyway. Please look at the patch below. I need to recheck it, and I was
going to send it later, along with other changes I am _trying_ to do. But
if it is correct, it looks certainly better and perhaps it can go ahead.
Afaics it could equally fix the mentioned problems (again, if correct ;).
"equally" also means it is equally incomplete.
Oleg.
--- x/fs/coredump.c
+++ x/fs/coredump.c
@@ -416,17 +416,17 @@ static void wait_for_dump_helpers(struct
pipe_lock(pipe);
pipe->readers++;
pipe->writers--;
+ // TODO: wake_up_interruptible_sync_poll ?
+ wake_up_interruptible_sync(&pipe->wait);
+ kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+ pipe_unlock(pipe);
- while ((pipe->readers > 1) && (!signal_pending(current))) {
- wake_up_interruptible_sync(&pipe->wait);
- kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
- pipe_wait(pipe);
- }
+ wait_event_freezekillable(&pipe->wait, pipe->readers == 1);
+ pipe_lock(pipe);
pipe->readers--;
pipe->writers++;
pipe_unlock(pipe);
-
}
/*
next prev parent reply other threads:[~2013-02-16 17:11 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-16 9:53 [PATCH 1/5] vfork: don't freezer_count() for in-kernel users of CLONE_VFORK Mandeep Singh Baines
2013-02-16 9:53 ` [PATCH 2/5] lockdep: check that no locks held at freeze time Mandeep Singh Baines
2013-02-16 17:06 ` Oleg Nesterov
2013-02-20 1:57 ` [PATCH v3] " Mandeep Singh Baines
2013-02-20 10:37 ` Ingo Molnar
2013-02-20 12:55 ` Rafael J. Wysocki
2013-02-20 13:52 ` Ingo Molnar
2013-02-20 22:30 ` Oleg Nesterov
2013-02-20 23:11 ` Mandeep Singh Baines
2013-02-20 23:17 ` [PATCH v4] " Mandeep Singh Baines
2013-02-20 23:24 ` Andrew Morton
2013-02-21 0:17 ` Mandeep Singh Baines
2013-02-21 0:20 ` Andrew Morton
2013-02-21 0:28 ` Mandeep Singh Baines
2013-02-21 0:42 ` Andrew Morton
2013-02-21 3:19 ` Mandeep Singh Baines
2013-02-21 3:17 ` [PATCH v5] " Mandeep Singh Baines
2013-02-21 15:42 ` Rafael J. Wysocki
2013-02-21 16:24 ` Mandeep Singh Baines
2013-02-21 16:51 ` [PATCH v6] " Mandeep Singh Baines
2013-02-21 21:42 ` Andrew Morton
2013-02-21 21:57 ` Mandeep Singh Baines
2013-02-16 9:53 ` [PATCH 3/5] coredump: use a freezable_schedule for the coredump_finish wait Mandeep Singh Baines
2013-02-16 17:17 ` Oleg Nesterov
2013-02-16 9:53 ` [PATCH 4/5] freezer: clear fake signal on exit from __refrigerator Mandeep Singh Baines
2013-02-16 17:06 ` Oleg Nesterov
2013-02-16 17:12 ` Oleg Nesterov
2013-02-20 18:09 ` Mandeep Singh Baines
2013-02-23 19:41 ` Oleg Nesterov
2013-02-23 19:59 ` Oleg Nesterov
2013-02-16 9:53 ` [PATCH 5/5] coredump: ignore non-fatal signals when core dumping to a pipe Mandeep Singh Baines
2013-02-16 17:10 ` Oleg Nesterov [this message]
2013-02-16 19:46 ` Oleg Nesterov
2013-02-18 23:55 ` Mandeep Singh Baines
2013-02-19 14:18 ` Oleg Nesterov
2013-02-19 5:19 ` Mandeep Singh Baines
2013-02-19 14:27 ` Oleg Nesterov
2013-02-19 19:33 ` Mandeep Singh Baines
2013-02-19 19:45 ` Oleg Nesterov
2013-02-19 20:20 ` Mandeep Singh Baines
2013-02-20 23:30 ` Mandeep Singh Baines
2013-02-23 19:21 ` Oleg Nesterov
2013-02-16 17:05 ` [PATCH 1/5] vfork: don't freezer_count() for in-kernel users of CLONE_VFORK Oleg Nesterov
2013-02-20 0:07 ` Mandeep Singh Baines
2013-02-20 1:41 ` Mandeep Singh Baines
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=20130216171010.GE4910@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=benchan@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=msb@chromium.org \
--cc=rjw@sisk.pl \
--cc=tj@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;
as well as URLs for NNTP newsgroup(s).