1.3.38 crash changed to a nice message :)

Snow Cat (snowcat@gd.cs.CSUFresno.EDU)
Wed, 8 Nov 1995 15:49:16 -0800 (PST)


-----BEGIN PGP SIGNED MESSAGE-----

Hi again,

I did Alt-ScrollLock and it appears that, as expected, kernel gets
stuck in unix_recvmsg. It appears that the function gets into infinite
loop if "num" is exactly equal to 0. Here is a patch that doesn't
solve the problem, but it replaces crash with a nice message, and it
does let me run emacs :)

*** linux/net/unix/af_unix.c Mon Nov 6 03:46:28 1995
- --- /usr/src/linux/net/unix/af_unix.c Wed Nov 8 08:46:09 1995
***************
*** 824,835 ****

while(ct--)
{
! int done=0;
sp=iov->iov_base;
len=iov->iov_len;
iov++;

! while(done<len)
{
if(copied & (flags&MSG_PEEK))
{
- --- 824,835 ----

while(ct--)
{
! int done=0, trouble = 0;
sp=iov->iov_base;
len=iov->iov_len;
iov++;

! while(done<len && trouble < 1024)
{
if(copied & (flags&MSG_PEEK))
{
***************
*** 884,889 ****
- --- 884,890 ----
*addr_len=sizeof(short);
}
num=min(skb->len,size-copied);
+ if(num <= 0) trouble++;
copied+=num;
done+=num;
if(flags&MSG_PEEK)
***************
*** 906,911 ****
- --- 907,914 ----
}
sti();
}
+ if(trouble == 1024)
+ printk("unix_recvmsg got stuck!\n");
}
up(&sk->protinfo.af_unix.readsem);
return copied;

- --
Snow ^oo^ Cat <snowcat@gd.cs.CSUFresno.EDU>
_ -> <- aka Oleg Kibirev <oleg@gd.cs.CSUFresno.EDU>
___(_) _ _)_
/ _) finger oleg@gd.cs.CSUFresno.EDU for PGP public key
\_.-._
|___/ Purr!

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2*

iQCVAgUBMKFB6yorW+pyrpD9AQEzLAQAtwuZDNkTai7fTZFbA4QLOW9/bzwWRzLL
q9Slz79TY0KrhWUVrI5Hkl4JVsZcKxDxQZSDD7Shu9jThQ+pYiZWu+r/TXHB/avg
Xim3g/hr0uFqEvn9cORSvttbGDr9DwxI/uOGNKiqsNgKvk0AFr3n5jewLqvQW5O4
4vv3zGLw7Ao=
=tHQX
-----END PGP SIGNATURE-----