From 87a478de7b8d22148b160f0ac17ae48942d6d890 Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Tue, 11 Jul 2000 06:47:38 +0000 Subject: One should never allocate 4-kilobyte structs and such on the interrupt stack. It's bad for your machine's health. Make the two huge structs in reseed() static to prevent crashes. This is the bug that people have been running into and panic()ing on for the past few days. Reviewed by: phk --- sys/dev/randomdev/yarrow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/dev/randomdev') diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c index 2ad981bbd7d6..75bcf6c44159 100644 --- a/sys/dev/randomdev/yarrow.c +++ b/sys/dev/randomdev/yarrow.c @@ -101,9 +101,13 @@ random_deinit(void) static void reseed(int fastslow) { - unsigned char v[TIMEBIN][KEYSIZE]; /* v[i] */ + /* + * Allocate the huge variables statically. They _will_ run you + * out of interrupt-context stack otherwise! + */ + static BF_KEY hashkey; + static unsigned char v[TIMEBIN][KEYSIZE]; /* v[i] */ unsigned char hash[KEYSIZE]; /* h' */ - BF_KEY hashkey; unsigned char ivec[8]; unsigned char temp[KEYSIZE]; struct entropy *bucket; -- cgit v1.3