[openssl-users] Handle Leaks - shmem-win32.c shmem.c - OpenSSL 1.0.1l
Avery A. Tarasov
Avery.A.Tarasov at SecurityEngineer.Pro
Sat Jan 24 21:34:14 UTC 2015
Hi Michel,
It doesn't appear to be related to that. I added CloseHandle's and got
the same result.
Here are my updated findings... The following simple program still
causes the same Handle Leaks...
Important findings:
*1) * If SSL_library_init() and SSL_load_error_strings() are
*removed* (which are the only 2 OpenSSL functions I'm using).... the
handle leaks go away..
*2)* If SSL_library_init() and SSL_load_error_strings() are *kept*
but the creation of the thread is *removed* -- no more handle leaks..
So the problem is something related to the combination of loading
OpenSSL and creating a thread (even though that thread does nothing
whatsoever related to OpenSSL). Very odd.
DWORD __stdcall thread1(LPVOID l)
{
while(1)
{ Sleep(1000); }
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow) {
* SSL_library_init();** // if these 2 lines removed
** SSL_load_error_strings(); **// no more handle leaks*
DWORD t1;
HANDLE h1=CreateThread(0,0,thread1,0,0,&t1); if(h1==0) { return
0; } CloseHandle(h1); *//if **SSL_library_init();***and
*SSL_load_error_strings(); *are *kept *but this line is *removed... no
more handle leaks*
while(1)
{
Sleep(1000);
}
}
Address / Handle: 0x0000C001
shmem-win32.c
sslleak.exe
Atom
0 bytes
Thread ID: 6736
1/22 18:48:09 990ms (Lifetime:00:01:45:503ms)
Sequence: 11
sslleak.exe ___shmem_grab : [shmem-win32.c Line 0]
sslleak.exe _fc_key_init_once : [unwind-sjlj.c Line 0]
sslleak.exe _main : [crt0_c.c Line 0]
sslleak.exe ___tmainCRTStartup : [crtexe.c Line 0]
kernel32.dll BaseThreadInitThunk : [{FUNC}BaseThreadInitThunk Line 0]
ntdll.dll RtlInitializeExceptionChain :
[{FUNC}RtlInitializeExceptionChain Line 0]
Address / Handle: 0x0000C00F
shmem-win32.c
sslleak.exe
Atom
0 bytes
Thread ID: 6736
1/22 18:48:09 990ms (Lifetime:00:02:29:683ms)
Sequence: 97
sslleak.exe ___shmem_grab : [shmem-win32.c Line 0]
sslleak.exe ___shmem_grab : [shmem-win32.c Line 0]
Address / Handle: 0x0000C016
shmem.c
sslleak.exe
Atom
0 bytes
Thread ID: 6736
1/22 18:48:09 990ms (Lifetime:00:03:02:693ms)
Sequence: 143
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
Address / Handle: 0x0000C009
shmem.c
sslleak.exe
Atom
0 bytes
Thread ID: 6736
1/22 18:48:09 990ms (Lifetime:00:03:22:364ms)
Sequence: 61
sslleak.exe ___shmem_winpthreads_grab : [shmem.c Line 0]
sslleak.exe _mutex_static_init : [mutex.c Line 0]
sslleak.exe _pop_pthread_mem : [thread.c Line 0]
sslleak.exe _pop_pthread_mem : [thread.c Line 0]
On 1/24/2015 5:34 AM, Michel SALES wrote:
>
> Hi,
>
> Just a quick answer : I didn't find any call to CloseHandle() function
> in your code.
>
> Best regards,
>
> Michel.
>
>
>
> _______________________________________________
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150124/fbd267cb/attachment.html>
More information about the openssl-users
mailing list