archive mirror
 help / color / mirror / Atom feed
From: Olivier Langlois <>
To: Jens Axboe <>,
	Pavel Begunkov <>,
	Oleg Nesterov <>,
	Steven Rostedt <>,
	Ingo Molnar <>,
	"Eric W. Biederman" <>,,,
Subject: [PATCH 3/3] coredump: cancel io_uring requests before dumping core
Date: Sun, 22 Aug 2021 17:06:06 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

The previous solution of ignoring the TIF_NOTIFY_SIGNAL bit while
dumping core is only working when the core dump is sent in a file.

When a pipe is used, pipe_write returns -ERESTARTSYS if signal_pending
which includes TIF_NOTIFY_SIGNAL is true.

A more robust solution is to make sure that io_uring will not set
TIF_NOTIFY_SIGNAL while the core dump is generated by cancelling all
the io_uring requests made by the current task before starting.

Fixes: 06af8679449d ("coredump: Limit what can interrupt coredumps")
Signed-off-by: Olivier Langlois <>
 fs/coredump.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/coredump.c b/fs/coredump.c
index 07afb5ddb1c4..9aceb4b3b40d 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -41,6 +41,7 @@
 #include <linux/fs.h>
 #include <linux/path.h>
 #include <linux/timekeeping.h>
+#include <linux/io_uring.h>
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
@@ -625,6 +626,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
 		need_suid_safe = true;
+	io_uring_task_cancel();
 	retval = coredump_wait(siginfo->si_signo, &core_state);
 	if (retval < 0)
 		goto fail_creds;

      parent reply	other threads:[~2021-08-22 21:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 21:05 [PATCH 0/3] coredump: io_uring: Cancel io_uring to avoid core truncation Olivier Langlois
2021-08-22 21:05 ` [PATCH 1/3] tracehook: Add a return value to tracehook_notify_signal Olivier Langlois
2021-08-22 21:05 ` [PATCH 2/3] io_uring: Clear TIF_NOTIFY_SIGNAL when cancelling requests Olivier Langlois
2021-08-22 21:06 ` Olivier Langlois [this message]

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \

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