[PATCH] session ticket support

Simon Josefsson simon at josefsson.org
Mon Aug 24 23:46:41 CEST 2009


The self-test "resume" crashes, presumably because of the session ticket
support or your memory leak fixes.  Valgrind complains so it should be
easy to debug.  Could you please take a look?

/Simon

jas at mocca:~/src/gnutls/tests master$ valgrind ./resume
==4609== Memcheck, a memory error detector.
==4609== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==4609== Using LibVEX rev 1884, a library for dynamic binary translation.
==4609== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==4609== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework.
==4609== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==4609== For more details, rerun with: -v
==4609== 
try to resume from db
server: ready. Listening to port '5556'.
Launched, generating DH parameters...
server: connection from 127.0.0.1, port 58638
resume db storing... (32-451)
server: Handshake was completed
client: Handshake was completed
server: Peer has closed the GNUTLS connection
server: connection from 127.0.0.1, port 58639
resume db fetch... (32)
resume db fetch... return info
client: Handshake was completed
- Previous session was resumed
resume db storing... (32-451)
server: Handshake was completed
server: Peer has closed the GNUTLS connection
server: finished
global stop
==4612== Invalid free() / delete / delete[]
==4612==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4612==    by 0x428F9CB: (within /lib/i686/cmov/libc-2.9.so)
==4612==    by 0x428F4A9: (within /lib/i686/cmov/libc-2.9.so)
==4612==    by 0x4020402: _vgnU_freeres (vg_preloaded.c:60)
==4612==    by 0x42059F3: _Exit (in /lib/i686/cmov/libc-2.9.so)
==4612==    by 0x804A4BA: doit (resume.c:463)
==4612==    by 0x804A59C: main (utils.c:148)
==4612==  Address 0x41662c8 is not stack'd, malloc'd or (recently) free'd
==4612== 
==4612== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 21 from 1)
==4612== malloc/free: in use at exit: 2,336 bytes in 38 blocks.
==4612== malloc/free: 2,553 allocs, 2,516 frees, 405,822 bytes allocated.
==4612== For counts of detected errors, rerun with: -v
==4612== searching for pointers to 38 not-freed blocks.
==4612== checked 100,004 bytes.
==4612== 
==4612== LEAK SUMMARY:
==4612==    definitely lost: 0 bytes in 0 blocks.
==4612==      possibly lost: 0 bytes in 0 blocks.
==4612==    still reachable: 0 bytes in 0 blocks.
==4612==         suppressed: 2,336 bytes in 38 blocks.
global stop
try to resume from session ticket
server: ready. Listening to port '5556'.
Launched, generating DH parameters...
server: connection from 127.0.0.1, port 58640
server: Handshake was completed
client: Handshake was completed
server: Peer has closed the GNUTLS connection
server: connection from 127.0.0.1, port 58641
client: Handshake was completed
- Previous session was resumed
server: Handshake was completed
server: Peer has closed the GNUTLS connection
server: finished
global stop
==4622== Invalid free() / delete / delete[]
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4622==    by 0x8049A5E: global_stop (resume.c:323)
==4622==    by 0x804A4AE: doit (resume.c:462)
==4622==    by 0x804A59C: main (utils.c:148)
==4622==  Address 0x43164e0 is 0 bytes inside a block of size 8 free'd
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4622==    by 0x8049A5E: global_stop (resume.c:323)
==4622==    by 0x804A313: doit (resume.c:457)
==4622==    by 0x804A59C: main (utils.c:148)
==4622== 
==4622== Invalid read of size 4
==4622==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4622==    by 0x405A7E5: gnutls_dh_params_deinit (gnutls_dh_primes.c:136)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A4AE: doit (resume.c:462)
==4622==    by 0x804A59C: main (utils.c:148)
==4622==  Address 0x4316518 is 0 bytes inside a block of size 8 free'd
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A313: doit (resume.c:457)
==4622==    by 0x804A59C: main (utils.c:148)
==4622== 
==4622== Invalid read of size 4
==4622==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4622==    by 0x405A7F0: gnutls_dh_params_deinit (gnutls_dh_primes.c:137)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A4AE: doit (resume.c:462)
==4622==    by 0x804A59C: main (utils.c:148)
==4622==  Address 0x431651c is 4 bytes inside a block of size 8 free'd
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A313: doit (resume.c:457)
==4622==    by 0x804A59C: main (utils.c:148)
==4622== 
==4622== Invalid free() / delete / delete[]
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A4AE: doit (resume.c:462)
==4622==    by 0x804A59C: main (utils.c:148)
==4622==  Address 0x4316518 is 0 bytes inside a block of size 8 free'd
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4622==    by 0x8049A6B: global_stop (resume.c:325)
==4622==    by 0x804A313: doit (resume.c:457)
==4622==    by 0x804A59C: main (utils.c:148)
==4622== 
==4622== Invalid free() / delete / delete[]
==4622==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4622==    by 0x428F9CB: (within /lib/i686/cmov/libc-2.9.so)
==4622==    by 0x428F4A9: (within /lib/i686/cmov/libc-2.9.so)
==4622==    by 0x4020402: _vgnU_freeres (vg_preloaded.c:60)
==4622==    by 0x42059F3: _Exit (in /lib/i686/cmov/libc-2.9.so)
==4622==    by 0x804A4BA: doit (resume.c:463)
==4622==    by 0x804A59C: main (utils.c:148)
==4622==  Address 0x41662c8 is not stack'd, malloc'd or (recently) free'd
==4622== 
==4622== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 21 from 1)
==4622== malloc/free: in use at exit: 2,336 bytes in 38 blocks.
==4622== malloc/free: 5,078 allocs, 5,043 frees, 847,546 bytes allocated.
==4622== For counts of detected errors, rerun with: -v
==4622== searching for pointers to 38 not-freed blocks.
==4622== checked 100,032 bytes.
==4622== 
==4622== LEAK SUMMARY:
==4622==    definitely lost: 0 bytes in 0 blocks.
==4622==      possibly lost: 0 bytes in 0 blocks.
==4622==    still reachable: 0 bytes in 0 blocks.
==4622==         suppressed: 2,336 bytes in 38 blocks.
global stop
try to resume from session ticket (server only)
server: ready. Listening to port '5556'.
Launched, generating DH parameters...
server: connection from 127.0.0.1, port 58642
server: Handshake was completed
client: Handshake was completed
server: Peer has closed the GNUTLS connection
server: connection from 127.0.0.1, port 58643
server: Handshake was completed
client: Handshake was completed
*** Previous session was NOT resumed
server: Peer has closed the GNUTLS connection
server: finished
global stop
==4625== Invalid free() / delete / delete[]
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4625==    by 0x8049A5E: global_stop (resume.c:323)
==4625==    by 0x804A4AE: doit (resume.c:462)
==4625==    by 0x804A59C: main (utils.c:148)
==4625==  Address 0x439f610 is 0 bytes inside a block of size 8 free'd
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4625==    by 0x8049A5E: global_stop (resume.c:323)
==4625==    by 0x804A313: doit (resume.c:457)
==4625==    by 0x804A59C: main (utils.c:148)
==4625== 
==4625== Invalid read of size 4
==4625==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4625==    by 0x405A7E5: gnutls_dh_params_deinit (gnutls_dh_primes.c:136)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A4AE: doit (resume.c:462)
==4625==    by 0x804A59C: main (utils.c:148)
==4625==  Address 0x439f648 is 0 bytes inside a block of size 8 free'd
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A313: doit (resume.c:457)
==4625==    by 0x804A59C: main (utils.c:148)
==4625== 
==4625== Invalid read of size 4
==4625==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4625==    by 0x405A7F0: gnutls_dh_params_deinit (gnutls_dh_primes.c:137)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A4AE: doit (resume.c:462)
==4625==    by 0x804A59C: main (utils.c:148)
==4625==  Address 0x439f64c is 4 bytes inside a block of size 8 free'd
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A313: doit (resume.c:457)
==4625==    by 0x804A59C: main (utils.c:148)
==4625== 
==4625== Invalid free() / delete / delete[]
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A4AE: doit (resume.c:462)
==4625==    by 0x804A59C: main (utils.c:148)
==4625==  Address 0x439f648 is 0 bytes inside a block of size 8 free'd
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4625==    by 0x8049A6B: global_stop (resume.c:325)
==4625==    by 0x804A313: doit (resume.c:457)
==4625==    by 0x804A59C: main (utils.c:148)
==4625== 
==4625== Invalid free() / delete / delete[]
==4625==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4625==    by 0x428F9CB: (within /lib/i686/cmov/libc-2.9.so)
==4625==    by 0x428F4A9: (within /lib/i686/cmov/libc-2.9.so)
==4625==    by 0x4020402: _vgnU_freeres (vg_preloaded.c:60)
==4625==    by 0x42059F3: _Exit (in /lib/i686/cmov/libc-2.9.so)
==4625==    by 0x804A4BA: doit (resume.c:463)
==4625==    by 0x804A59C: main (utils.c:148)
==4625==  Address 0x41662c8 is not stack'd, malloc'd or (recently) free'd
==4625== 
==4625== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 21 from 1)
==4625== malloc/free: in use at exit: 2,336 bytes in 38 blocks.
==4625== malloc/free: 7,713 allocs, 7,678 frees, 1,301,048 bytes allocated.
==4625== For counts of detected errors, rerun with: -v
==4625== searching for pointers to 38 not-freed blocks.
==4625== checked 100,032 bytes.
==4625== 
==4625== LEAK SUMMARY:
==4625==    definitely lost: 0 bytes in 0 blocks.
==4625==      possibly lost: 0 bytes in 0 blocks.
==4625==    still reachable: 0 bytes in 0 blocks.
==4625==         suppressed: 2,336 bytes in 38 blocks.
global stop
try to resume from session ticket (client only)
server: ready. Listening to port '5556'.
Launched, generating DH parameters...
server: connection from 127.0.0.1, port 58644
server: Handshake was completed
client: Handshake was completed
server: Peer has closed the GNUTLS connection
server: connection from 127.0.0.1, port 58645
server: Handshake was completed
client: Handshake was completed
*** Previous session was NOT resumed
server: Peer has closed the GNUTLS connection
==4609== Invalid free() / delete / delete[]
==4609==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4609==    by 0x804A2F7: doit (resume.c:424)
==4609==    by 0x804A59C: main (utils.c:148)
==4609==  Address 0x4426510 is 0 bytes inside a block of size 64 free'd
==4609==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4609==    by 0x804A2F7: doit (resume.c:424)
==4609==    by 0x804A59C: main (utils.c:148)
server: finished
global stop
==4636== Invalid free() / delete / delete[]
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4636==    by 0x8049A5E: global_stop (resume.c:323)
==4636==    by 0x804A4AE: doit (resume.c:462)
==4636==    by 0x804A59C: main (utils.c:148)
==4636==  Address 0x4425d60 is 0 bytes inside a block of size 8 free'd
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x4054DAF: gnutls_anon_free_server_credentials (gnutls_anon_cred.c:47)
==4636==    by 0x8049A5E: global_stop (resume.c:323)
==4636==    by 0x804A313: doit (resume.c:457)
==4636==    by 0x804A59C: main (utils.c:148)
==4636== 
==4636== Invalid read of size 4
==4636==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4636==    by 0x405A7E5: gnutls_dh_params_deinit (gnutls_dh_primes.c:136)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A4AE: doit (resume.c:462)
==4636==    by 0x804A59C: main (utils.c:148)
==4636==  Address 0x4425d98 is 0 bytes inside a block of size 8 free'd
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A313: doit (resume.c:457)
==4636==    by 0x804A59C: main (utils.c:148)
==4636== 
==4636== Invalid read of size 4
==4636==    at 0x404FD3A: _gnutls_mpi_release (gnutls_mpi.c:120)
==4636==    by 0x405A7F0: gnutls_dh_params_deinit (gnutls_dh_primes.c:137)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A4AE: doit (resume.c:462)
==4636==    by 0x804A59C: main (utils.c:148)
==4636==  Address 0x4425d9c is 4 bytes inside a block of size 8 free'd
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A313: doit (resume.c:457)
==4636==    by 0x804A59C: main (utils.c:148)
==4636== 
==4636== Invalid free() / delete / delete[]
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A4AE: doit (resume.c:462)
==4636==    by 0x804A59C: main (utils.c:148)
==4636==  Address 0x4425d98 is 0 bytes inside a block of size 8 free'd
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x405A7FB: gnutls_dh_params_deinit (gnutls_dh_primes.c:139)
==4636==    by 0x8049A6B: global_stop (resume.c:325)
==4636==    by 0x804A313: doit (resume.c:457)
==4636==    by 0x804A59C: main (utils.c:148)
==4636== 
==4636== Invalid free() / delete / delete[]
==4636==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4636==    by 0x428F9CB: (within /lib/i686/cmov/libc-2.9.so)
==4636==    by 0x428F4A9: (within /lib/i686/cmov/libc-2.9.so)
==4636==    by 0x4020402: _vgnU_freeres (vg_preloaded.c:60)
==4636==    by 0x42059F3: _Exit (in /lib/i686/cmov/libc-2.9.so)
==4636==    by 0x804A4BA: doit (resume.c:463)
==4636==    by 0x804A59C: main (utils.c:148)
==4636==  Address 0x41662c8 is not stack'd, malloc'd or (recently) free'd
==4636== 
==4636== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 21 from 1)
==4636== malloc/free: in use at exit: 2,336 bytes in 38 blocks.
==4636== malloc/free: 10,330 allocs, 10,295 frees, 1,747,306 bytes allocated.
==4636== For counts of detected errors, rerun with: -v
==4636== searching for pointers to 38 not-freed blocks.
==4636== checked 100,032 bytes.
==4636== 
==4636== LEAK SUMMARY:
==4636==    definitely lost: 0 bytes in 0 blocks.
==4636==      possibly lost: 0 bytes in 0 blocks.
==4636==    still reachable: 0 bytes in 0 blocks.
==4636==         suppressed: 2,336 bytes in 38 blocks.
global stop
Self test `./resume' finished with 0 errors
==4609== 
==4609== Invalid free() / delete / delete[]
==4609==    at 0x4024E3A: free (vg_replace_malloc.c:323)
==4609==    by 0x428F9CB: (within /lib/i686/cmov/libc-2.9.so)
==4609==    by 0x428F4A9: (within /lib/i686/cmov/libc-2.9.so)
==4609==    by 0x4020402: _vgnU_freeres (vg_preloaded.c:60)
==4609==    by 0x42059F3: _Exit (in /lib/i686/cmov/libc-2.9.so)
==4609==    by 0x417D7AC: (below main) (in /lib/i686/cmov/libc-2.9.so)
==4609==  Address 0x41662c8 is not stack'd, malloc'd or (recently) free'd
==4609== 
==4609== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 21 from 1)
==4609== malloc/free: in use at exit: 2,336 bytes in 38 blocks.
==4609== malloc/free: 10,334 allocs, 10,298 frees, 1,753,420 bytes allocated.
==4609== For counts of detected errors, rerun with: -v
==4609== searching for pointers to 38 not-freed blocks.
==4609== checked 99,916 bytes.
==4609== 
==4609== LEAK SUMMARY:
==4609==    definitely lost: 0 bytes in 0 blocks.
==4609==      possibly lost: 0 bytes in 0 blocks.
==4609==    still reachable: 0 bytes in 0 blocks.
==4609==         suppressed: 2,336 bytes in 38 blocks.
jas at mocca:~/src/gnutls/tests master$ 





More information about the Gnutls-devel mailing list