From: Thomas Gleixner <tglx@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Frederic Weisbecker <frederic@kernel.org>,
Hyunwoo Kim <imv4bel@gmail.com>,
brauner@kernel.org, peterz@infradead.org,
anna-maria@linutronix.de, ebiederm@xmission.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] signal: Use list_del_init_careful() in flush_sigqueue()
Date: Wed, 26 Aug 2026 21:19:23 +0200 [thread overview]
Message-ID: <87zey8g05g.ffs@fw13> (raw)
In-Reply-To: <ao6zmDB9EjsqPIVN@redhat.com>
On Wed, Aug 26 2026 at 11:36, Oleg Nesterov wrote:
> On 08/25, Thomas Gleixner wrote:
>>
>> On Tue, Aug 25 2026 at 20:53, Oleg Nesterov wrote:
>> >
>> > And I'd suggest to check t->exit_state instead of PF_EXITING,
>> > posixtimer_send_sigqueue() can't miss it if it is called after
>> > scoped_guard(spinlock_irq, lock).
>>
>> It neither can miss PF_EXITING which is also set under sighand lock.
>
> Yes, I didn't mean that the PF_EXITING check is wrong... nevermind.
>
>> Once begin_new_exec() sets bprm->point_of_no_return = true there is
>> _ZERO_ reason to queue any posix timer signal anymore. Any failure after
>> that point will be fatal and shut the whole process down.
>>
>> begin_new_exex()
>> {
>> ...
>>
>> bprm->point_of_no_return = true;
>>
>> scoped_guard(spinlock_irq, &me->sighand->siglock)
>> me->signal->flags |= SIGNAL_EXEC;
>
> We already have me->signal->group_exec_task.
I know.
> In mt-exec case it is always set under ->siglock, and cleared after
> the last thread passes __exit_signal() which takes the same lock.
That should work too.
My preference was to keep posix timer signal queueing completely
disabled until the posix timer cleanup has been done independent of the
multi-threaded exec(). The group exec check was just added because it's
the same single conditional in posixtimer_send_sigqueue().
>> de_thread(me)
>> ...
>>
>> // FIXME: This sequence should be cleaned up with a
>> // posix_timer_exec() function with a proper stub
>> // for CONFIG_POSIX_TIMERS=n.
>>
>> #ifdef CONFIG_POSIX_TIMERS
>> spin_lock_irq(&me->sighand->siglock);
>> posix_cpu_timers_exit(me);
>> spin_unlock_irq(&me->sighand->siglock);
>> exit_itimers(me);
>> flush_itimer_signals();
>> #endif
>
> OK... unfortunately we can't do this CONFIG_POSIX_TIMERS sequence before
> de_thread()... Another not-yet-exited sub-thread can create a timer
> with it_pid = current->pid. Right?
Yes.
>> and in posixtimer_send_sigqueue()
>>
>> if (!likely(lock_task_sighand(t, &flags)))
>> return;
>>
>> if (unlikely(t->signal->flags & (SIGNAL_EXEC)))
>> goto unlock;
>
> See above, I think it can check t->signal->group_exec_task. Perhaps along
> with SIGNAL_GROUP_EXIT.
>
> So. With this change release_task()->flush_sigqueue(&old_leader->pending)
> can still race with posixtimer_send_sigqueue(), but it will do nothing.
>
> But it also does "nothing" if tmr->sigq is already pending (!list_empty)
> so I am starting to think about the change below again...
Sure, but that's an orthogonal optimization once we fixed the exec()
mess :)
next prev parent reply other threads:[~2026-08-26 19:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 5:37 Hyunwoo Kim
2026-08-22 10:27 ` Bradley Morgan
2026-08-23 12:47 ` Oleg Nesterov
2026-08-24 2:53 ` Hyunwoo Kim
2026-08-24 8:28 ` Oleg Nesterov
2026-08-24 8:04 ` Thomas Gleixner
2026-08-24 9:45 ` Thomas Gleixner
2026-08-24 11:02 ` Oleg Nesterov
2026-08-24 11:54 ` Oleg Nesterov
2026-08-24 13:59 ` Frederic Weisbecker
2026-08-24 14:29 ` Oleg Nesterov
2026-08-25 16:58 ` Thomas Gleixner
2026-08-25 18:53 ` Oleg Nesterov
2026-08-25 19:58 ` Thomas Gleixner
2026-08-26 9:36 ` Oleg Nesterov
2026-08-26 19:19 ` Thomas Gleixner [this message]
2026-08-26 19:32 ` Oleg Nesterov
2026-08-27 3:29 ` Eric W. Biederman
2026-08-27 9:35 ` Thomas Gleixner
2026-08-27 18:43 ` Eric W. Biederman
2026-08-27 22:56 ` Thomas Gleixner
2026-08-27 12:24 ` Thomas Gleixner
2026-08-27 17:51 ` Thomas Gleixner
2026-08-24 12:11 ` Thomas Gleixner
2026-08-24 16:31 ` 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=87zey8g05g.ffs@fw13 \
--to=tglx@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=frederic@kernel.org \
--cc=imv4bel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®