The patch titled Subject: coredump: introduce dump_interrupted() has been added to the -mm tree. Its filename is coredump-introduce-dump_interrupted.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Oleg Nesterov <oleg@xxxxxxxxxx> Subject: coredump: introduce dump_interrupted() By discussion with Mandeep. Change dump_write(), dump_seek() and do_coredump() to check signal_pending() and abort if it is true. We add the new trivial helper, dump_interrupted(), to document that this probably needs more work and to simplify the potential freezer changes. Perhaps it will have more callers. Ideally it should do try_to_freeze() but then we need the unpleasant changes in dump_write() and wait_for_dump_helpers(). So far we simply accept the fact that the freezer can truncate a core-dump but at least you can reliably suspend. Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Acked-by: Mandeep Singh Baines <msb@xxxxxxxxxxxx> Cc: Neil Horman <nhorman@xxxxxxxxxx> Cc: "Rafael J. Wysocki" <rjw@xxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/coredump.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff -puN fs/coredump.c~coredump-introduce-dump_interrupted fs/coredump.c --- a/fs/coredump.c~coredump-introduce-dump_interrupted +++ a/fs/coredump.c @@ -418,6 +418,17 @@ static void coredump_finish(struct mm_st mm->core_state = NULL; } +static bool dump_interrupted(void) +{ + /* + * SIGKILL or freezing() interrupt the coredumping. Perhaps we + * can do try_to_freeze() and check __fatal_signal_pending(), + * but then we need to teach dump_write() to restart and clear + * TIF_SIGPENDING. + */ + return signal_pending(current); +} + static void wait_for_dump_helpers(struct file *file) { struct pipe_inode_info *pipe; @@ -636,7 +647,7 @@ void do_coredump(siginfo_t *siginfo) if (displaced) put_files_struct(displaced); - core_dumped = binfmt->core_dump(&cprm); + core_dumped = !dump_interrupted() && binfmt->core_dump(&cprm); if (ispipe && core_pipe_limit) wait_for_dump_helpers(cprm.file); @@ -664,7 +675,9 @@ fail: */ int dump_write(struct file *file, const void *addr, int nr) { - return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr; + return !dump_interrupted() && + access_ok(VERIFY_READ, addr, nr) && + file->f_op->write(file, addr, nr, &file->f_pos) == nr; } EXPORT_SYMBOL(dump_write); @@ -673,7 +686,8 @@ int dump_seek(struct file *file, loff_t int ret = 1; if (file->f_op->llseek && file->f_op->llseek != no_llseek) { - if (file->f_op->llseek(file, off, SEEK_CUR) < 0) + if (dump_interrupted() || + file->f_op->llseek(file, off, SEEK_CUR) < 0) return 0; } else { char *buf = (char *)get_zeroed_page(GFP_KERNEL); _ Patches currently in -mm which might be from oleg@xxxxxxxxxx are thinkpad-acpi-kill-hotkey_thread_mutex.patch lockdep-introduce-lock_acquire_exclusive-shared-helper-macros.patch lglock-update-lockdep-annotations-to-report-recursive-local-locks.patch ptrace-add-ability-to-retrieve-signals-without-removing-from-a-queue-v4.patch selftest-add-a-test-case-for-ptrace_peeksiginfo.patch coredump-only-sigkill-should-interrupt-the-coredumping-task.patch coredump-ensure-that-sigkill-always-kills-the-dumping-thread.patch coredump-sanitize-the-setting-of-signal-group_exit_code.patch coredump-introduce-dump_interrupted.patch coredump-factor-out-the-setting-of-pf_dumpcore.patch coredump-change-wait_for_dump_helpers-to-use-wait_event_interruptible.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html