public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Anthony Mallet <anthony.mallet@laas.fr>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	linux-kernel@vger.kernel.org, Dmitry Vyukov <dvyukov@google.com>,
	Marco Elver <elver@google.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: posix timer freeze after some random time, under pthread create/destroy load
Date: Fri, 22 Nov 2024 09:24:07 +0100	[thread overview]
Message-ID: <20241122082407.GA14342@redhat.com> (raw)
In-Reply-To: <Zz95qDPU2wcEp26r@localhost.localdomain>

On 11/21, Frederic Weisbecker wrote:
>
> I think this started with commit:
>
> bcb7ee79029d (posix-timers: Prefer delivery of signals to the current thread)
>
> The problem is that if the current task is exiting and has already been reaped,
> its sighand pointer isn't there anymore.

Thanks...

This can only happen if the exiting task has already passed exit_notify() which
sets exit_state. So I'd suggest to check current->exit_state instead of PF_EXITING
in the patch below.

Oleg.

> And so the signal is ignored even
> though it should be queued to and handled by the thread group that has other
> live threads to take care of it.
>
> Can you test the following patch? I'm cooking another patch with changelog for
> upstream that has seen recent changes in this area.
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 8f6330f0e9ca..4cadee618d4b 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1984,7 +1984,8 @@ int send_sigqueue(struct sigqueue *q, struct pid *pid, enum pid_type type)
>  	t = pid_task(pid, type);
>  	if (!t)
>  		goto ret;
> -	if (type != PIDTYPE_PID && same_thread_group(t, current))
> +	if (type != PIDTYPE_PID && same_thread_group(t, current) &&
> +	    !(current->flags & PF_EXITING))
>  		t = current;
>  	if (!likely(lock_task_sighand(t, &flags)))
>  		goto ret;
>
>


  reply	other threads:[~2024-11-22  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 21:29 posix timer freeze after some random time, under pthread create/destroy load Anthony Mallet
2024-11-21 18:19 ` Frederic Weisbecker
2024-11-22  8:24   ` Oleg Nesterov [this message]
2024-11-22 11:05     ` Frederic Weisbecker
2024-11-22 11:49       ` Oleg Nesterov
2024-11-22 12:01         ` Frederic Weisbecker
2024-11-22 12:38           ` Oleg Nesterov
2024-11-22 12:58             ` Frederic Weisbecker

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=20241122082407.GA14342@redhat.com \
    --to=oleg@redhat.com \
    --cc=anna-maria@linutronix.de \
    --cc=anthony.mallet@laas.fr \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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