Date: Sun, 22 Feb 2004 17:14:55 -0800 From: Gregory Neil Shapiro <gshapiro@freebsd.org> To: "Marc G. Fournier" <scrappy@hub.org> Cc: freebsd-stable@freebsd.org Subject: Re: rndcontrol doesn't work on -STABLE? Message-ID: <20040223011455.GN62095@horsey.gshapiro.net> In-Reply-To: <20040222014736.I48887@ganymede.hub.org> References: <20040222010209.L48887@ganymede.hub.org> <20040222054729.GR62095@horsey.gshapiro.net> <20040222014736.I48887@ganymede.hub.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> > I found this comment in src/sys/i386/i386/mem.c: > > > > * XXX the data is 16-bit due to a historical botch, so we use > > * magic 16's instead of ICU_LEN and can't support 24 interrupts > > * under SMP. > > Great ... another reason to move up ... but, short term, is there any > other way of doing this? user land daemon or something? It looks like all of the kernel interfaces for inserting random entropy aren't exported out of the kernel. I looked through the code involved and it certainly seems that the code can handle the additional APIC_IO interrupts with a few minor changes (which I haven't tried). Someone will probably point out an obvious reason why this won't work (like some of the low level assembly interrupt handling routines). Index: sys/i386/i386/mem.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/mem.c,v retrieving revision 1.79.2.10 diff -u -r1.79.2.10 mem.c --- sys/i386/i386/mem.c 9 Aug 2003 16:21:18 -0000 1.79.2.10 +++ sys/i386/i386/mem.c 23 Feb 2004 01:03:44 -0000 @@ -65,6 +65,7 @@ #include <machine/psl.h> #include <machine/specialreg.h> #include <i386/isa/intr_machdep.h> +#include <i386/isa/icu.h> #include <vm/vm.h> #include <vm/pmap.h> @@ -96,7 +97,7 @@ /* bmaj */ -1 }; -static struct random_softc random_softc[16]; +static struct random_softc random_softc[ICU_LEN]; static caddr_t zbuf; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); @@ -471,9 +472,6 @@ return (ENOTTY); /* - * XXX the data is 16-bit due to a historical botch, so we use - * magic 16's instead of ICU_LEN and can't support 24 interrupts - * under SMP. * Even inspecting the state is privileged, since it gives a hint * about how easily the randomness might be guessed. */ @@ -489,7 +487,7 @@ error = suser(p); if (error != 0) return (error); - if (intr < 0 || intr >= 16) + if (intr < 0 || intr >= ICU_LEN) return (EINVAL); if (interrupt_allowed & interrupt_mask) break; @@ -506,7 +504,7 @@ error = suser(p); if (error != 0) return (error); - if (intr < 0 || intr >= 16) + if (intr < 0 || intr >= ICU_LEN) return (EINVAL); if (!(interrupt_allowed & interrupt_mask)) break; Index: usr.sbin/rndcontrol/rndcontrol.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/rndcontrol/Attic/rndcontrol.c,v retrieving revision 1.11.2.1 diff -u -r1.11.2.1 rndcontrol.c --- usr.sbin/rndcontrol/rndcontrol.c 10 May 2000 02:04:44 -0000 1.11.2.1 +++ usr.sbin/rndcontrol/rndcontrol.c 23 Feb 2004 01:03:45 -0000 @@ -95,7 +95,7 @@ return (1); } printf("%s: interrupts in use:", argv[0]); - for (i = 0; i < 16; i++) + for (i = 0; i < 24; i++) if (irq & (1 << i)) printf(" %d", i); printf("\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040223011455.GN62095>