[Patch]Re: Serious reproducible 2.4.x kernel hang

Prasanna P Subash (psubash@turbolinux.com)
Fri, 2 Feb 2001 01:25:50 -0800


--qcHopEYAB45HaUaB
Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J"
Content-Disposition: inline

--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

=20
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/socket.h>
>=20
> int
> main(int argc, const char* argv[])
> {
> int retval;
> int sockets[2];
> char buf[1];
>=20
> retval =3D socketpair(PF_UNIX, SOCK_DGRAM, 0, sockets);
> if (retval !=3D 0)
> {
> perror("socketpair");
> exit(1);
> }
> shutdown(sockets[0], SHUT_RDWR);
> read(sockets[0], buf, 1);
> }

I tried to debug this issue with the kdb on 2.4.1-pre7.
Here is the stack trace

mcount+0x1f9
wait_for_packet+0x13
skb_recv_datagram+0xbb
unix_dgram_recvmsg+0x53
sock_recvmsg+0x41
sock_read+0x8f
sys_read+0xa4
system_call+0x3c

I looked at the skb_recv_datagram code and noticed that wait_for_packet is =
not
returning an error, even while trying to read a closed socket.
Anyways here is a patch against 2.4.1 that will fix the issue.
Please feel free to flame me about the patch :)

thanks
--=20
Prasanna Subash --- psubash@turbolinux.com --- TurboLinux, INC
------------------------------------------------------------------------
Linux, the choice | Q: How do you keep a moron in suspense?=20
of a GNU generation -o) |=20
Kernel 2.2.16 /\\ |=20
on a i686 _\\_v |=20
|=20
------------------------------------------------------------------------

--VbJkn9YxBvnuCH5J
Content-Type: application/x-patch
Content-Disposition: attachment; filename="dgram.patch"
Content-Transfer-Encoding: quoted-printable

--- 2.4.1/net/core/datagram.c Fri Feb 2 01:00:10 2001=0A+++ linux/net/core=
/datagram.c Fri Feb 2 01:06:59 2001=0A@@ -74,15 +74,15 @@=0A if (error)=
=0A goto out;=0A =0A- if (!skb_queue_empty(&sk->receive_queue))=0A- goto=
ready;=0A-=0A+ error =3D -ENOTCONN;=0A /* Socket shut down? */=0A if (sk=
->shutdown & RCV_SHUTDOWN)=0A goto out;=0A =0A+ if (!skb_queue_empty(&sk-=
>receive_queue))=0A+ goto ready;=0A+=0A /* Sequenced packets can come dis=
connected. If so we report the problem */=0A- error =3D -ENOTCONN;=0A if(c=
onnection_based(sk) && !(sk->state=3D=3DTCP_ESTABLISHED || sk->state=3D=3DT=
CP_LISTEN))=0A goto out;=0A =0A
--VbJkn9YxBvnuCH5J--

--qcHopEYAB45HaUaB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6en0e5UrYeFg/7bURAtClAJ4gyoZhZgiXLP8OaKYr1J45IcA01QCcCFfm
0lT4amgxIc0kDwh+dudHYQ4=
=dng3
-----END PGP SIGNATURE-----

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