mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
coredump: only SIGKILL should interrupt the coredumping task
There are 2 well known and ancient problems with coredump/signals, and a lot of related bug reports: - do_coredump() clears TIF_SIGPENDING but of course this can't help if, say, SIGCHLD comes after that. In this case the coredump can fail unexpectedly. See for example wait_for_dump_helper()->signal_pending() check but there are other reasons. - At the same time, dumping a huge core on the slow media can take a lot of time/resources and there is no way to kill the coredumping task reliably. In particular this is not oom_kill-friendly. This patch tries to fix the 1st problem, and makes the preparation for the next changes. We add the new SIGNAL_GROUP_COREDUMP flag set by zap_threads() to indicate that this process dumps the core. prepare_signal() checks this flag and nacks any signal except SIGKILL. Note that this check tries to be conservative, in the long term we should probably treat the SIGNAL_GROUP_EXIT case equally but this needs more discussion. See marc.info/?l=linux-kernel&m=120508897917439 Notes: - recalc_sigpending() doesn't check SIGNAL_GROUP_COREDUMP. The patch assumes that dump_write/etc paths should never call it, but we can change it as well. - There is another source of TIF_SIGPENDING, freezer. This will be addressed separately. Signed-off-by: Oleg Nesterov <[email protected]> Tested-by: Mandeep Singh Baines <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Neil Horman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Roland McGrath <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
66e5b7e194
commit
403bad72b6
3 changed files with 10 additions and 10 deletions
|
|
@ -854,12 +854,14 @@ static void ptrace_trap_notify(struct task_struct *t)
|
|||
* Returns true if the signal should be actually delivered, otherwise
|
||||
* it should be dropped.
|
||||
*/
|
||||
static int prepare_signal(int sig, struct task_struct *p, bool force)
|
||||
static bool prepare_signal(int sig, struct task_struct *p, bool force)
|
||||
{
|
||||
struct signal_struct *signal = p->signal;
|
||||
struct task_struct *t;
|
||||
|
||||
if (unlikely(signal->flags & SIGNAL_GROUP_EXIT)) {
|
||||
if (signal->flags & (SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP)) {
|
||||
if (signal->flags & SIGNAL_GROUP_COREDUMP)
|
||||
return sig == SIGKILL;
|
||||
/*
|
||||
* The process is in the middle of dying, nothing to do.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue