From owner-freebsd-hackers Mon Nov 13 22:17:24 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from grimreaper.grondar.za (grimreaper.grondar.za [196.7.18.138]) by hub.freebsd.org (Postfix) with ESMTP id 388BE37B479 for ; Mon, 13 Nov 2000 22:17:17 -0800 (PST) Received: from grondar.za (localhost [127.0.0.1]) by grimreaper.grondar.za (8.11.1/8.11.1) with ESMTP id eAE6Gvw04883; Tue, 14 Nov 2000 08:16:58 +0200 (SAST) (envelope-from mark@grondar.za) Message-Id: <200011140616.eAE6Gvw04883@grimreaper.grondar.za> To: Alfred Perlstein Cc: hackers@freebsd.org Subject: Re: patches for 4.x devrandom so that bind "works" References: <20001113160614.R11449@fw.wintelcom.net> In-Reply-To: <20001113160614.R11449@fw.wintelcom.net> ; from Alfred Perlstein "Mon, 13 Nov 2000 16:06:14 PST." Date: Tue, 14 Nov 2000 08:16:57 +0200 From: Mark Murray Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi I have something similar to this, and it goes slightly further. Yes, it is this simple :-). M > I was playing with bind9 and got the typical: > > On FreeBSD systems, the server logs error messages like "fcntl(8, > F_SETFL, 4): Inappropriate ioctl for device". This is due to > a bug in the FreeSBD /dev/random device. The bug has been > reported to the FreeBSD maintainers. Versions of OpenBSD prior > to 2.8 have a similar problem. > > I took a look at what OpenBSD did and it looks like they just > no-op'd out the ioctl: > > http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/rnd.c?r1=1.40&r2=1.41 > > I have a patch that seems to shut bind up, but I'm not 100% sure > this is the right fix, as it looks like it just fakes the nonblocking > access to the random devices. > > Here's my patch (I can probably generate this for alpha): > > Index: mem.c > =================================================================== > RCS file: /home/ncvs/src/sys/i386/i386/mem.c,v > retrieving revision 1.79.2.4 > diff -u -u -r1.79.2.4 mem.c > --- mem.c 2000/08/04 22:31:07 1.79.2.4 > +++ mem.c 2000/11/13 23:53:43 > @@ -57,6 +57,7 @@ > #include > #include > #include > +#include > #include > > #include > @@ -465,8 +466,20 @@ > * selecting and inspecting which interrupts are used in the muck > * gathering business. > */ > - if (cmd != MEM_SETIRQ && cmd != MEM_CLEARIRQ && cmd != MEM_RETURNIRQ) > + switch (cmd) { > + case FIOASYNC: > + /* rnd has no async flag in softc so this is really a no-op. */ > + /* FALLTHROUGH */ > + case FIONBIO: > + /* Handled in the upper FS layer. */ > + return (0); > + case MEM_SETIRQ: > + case MEM_CLEARIRQ: > + case MEM_RETURNIRQ: > + break; > + default: > return (ENOTTY); > + } > > /* > * Even inspecting the state is privileged, since it gives a hint > > Did I miss part of the OpenBSD delta? This looks too easy. :( > > -- > -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] > "I have the heart of a child; I keep it in a jar on my desk." > -- Mark Murray Join the anti-SPAM movement: http://www.cauce.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message