From owner-freebsd-current Sat Dec 21 0:31: 3 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 96BBE37B401 for ; Sat, 21 Dec 2002 00:31:01 -0800 (PST) Received: from area51.slashnet.org (area51.slashnet.org [209.150.98.86]) by mx1.FreeBSD.org (Postfix) with ESMTP id 10B8143ED8 for ; Sat, 21 Dec 2002 00:31:01 -0800 (PST) (envelope-from smkelly@zombie.org) Received: from edgemaster.zombie.org (ip68-13-64-165.om.om.cox.net [68.13.64.165]) by area51.slashnet.org (Postfix) with ESMTP id 216BF4A358; Sat, 21 Dec 2002 03:30:49 -0500 (EST) Received: by edgemaster.zombie.org (Postfix, from userid 1001) id 54781415F8; Sat, 21 Dec 2002 02:30:36 -0600 (CST) Date: Sat, 21 Dec 2002 02:30:36 -0600 From: Sean Kelly To: Bruce Evans Cc: current@FreeBSD.ORG Subject: Re: `cat /dev/io` leads to system lockup. Message-ID: <20021221083036.GA736@edgemaster.zombie.org> References: <20021220062935.GA699@edgemaster.zombie.org> <20021220190007.B344-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <20021220190007.B344-100000@gamplex.bde.org> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 20, 2002 at 07:24:15PM +1100, Bruce Evans wrote: > On Fri, 20 Dec 2002, Sean Kelly wrote: >=20 > > On my 5.0-CURRENT kernel built 45 minutes ago, I can bring my system to= its > > knees by doing > > > > # cat /dev/io > > > > While I understand that this isn't exactly something one would normally= be > > doing, is it really something that should bring the system down? >=20 > No. Writing to /dev/io is not supported. write(2) to a device that > doesn't support writing should return -1 and set errno to ENODEV. >=20 > This was broken mainly by removing the default case from mem.c:mmrw(). > This causes mmrw() to loop endlessly without giving up control. Giant > locking in -current makes this especially fatal -- mmrw() holds Giant > so even most interrupt handlers are blocked. >=20 > In RELENG_4 the only bug near here is that mmrw() returns ENXIO instead > of ENODEV for writes to /dev/io. Thanks for pointing out where the code which handles /dev/io was. I see exactly what you mean, and I came up with a 2 liner that fixes it on my system. Could somebody check/commit this? edgemaster# cat /dev/io cat: /dev/io: Operation not supported by device edgemaster#=20 Index: sys/i386/i386/mem.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/home/ncvs/src/sys/i386/i386/mem.c,v retrieving revision 1.99 diff -p -u -r1.99 mem.c --- sys/i386/i386/mem.c 11 Oct 2002 14:58:28 -0000 1.99 +++ sys/i386/i386/mem.c 21 Dec 2002 07:54:29 -0000 @@ -195,6 +195,8 @@ mmrw(dev_t dev, struct uio *uio, int fla return (EFAULT); error =3D uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio); continue; + default: + return (ENODEV); } =20 if (error) --=20 Sean Kelly | PGP KeyID: D2E5E296 smkelly@zombie.org | http://www.zombie.org --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+BCarPm7A9NLl4pYRAtVcAKDL/M8+PN3yvOrEhTrd4DS7rs6A8ACgrFZr YQJf2QpabO2fz6SkzE5vNRM= =N+qO -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message