io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olivier Langlois <olivier@trillion01.com>
To: Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] coredump: io_uring: Cancel io_uring to avoid core truncation
Date: Sun, 22 Aug 2021 17:05:44 -0400	[thread overview]
Message-ID: <cover.1629655338.git.olivier@trillion01.com> (raw)

Before writing the core dump, io_uring requests have to be cancelled.

Also, io_uring cancellation code had to be modified as it could set the
TIF_NOTIFY_SIGNAL bit.

Few notes about this patchset:

1. My coredump.c proposal puts the io_uring_task_cancel call further
down the do_coredump function over what Jens did propose.

Considering that this function call can be relatively expensive, I
believe that postponing it as much as possible is the way to go.

I did place it before coredump_wait which clears signal bits so that
seems to be an appropriate location but the logic could possibly be
pushed even more with possibly no harm.

2. The current patch proposal only address specifically the issue caused
by io_uring. It could reoccur as soon as something else flips the
TIF_NOTIFY_SIGNAL bit.

Therefore, another solution would simply be to modify __dump_emit to make it
resilient to TIF_NOTIFY_SIGNAL as Eric W. Biederman originally
suggested.

or maybe do both...

So making __dump_emit more robust to the TIF_NOTIFY_SIGNAL situation
might be something interesting to investigate if it would be a good idea
to do on top or in replacement to this patchset.

Lastly, Jens did already submit a patch to solve the same problem:
https://lkml.org/lkml/2021/8/17/1156

If his patch ends being a superior solution to the problem,
the first 2 patches of this set are still relevant.

Olivier Langlois (3):
  tracehook: Add a return value to tracehook_notify_signal
  io_uring: Clear TIF_NOTIFY_SIGNAL when cancelling requests
  coredump: cancel io_uring requests before dumping core

 fs/coredump.c             | 3 +++
 fs/io_uring.c             | 2 +-
 include/linux/tracehook.h | 8 ++++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.32.0


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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 21:05 Olivier Langlois [this message]
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 ` [PATCH 3/3] coredump: cancel io_uring requests before dumping core Olivier Langlois

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=cover.1629655338.git.olivier@trillion01.com \
    --to=olivier@trillion01.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=ebiederm@xmission.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.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).