Re: X-Inside posts Linux bug, has it been reported anywhere else?

Thomas Roell (roell@crab.xinside.com)
Mon, 18 Nov 1996 08:22:36 -0700 (MST)


In your message of 17 November 1996 you write:

> From: roell@xinside.com (Thomas Roell)
> Date: 12 Nov 1996 09:27:42 -0700
>
> We found now the problem. Basically it's a LINUX kernel bug. It seems
> to appear at least on kernels between 2.0.0 and 2.0.22. Older kernels
> do work fine. In case I don't bore anybody, here what's really
> happening. If you do a read() system call in a non-blocking device,
> and it get's interrupted in the system call (which kind of should not
> happen at all), then a posix compilant system (and LINUX for that
> matter) should return an error of EAGAIN. However the kernels
> mentioned above randomly return either EINTR (which is for blocking
> devices) or ERESTARTSYS, which the docs say "Should never be seen by
> user programs".
>
> Umm... that sounds interesting. What evidence do you have to
> demonstrate this? (You realize that just because strace shows
> ERESTARTSYS doesn't mean that the user program ever gets the
> ERESTARTSYS; the system call just gets restarted.)

What about looking at what read() returns ?

> What device were you finding this before? I've just desk-checked the
> tty N_TTY code, and it sure doesn't look like it has this problem. Each
> device implements its own reader code, though, so you really need to
> specify which device you were using.

Socket-io code. Linus got me this fix:

-----
--- v2.0.25/linux/net/ipv4/tcp.c Wed Nov 13 11:26:24 1996
+++ linux/net/ipv4/tcp.c Thu Nov 14 20:56:46 1996
@@ -1420,6 +1420,8 @@
if (copied)
break;
copied = -ERESTARTSYS;
+ if (nonblock)
+ copied = -EAGAIN;
break;
}

-----

- Thomas

-- 
Denver Office               THOMAS ROELL        /\      Das Reh springt hoch,
+1(303)298-7478             X INSIDE INC       /  \/\   das Reh springt weit,
1801 Broadway, Suite 1710                     /    \ \/\     was soll es tun,
Denver, CO 80202          roell@xinside.com  / Oelch! \ \     es hat ja Zeit.