Sources of entropy - /dev/random problem for network servers

From: Alex Bligh - linux-kernel (linux-kernel@alex.org.uk)
Date: Sun Apr 08 2001 - 17:46:21 EST


In debugging why my (unloaded) IMAP server takes many seconds
to open folders, I discovered what looks like a problem
in 2.4's feeding of entropy into /dev/random. When there
is insufficient entropy in the random number generator,
reading from /dev/random blocks for several seconds. /dev/random
is used (correctly) for crytographic key verification.

Entropy comes from 4 sources it seems: Keyboard, Mouse, Disk I/O
and IRQs.

The machine in question is locked in a data center (can't be
the only one) and thus sees none of the former two. IDE Entropy
comes from executed IDE commands. The disk is physically largely
inactive due to caching. But there's plenty of network traffic
which should generate IRQs.

However, only 3 drivers in drivers/net actually set
SA_SAMPLE_RANDOM when calling request_irq(). I believe
all of them should. And indeed this fixed the problem for
me using an eepro100().

The following patch fixes eepro100.c - others can be
patched similarly.

--
Alex Bligh

/usr/src/linux# diff -C3 drivers/net/eepro100.c{.keep,} *** drivers/net/eepro100.c.keep Tue Feb 13 21:15:05 2001 --- drivers/net/eepro100.c Sun Apr 8 22:17:00 2001 *************** *** 923,929 **** sp->in_interrupt = 0;

/* .. we can safely take handler calls during init. */ ! retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ, dev->name, dev); if (retval) { MOD_DEC_USE_COUNT; return retval; --- 923,929 ---- sp->in_interrupt = 0;

/* .. we can safely take handler calls during init. */ ! retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); if (retval) { MOD_DEC_USE_COUNT; return retval;

[ENDS] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 15 2001 - 21:00:10 EST