public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] copy_process: remove the unneeded clear_tsk_thread_flag(TIF_SIGPENDING)
@ 2009-04-27 19:48 Oleg Nesterov
  2009-04-28  2:39 ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2009-04-27 19:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

The forked child can have TIF_SIGPENDING if it was copied from parent's
ti->flags. But this is harmless and actually almost never happens, because
copy_process() can't succeed if signal_pending() == T.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- PTRACE/kernel/fork.c~FORK_SIGPENDING	2009-04-13 17:05:52.000000000 +0200
+++ PTRACE/kernel/fork.c	2009-04-27 21:38:57.000000000 +0200
@@ -1027,7 +1027,6 @@ static struct task_struct *copy_process(
 	p->vfork_done = NULL;
 	spin_lock_init(&p->alloc_lock);
 
-	clear_tsk_thread_flag(p, TIF_SIGPENDING);
 	init_sigpending(&p->pending);
 
 	p->utime = cputime_zero;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] copy_process: remove the unneeded clear_tsk_thread_flag(TIF_SIGPENDING)
  2009-04-27 19:48 [PATCH] copy_process: remove the unneeded clear_tsk_thread_flag(TIF_SIGPENDING) Oleg Nesterov
@ 2009-04-28  2:39 ` Roland McGrath
  2009-04-28 12:47   ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Roland McGrath @ 2009-04-28  2:39 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, linux-kernel

Acked-by: Roland McGrath <roland@redhat.com>

> The forked child can have TIF_SIGPENDING if it was copied from parent's
> ti->flags. But this is harmless and actually almost never happens, because
> copy_process() can't succeed if signal_pending() == T.

When it does happen, it's actually improper to clear it.  In a CLONE_THREAD
case, the pending signals might include shared_pending signals that the
child too should take.  (Arguably there is no way to notice, since the
parent thread will be racing to dequeue the same signals.)


Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] copy_process: remove the unneeded clear_tsk_thread_flag(TIF_SIGPENDING)
  2009-04-28  2:39 ` Roland McGrath
@ 2009-04-28 12:47   ` Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2009-04-28 12:47 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Andrew Morton, linux-kernel

On 04/27, Roland McGrath wrote:
>
> Acked-by: Roland McGrath <roland@redhat.com>
>
> > The forked child can have TIF_SIGPENDING if it was copied from parent's
> > ti->flags. But this is harmless and actually almost never happens, because
> > copy_process() can't succeed if signal_pending() == T.
>
> When it does happen, it's actually improper to clear it.  In a CLONE_THREAD
> case, the pending signals might include shared_pending signals that the
> child too should take.  (Arguably there is no way to notice, since the
> parent thread will be racing to dequeue the same signals.)

Yes, sure. Now I see the changelog is not very clear.

I meant, it is possible that the parent has the false TIF_SIGPENDING which
is cleared later by recalc_sigpending(). In this case it is correct to do
clear_tsk_thread_flag(p, TIF_SIGPENDING), but this almost never happens.

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-28 12:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27 19:48 [PATCH] copy_process: remove the unneeded clear_tsk_thread_flag(TIF_SIGPENDING) Oleg Nesterov
2009-04-28  2:39 ` Roland McGrath
2009-04-28 12:47   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox