On Wed, Apr 18, 2001 at 09:20:31AM -0400, Jeffrey Altman wrote:
>> 2. The following piece of code seems to have race condition, causing
>> very long initialization time for our application, especially when there are
>> very many processes and threads running in the system (file:
>> crypto/rand/md_rand.c, line: 350):
>>
>> if (!initialized)
>> RAND_poll();
>>
>> CRYPTO_w_lock(CRYPTO_LOCK_RAND);
>> add_do_not_lock = 1; /* Since we call ssleay_rand_add while in
>> this locked state. */
>>
>> initialized = 1;
>>
>> It seems like many threads enter RAND_poll() simultaneously. Here is
>> the fix we've made for this:
>>
>> CRYPTO_w_lock(CRYPTO_LOCK_RAND);
>> if (!initialized)
>> {
>> RAND_poll();
>> initialized = 1;
>> }
>>
>> add_do_not_lock = 1; /* Since we call ssleay_rand_add while in
>> this locked state. */
> This fix seems reasonable.
Except for the deadlock. add_do_not_lock must be set *before* RAND_poll
is called if the lock is held at that time.
--
Bodo Möller <[EMAIL PROTECTED]>
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]