Re: accept() improvements for rt signals

From: Alessandro Sala (a.sala@mclink.it)
Date: Sun Mar 05 2000 - 05:49:51 EST


Hello,

Julian Anastasov wrote:
>
> Hello,
>
> On Tue, 22 Feb 2000, Stephen C. Tweedie wrote:
>
> > Hi,
> >
> > On Tue, 22 Feb 2000 17:38:45 +0200 (EET), Julian Anastasov
> > <uli@linux.tu-varna.acad.bg> said:
> >
> > > Is there a known problem with O_NONBLOCK|O_ASYNC listening
> > > sockets (2.2.15pre7 UP) ? I receive unexpected SIGIO after accept()
> > > using such listening socket.
> >
>
> After adding some debugging in the kernel I found that
> send_sig_info() returns EPERM and send_sigio() fallbacks to
> SIGIO delivery using "send_sig(SIGIO, p, 1);". I have stopped to
> search the exact values used in the EPERM checking because I found
> this posting from Alessandro Sala <a.sala@mclink.it> on 06-DEC-1999
> with the subject:
> "PROBLEM: Asynchronous I/O with realtime signals erroneously sends SIGIO".
>
> http://kernelnotes.org/lnxlists/linux-kernel/lk_9912_01/msg01206.html
> http://marc.theaimsgroup.com/?l=linux-kernel&m=94451812209885&w=2
>
> The problem is described very well and I think I have
> the same one. send_sigio() must pass the perm checking in
> send_sig_info(). I didn't checked the corresponding 2.3 code. This

I checked 2.3.34 and it seems the problem is still there: the perm
checking code in send_sig_info() is the same as 2.2.x, SI_SIGIO still
has a negative value, and the macro SI_FROMUSER(siptr) is still
defined as (siptr)->si_code <= 0.

If you need to use realtime signals with F_SETSIG, I suggest you
apply the workaround I suggested in my posting: replace
the definition of SI_FROMUSER in asm-i386/siginfo.h with

#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0 && \
                                  (siptr)->si_code >= SI_QUEUE)

I'am using this and I've had no problems so far, but I realize
it's only a workaround: I'd like someone commented about my proposed
solution: changing the definition of SI_SIGIO, SI_ASYNCIO, SI_MESGQ
and SI_TIMER to positive values. I think this would solve the problem
and would make the realtime signals more compliant with The Single Unix
specification.

bye,
Alessandro

--
+-----------------------------------+
|     /\                            |
|    //\\                           |
|   <<  >>                          |
|    >><<     Alessandro Sala       |
|   <<  >>    a.sala@mclink.it      |
|    ||||                           |
+-----------------------------------+

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:18 EST