summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2000-07-11 06:47:38 +0000
committergreen <green@FreeBSD.org>2000-07-11 06:47:38 +0000
commit7402d1359e445859c09a9564907c835fdf346018 (patch)
tree243acdf7be17761acea78ab56f54a4ebf7e03850 /sys
parentbd64605db3215c4a53095aa5e1de7ae6ade5c18b (diff)
downloadFreeBSD-src-7402d1359e445859c09a9564907c835fdf346018.zip
FreeBSD-src-7402d1359e445859c09a9564907c835fdf346018.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/random/yarrow.c8
-rw-r--r--sys/dev/randomdev/yarrow.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c
index 2ad981b..75bcf6c 100644
--- a/sys/dev/random/yarrow.c
+++ b/sys/dev/random/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;
diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c
index 2ad981b..75bcf6c 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;
OpenPOWER on IntegriCloud