[lkml]   [2008]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 1/3] signals: sigqueue_free: don't free sigqueue if it is queued
    On 05/21, Roland McGrath wrote:
    > -void flush_sigqueue(struct sigpending *queue)
    > +static void __flush_sigqueue(struct sigpending *queue, int timers)
    > {
    > struct sigqueue *q;
    > sigemptyset(&queue->signal);
    > while (!list_empty(&queue->list)) {
    > q = list_entry(queue->, struct sigqueue , list);
    > + if (timers && q->info.si_code != SI_TIMER)
    > + continue;
    > list_del_init(&q->list);
    > __sigqueue_free(q);
    > }
    > }

    This is not enough. Again, we remove and free sigqueue but don't discard
    the pending signal. (and we must take into account other rt signals with
    the same si_signo if we want to discard the signal).

    Oh, this problem is unexpectedly nasty. It is trivial and minor, we can
    solve it in may ways, but personally I can't find a simple/clean way.

    Let's look at my first attempt,

    the patch was "almost" correct.
    We can add the "bool cancel" parameter to sigqueue_free(), true when
    called from exec (or exit_itimers). In that case SIGQUEUE_SHARED_PENDING
    is enough: the pending signal was either sent to current, or it is group
    wide. Not nice too of course, but afaics a bit simpler. Actually, the
    patch exists:

    What do you think?

    (instead of SIGQUEUE_SHARED_PENDING, we can encode "struct sigpending *"
    in q->flags, but this is really awful and I agree with Linus on the
    EINTR/etc issues).

    I'll try to think more on Weekend.


     \ /
      Last update: 2008-05-22 14:17    [W:0.041 / U:11.872 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site