public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: NeilBrown <neil@brown.name>, Chris Mason <mason@kernel.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-mm@kvack.org, io-uring@vger.kernel.org
Subject: Re: user workers as coredumpers [Re: [PATCH 1/6] coredump: don't switch a dumper that has no files] table
Date: Sun, 20 Sep 2026 17:15:09 +0200	[thread overview]
Message-ID: <aq_4fY6GVtK47Njq@redhat.com> (raw)
In-Reply-To: <20260918-tonart-umgeladen-gesponnen-519fca5172bd@brauner>

On 09/18, Christian Brauner wrote:
>
> So I thought a bit about this yesterday and had some brief discussions
> bout this as well. I think we should kill this whole bug class by
> ensuring that PF_USER_WORKERs never participate in a coredump.

Agreed,

> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -3021,6 +3021,21 @@ bool get_signal(struct ksignal *ksig)
>  		 */
>  		current->flags |= PF_SIGNALED;
>
> +		/*
> +		 * PF_USER_WORKER threads will catch and exit on fatal signals
> +		 * themselves. They have cleanup that must be performed, so we
> +		 * cannot call do_exit() on their behalf. Note that ksig won't
> +		 * be properly initialized, PF_USER_WORKER's shouldn't use it.
> +		 *
> +		 * They must not dump core either. The dumper waits for every
> +		 * other thread in the group to exit, and a sibling's exit path
> +		 * may in turn wait for this worker's own exit, which only runs
> +		 * after get_signal() returns: io_sq_thread() ends up in
> +		 * io_wq_exit_workers() and waits there for its io-wq workers.
> +		 */
> +		if (current->flags & PF_USER_WORKER)
> +			goto out;

This probably makes sense anyway... but see below.

Perhaps it makes sense to change ptrace(PTRACE_SETSIGMASK) to fail if
child->flags & PF_USER_WORKER ?

Currently get_signal() from PF_USER_WORKER can only return SIGKILL,
I think we should keep this rule.



I don't think your change can fix all problems. Suppose we have a main
thread T and a PF_USER_WORKER sub-thread W.

Some signal, say, SIGHUP has a handler. Debugger unblocks SIGHUP for W.

Now, kill(SIGHUP, T) can choose W as a target, complete_signal() can
choose any thread if wants_signal(t) is true. W will "drop" this signal,
its signal handler won't be called.


In the longer term it would be nice to rework this logic somehow to not
rely on ->blocked...

Oleg.


  parent reply	other threads:[~2026-09-20 15:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 10:22 [PATCH 0/6] coredump & signals: an impossible affair Christian Brauner
2026-09-15 10:22 ` [PATCH 1/6] coredump: don't switch a dumper that has no files table Christian Brauner
2026-09-16 19:48   ` Chris Mason
2026-09-16 22:10     ` Christian Brauner
2026-09-17  1:51       ` NeilBrown
2026-09-17  8:49         ` user workers as coredumpers [Re: [PATCH 1/6] coredump: don't switch a dumper that has no files] table Christian Brauner
2026-09-18 12:28           ` Christian Brauner
2026-09-18 13:33             ` Christian Brauner
2026-09-20 15:15             ` Oleg Nesterov [this message]
2026-09-21 11:20               ` Christian Brauner
2026-09-15 10:22 ` [PATCH 2/6] fork: refuse new threads while a coredump is in progress Christian Brauner
2026-09-15 15:02   ` Oleg Nesterov
2026-09-16 11:30     ` Christian Brauner
2026-09-15 10:22 ` [PATCH 3/6] coredump: hold RCU while releasing parked threads Christian Brauner
2026-09-15 15:13   ` Oleg Nesterov
2026-09-16 11:30     ` Christian Brauner
2026-09-15 10:22 ` [PATCH 4/6] signal: only SIGKILL interrupts a coredumping task Christian Brauner
2026-09-15 10:22 ` [PATCH 5/6] coredump: parse a snapshot of core_pattern Christian Brauner
2026-09-15 10:22 ` [PATCH 6/6] io-wq: order the exit bit against worker creation task work Christian Brauner
2026-09-15 12:01 ` [PATCH 0/6] coredump & signals: an impossible affair Jens Axboe

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=aq_4fY6GVtK47Njq@redhat.com \
    --to=oleg@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=io-uring@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mason@kernel.org \
    --cc=mingo@redhat.com \
    --cc=neil@brown.name \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /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