On Sun, Mar 20, 2005, Chris Brown wrote: > I didn't get any replies to this when I sent it last week. Am I on the > wrong list for this sort of query? >
No, just haven't had time to look at it yet. > > > I've manage to diagnose this down further to a snippet of code inside > ERR_STATE *ERR_get_state(void) > on roughly line 1022 of crypot/err/err.c of the 0.9.7-f-snapshot > (from the 11th): > > if (ERRFN(thread_get_item)(ret) != ret) > { > cmb_ssl_dbg( "crypto thread_get_item failed" ); > ERR_STATE_free(ret); /* could not insert it */ > return(&fallback); > } > > The double free occurs within ERR_STATE_free here, and I'm not clear > as to why this is. I predict that it's because of a threading issue. As > far as I know our mutexes for the crypto library do work, however the > implication here is that they don't or that they aren't being used > properly. Is this a race condition? I don't follow the code around > int_thread_get_item well enough to know for sure. Are any experts > available to review this? > > It does appear to me that if two threads are simultaneously popping > errors from the stack that this condition could occur because there > appears to be no lock between: > > tmpp = ERRFN(thread_set_item)(ret); > /* To check if insertion failed, do a get. */ > if (ERRFN(thread_get_item)(ret) != ret) > > and that the diagnostics being done might actually be incorrect. At > least according to what the comment between those lines says. > At first sight that comes under the heading of "this can't happen"... The structure is allocated by one thread and shouldn't be freed up by any other. Well at least not if everything is setup properly. Two other problems could cause that. One is that the thread locking isn't working properly, the other is if the thread ID function setup by CRYPTO_set_id_callback() is invalid. If you set up some logging in the functions you've used for those it might help further. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]