mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	Pavel Emelyanov <xemul@openvz.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] Consolidate send_sigqueue and send_group_sigqueue
Date: Thu, 28 Feb 2008 23:32:05 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.1.00.0802282326560.3111@apollo.tec.linutronix.de> (raw)
In-Reply-To: <20080228113633.7431C2700FD@magilla.localdomain>

On Thu, 28 Feb 2008, Roland McGrath wrote:

> That code dates from the original introduction of those two functions.
> I can't see any reason why those ever had swapped order of the two checks.
> I think it must have just been sloppy coding in the original work.
> 
> I'm not clear on how the already-queued case could ever happen.  Do we
> really need that check at all?  It shouldn't be possible for the timer to
> be firing when it's already queued, because it won't have been reloaded.
> It only reloads via do_schedule_next_timer after it's dequeued, or because
> a 1 return value said it never was queued.  Perhaps a timer_settime can
> restart it while queued?  But I don't think it should.
> 
> I think the rules for send_sigqueue and send_group_sigqueue should match.
> Any call that did not result in the signal being queued must return 1.
> If it is in fact possible at all that the signal is already queued, then
> that case must return 0 if the signal will ever be dequeued.
> 
> Looking at this makes me think we are incorrect in another anal case.
> Say the timer signal is blocked and the timer has fired, so it is on the
> queue and expects to be reloaded by do_schedule_next_timer at dequeue.
> Now, sigaction is used to set that signal to SIG_IGN, so the pending
> signal is removed from the queue but not dequeued.  Time passes, so the
> timer has in theory fired and reloaded several times counted as overruns.
> Next, sigaction is used to establish a handler for that signal, and then
> we unblock it too.  Time continues to pass, but the timer has not been
> reloaded after the first firing, and so it never fires with the handled
> signal though it now should have done so.  This case is at least a bit
> pathological.  But I'm not sure there is anything in POSIX to exempt us
> from making it work correctly.  Off hand the change that seems like it
> would work is to do the dequeue-time SI_TIMER check at discard time too.

Right. I was working on a fix for that for a different reason. What we
really want is a check for such a timer on a transition from SIGIGN to
another state.  This would allow us to drop the ugly auto rearm code
for ignored timers completely. I had some working proof of concept
code, but got distracted. Need to find it again and dust if off.

Thanks,

	tglx

  parent reply	other threads:[~2008-02-28 22:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 12:56 Pavel Emelyanov
2008-02-22 14:41 ` Oleg Nesterov
2008-02-28  4:54   ` Thomas Gleixner
2008-02-28  6:17     ` Oleg Nesterov
     [not found]       ` <20080228113633.7431C2700FD@magilla.localdomain>
2008-02-28 15:36         ` Oleg Nesterov
2008-02-28 20:14           ` Roland McGrath
2008-02-29 11:32             ` Oleg Nesterov
2008-02-28 22:32         ` Thomas Gleixner [this message]
2008-02-28 22:41           ` Roland McGrath
2008-02-29  8:04             ` Thomas Gleixner

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=alpine.LFD.1.00.0802282326560.3111@apollo.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=xemul@openvz.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®