Re: no unlock in bio/b_sock.c
Goetz Babin-Ebell <[EMAIL PROTECTED]>: >>I think in b_sock.c I've stumbled into some error cases in which some locking >>isn't undone: > - if (ret == NULL) return(NULL); > + if (ret == NULL) > + goto err; > - if (ret == NULL) return(NULL); > - if (j > 128) return(ret); /* too big to cache */ > + if (ret == NULL || j > 128) /* not found or too big to > cache */ > + { > + CRYPTO_w_unlock(CRYPTO_LOCK_BIO_GETHOSTBYNAME); > + return(ret); > + } Your diff is relative to b_sock.c version 1.12 or older (in the OpenSSL CVS repository), which corresponds to OpenSSL 0.9.2b. OpenSSL 0.9.3 has more sophisticated bugs :-) (their presence is indicated by a comment, although that comment does not note that the function interface makes it impossible to make BIO_gethostbyname threadsafe). __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: no unlock in bio/b_sock.c
On Mon, Jun 07, 1999 at 05:52:24PM +0200, Goetz Babin-Ebell wrote: > I think in b_sock.c I've stumbled into some error cases in which some locking > isn't undone: It's wrong anyway, I haven't come around to change it ... That caching gethostbyname function is only suitable for single-threaded use -- it's an API problem, not an implementation problem; for multi-threaded use we need something with a gethostbyname_r-like interface (BIO_gethostbyname_r). All locking will be done there: lock, call BIO_gethostbyname, copy result, unlock. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: no unlock in bio/b_sock.c
At 17:52 07.06.99 +0200, you wrote: >Hallo, > >I think in b_sock.c I've stumbled into some error cases in which some locking >isn't undone: sorry, wrong diff... *** OpenSSL/crypto/bio/b_sock.c Mon Apr 26 19:00:12 1999 --- OpenSSL/crypto/bio/b_sock.fixed.c Mon Jun 7 17:46:45 1999 *** *** 247,253 MemCheck_off(); ret=(struct hostent *)Malloc(sizeof(struct hostent)); ! if (ret == NULL) return(NULL); memset(ret,0,sizeof(struct hostent)); for (i=0; a->h_aliases[i] != NULL; i++) --- 247,254 MemCheck_off(); ret=(struct hostent *)Malloc(sizeof(struct hostent)); ! if (ret == NULL) ! goto err; memset(ret,0,sizeof(struct hostent)); for (i=0; a->h_aliases[i] != NULL; i++) *** *** 349,356 BIO_ghbn_miss++; ret=gethostbyname(name); ! if (ret == NULL) return(NULL); ! if (j > 128) return(ret); /* too big to cache */ /* else add to cache */ if (ghbn_cache[lowi].ent != NULL) --- 350,360 BIO_ghbn_miss++; ret=gethostbyname(name); ! if (ret == NULL || j > 128) /* not found or too big to cache */ ! { ! CRYPTO_w_unlock(CRYPTO_LOCK_BIO_GETHOSTBYNAME); ! return(ret); ! } /* else add to cache */ if (ghbn_cache[lowi].ent != NULL) By Goetz -- Goetz Babin-Ebell mailto:[EMAIL PROTECTED] TC Trust Center for Security http://www.trustcenter.de in Data Networks GmbH Tel.: +49-40-766 29 3301 Am Werder 1 / 21073 Hamburg / Germany Fax.: +49-40-766 29 577 __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
no unlock in bio/b_sock.c
Hallo, I think in b_sock.c I've stumbled into some error cases in which some locking isn't undone: > diff b_sock.c b_sock.fixed.c 250c250,251 < if (ret == NULL) return(NULL); --- > if (ret == NULL) > goto err; 352,353c353,357 < if (ret == NULL) return(NULL); < if (j > 128) return(ret); /* too big to cache */ --- > if (ret == NULL || j > 128) /* not found or too big to cache */ > { > CRYPTO_w_unlock(CRYPTO_LOCK_BIO_GETHOSTBYNAME); > return(ret); > } By Goetz -- Goetz Babin-Ebell mailto:[EMAIL PROTECTED] TC Trust Center for Security http://www.trustcenter.de in Data Networks GmbH Tel.: +49-40-766 29 3301 Am Werder 1 / 21073 Hamburg / Germany Fax.: +49-40-766 29 577 __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]