Re: Atomic signal flags for vi(1)

2021-09-02 Thread Martijn van Duren
On Thu, 2021-09-02 at 13:25 +0200, Ingo Schwarze wrote: > Hi Tim, > > trondd wrote on Wed, Sep 01, 2021 at 08:46:28PM -0400: > > Ingo Schwarze wrote: > > > Ingo Schwarze wrote on Wed, Sep 01, 2021 at 04:38:51PM +0200: > > > > > Note that the h_hup() and h_term() signal handlers are still unsafe

Re: Atomic signal flags for vi(1)

2021-09-02 Thread Ingo Schwarze
Hi Tim, trondd wrote on Wed, Sep 01, 2021 at 08:46:28PM -0400: > Ingo Schwarze wrote: >> Ingo Schwarze wrote on Wed, Sep 01, 2021 at 04:38:51PM +0200: >>> Note that the h_hup() and h_term() signal handlers are still unsafe >>> after this commit because they also set the "killersig" (how fitting!

Re: Atomic signal flags for vi(1)

2021-09-01 Thread trondd
Ingo Schwarze wrote: > Hi, > > Ingo Schwarze wrote on Wed, Sep 01, 2021 at 04:38:51PM +0200: > > > Note that the h_hup() and h_term() signal handlers are still unsafe > > after this commit because they also set the "killersig" (how fitting!) > > field in a global struct. > > I like it when fix

Re: Atomic signal flags for vi(1)

2021-09-01 Thread Ingo Schwarze
Hi, Ingo Schwarze wrote on Wed, Sep 01, 2021 at 04:38:51PM +0200: > Note that the h_hup() and h_term() signal handlers are still unsafe > after this commit because they also set the "killersig" (how fitting!) > field in a global struct. I like it when fixing two bugs only amounts to minus: minus

Re: Atomic signal flags for vi(1)

2021-09-01 Thread Ingo Schwarze
Hi Tim, trondd wrote on Tue, Aug 24, 2021 at 07:45:33PM -0400: > "Theo de Raadt" wrote: >> +h_alrm(int signo) >> +{ >> + GLOBAL_CLP; >> + >> + F_SET(clp, CL_SIGALRM); >> >> F_SET is |=, which is not atomic. >> >> This is unsafe. Safe signal handlers need to make single stores to

Re: Atomic signal flags for vi(1)

2021-08-29 Thread Ingo Schwarze
Hi Theo, Theo de Raadt wrote on Sun, Aug 29, 2021 at 11:38:18AM -0600: > Ingo Schwarze wrote: >> *If* more than one GS object ever existed and/or the .gp pointers >> in different SCR objects could point to different GS objects, this >> patch might change behaviour. > If such multiple GS conditio

Re: Atomic signal flags for vi(1)

2021-08-29 Thread Theo de Raadt
> *If* more than one GS object ever existed and/or the .gp pointers > in different SCR objects could point to different GS objects, this > patch might change behaviour. If such multiple GS condition ever existed, since signals are (global), the handler is only indicating a signal has happened. An

Re: Atomic signal flags for vi(1)

2021-08-29 Thread Ingo Schwarze
Hi, Theo de Raadt wrote on Sun, Aug 29, 2021 at 02:54:57AM -0600: > This does look better. > > I appreciate that you are fixing this underlying problem first, before > overlaying your timer diff. Indeed. > Is this working for the vi crowd? *If* more than one GS object ever existed and/or the

Re: Atomic signal flags for vi(1)

2021-08-29 Thread Martijn van Duren
I'll see if I can fit this one in in the next few days. Feel free to remind me :-) martijn@ On Sun, 2021-08-29 at 02:54 -0600, Theo de Raadt wrote: > This does look better. > > I appreciate that you are fixing this underlying problem first, before > overlaying your timer diff. > > Is this worki

Re: Atomic signal flags for vi(1)

2021-08-29 Thread Theo de Raadt
This does look better. I appreciate that you are fixing this underlying problem first, before overlaying your timer diff. Is this working for the vi crowd? trondd wrote: > "Theo de Raadt" wrote: > > > +h_alrm(int signo) > > +{ > > + GLOBAL_CLP; > > + > > + F_SET(clp, CL_SIGALRM)

Atomic signal flags for vi(1)

2021-08-24 Thread trondd
"Theo de Raadt" wrote: > +h_alrm(int signo) > +{ > + GLOBAL_CLP; > + > + F_SET(clp, CL_SIGALRM); > > F_SET is |=, which is not atomic. > > This is unsafe. Safe signal handlers need to make single stores to > atomic-sized variables, which tend to be int-sized, easier to declare > as