On Wed, Jul 11, 2018 at 03:40:23PM +0300, Paul Irofti wrote:
> > This is my original diff with some twaeks from visa@.
> 
> While I think this is a step in the right direction I don't think is the
> proper solution to the problem.

It is not intended as final solution.  My problem is that posixtestsuite
does not finish during regress.  Signals are not processes resulting
in hangs.  Then it is aborted by an overall timeout.

> I don't think this handles pthread_kill() signals and I agree with mpi@
> that the path should be split between thread signals and process signals.

The NetBSD approach seem correct.  We need a pending signal list
per thread and per process.  This is just a bunch of work.

> I will try to come up with something better in the following days.
> In the meantime if you guys want to commit this bit, I will not
> object.

I am happy that pirofti@ jumps in for the correct fix.  I would
prefer if I could get oks for my version now.  Then we would finish
posixtestsuite during regress in time and see daily results here
again.

http://bluhm.genua.de/testsuite/posixtestsuite/posixtestsuite.html

This would also help to visualize the effects of pirofti@'s fix.

bluhm

> > Index: kern/kern_sig.c
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sig.c,v
> > retrieving revision 1.220
> > diff -u -p -r1.220 kern_sig.c
> > --- kern/kern_sig.c 28 Apr 2018 03:13:04 -0000      1.220
> > +++ kern/kern_sig.c 9 Jul 2018 20:36:07 -0000
> > @@ -1155,14 +1155,17 @@ issignal(struct proc *p)
> >     int s;
> >  
> >     for (;;) {
> > -           mask = p->p_siglist & ~p->p_sigmask;
> > +           mask = SIGPENDING(p);
> >             if (pr->ps_flags & PS_PPWAIT)
> >                     mask &= ~stopsigmask;
> >             if (mask == 0)          /* no signal to send */
> >                     return (0);
> >             signum = ffs((long)mask);
> >             mask = sigmask(signum);
> > -           atomic_clearbits_int(&p->p_siglist, mask);
> > +           if (p->p_siglist & mask)
> > +                   atomic_clearbits_int(&p->p_siglist, mask);
> > +           else
> > +                   atomic_clearbits_int(&pr->ps_mainproc->p_siglist, mask);
> >  
> >             /*
> >              * We should see pending but ignored signals
> > @@ -1840,7 +1843,7 @@ userret(struct proc *p)
> >             KERNEL_UNLOCK();
> >     }
> >  
> > -   if (SIGPENDING(p)) {
> > +   if (SIGPENDING(p) != 0) {
> >             KERNEL_LOCK();
> >             while ((signum = CURSIG(p)) != 0)
> >                     postsig(p, signum);
> > Index: sys/signalvar.h
> > ===================================================================
> > RCS file: /data/mirror/openbsd/cvs/src/sys/sys/signalvar.h,v
> > retrieving revision 1.30
> > diff -u -p -r1.30 signalvar.h
> > --- sys/signalvar.h 24 Mar 2018 04:13:59 -0000      1.30
> > +++ sys/signalvar.h 9 Jul 2018 20:52:50 -0000
> > @@ -68,7 +68,9 @@ struct    sigacts {
> >  /*
> >   * Check if process p has an unmasked signal pending.
> >   */
> > -#define    SIGPENDING(p)   (((p)->p_siglist & ~(p)->p_sigmask) != 0)
> > +#define    SIGPENDING(p)                                                   
> > \
> > +   (((p)->p_siglist | (p)->p_p->ps_mainproc->p_siglist) &          \
> > +       ~(p)->p_sigmask)
> >  
> >  /*
> >   * Determine signal that should be delivered to process p, the current
> > @@ -76,10 +78,9 @@ struct   sigacts {
> >   * action, the process stops in issignal().
> >   */
> >  #define    CURSIG(p)                                                       
> > \
> > -   (((p)->p_siglist == 0 ||                                        \
> > -       (((p)->p_p->ps_flags & PS_TRACED) == 0 &&                   \
> > -       ((p)->p_siglist & ~(p)->p_sigmask) == 0)) ?                 \
> > -       0 : issignal(p))
> > +   (((((p)->p_siglist | (p)->p_p->ps_mainproc->p_siglist) == 0) || \
> > +   (((p)->p_p->ps_flags & PS_TRACED) == 0 && SIGPENDING(p) == 0))  \
> > +       ? 0 : issignal(p))
> >  
> >  /*
> >   * Clear a pending signal from a process.

Reply via email to