View Issue Details

IDProjectCategoryView StatusLast Update
0001668libmicrohttpdotherpublic2011-05-20 22:19
Reportermrothe Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.9.8 
Summary0001668: Illegal instruction while running tls_session_time_out_test
DescriptionI am running the test suite and run into the following problem:

(gdb) run
Starting program: /home/markus/temp/libmicrohttpd/src/testcurl/https/.libs/tls_session_time_out_test
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff5a1b710 (LWP 19505)]
[New Thread 0x7ffff521a710 (LWP 19506)]

Program received signal SIGILL, Illegal instruction.
0x00007fffffffdfaa in ?? ()
(gdb) bt
#0 0x00007fffffffdfaa in ?? ()
#1 0x00007ffff6885f57 in _gnutls_proc_cert_server_certificate (session=0x622ab0, data=0x61e770 "", data_size=772) at auth_cert.c:1302
#2 0x00007ffff68720c5 in _gnutls_recv_server_certificate (session=0x622ab0) at gnutls_kx.c:729
#3 0x00007ffff686c0b3 in _gnutls_handshake_client (session=0x622ab0) at gnutls_handshake.c:2802
#4 0x00007ffff686bd85 in gnutls_handshake (session=0x622ab0) at gnutls_handshake.c:2702
#5 0x0000000000401663 in test_tls_session_time_out (argc=<value optimized out>, argv=0x7fffffffdfa8) at tls_session_time_out_test.c:68
#6 main (argc=<value optimized out>, argv=0x7fffffffdfa8) at tls_session_time_out_test.c:115
(gdb)


I am *not* sure, if this is a problem with microhttpd (0.9.8), gnutls (2.10.5) or gcc (4.5.2) and need some suggestion how to track this problem down.
TagsNo tags attached.

Activities

Christian Grothoff

2011-03-23 10:52

manager   ~0004293

I'd first try valgrind...

Christian Grothoff

2011-05-07 11:43

manager   ~0004321

Finally been able to reproduce this on my notebook (gnutls 2.10 as well as gnutls 2.12).

Christian Grothoff

2011-05-07 12:10

manager   ~0004322

Ok, so valgrind looks useless.

Christian Grothoff

2011-05-07 12:41

manager   ~0004323

In _gnutls_proc_cert_server_certificate the call to _gnutls_get_cred
returns a cred value of:

(gdb) print *cred
$1 = {dh_params = 0x805bb00, rsa_params = 0x8058408, params_func = 0x446, cert_list = 0x80590d8, cert_list_length = 0x68f,
  ncerts = 134590400, pkey = 0x8057858, keyring = 0x0, x509_ca_list = 0x804a140, x509_ncas = 0, x509_crl_list = 0xbffff9c8,
  x509_ncrls = 3083513430, verify_flags = 1, verify_depth = 3221223924, verify_bits = 3221223932, x509_rdn_sequence = {
    data = 0xb7f67820 "", size = 3086971953}, client_get_cert_callback = 0xffffffff, server_get_cert_callback = 0xb7ffeff4,
  verify_callback = 0x80489a9, get_cert_callback = 0x1}

That's not so good...

Christian Grothoff

2011-05-07 12:43

manager   ~0004324

inside of _gnnutls_get_cred, we have:

(gdb) print *ccred
$3 = {algorithm = GNUTLS_CRD_CERTIFICATE, credentials = 0xbffff920, next = 0x0}

and, what may be OK:

(gdb) print *key
$4 = {key = {data = 0x0, size = 0}, KEY = 0x0, client_Y = 0x0, client_g = 0x0, client_p = 0x0, dh_secret = 0x0, A = 0x0,
  B = 0x0, u = 0x0, b = 0x0, a = 0x0, x = 0x0, rsa = {0x0, 0x0}, auth_info = 0x0, auth_info_type = 0, auth_info_size = 0,
  crypt_algo = 0 '\000', cred = 0x8055a58, certificate_requested = 0}
(

Christian Grothoff

2011-05-07 12:46

manager   ~0004325

Crash line numbers for gnutls 2.12.4:

(gdb) ba
#0 0x080489ab in ?? ()
#1 0xb7e9f01c in _gnutls_recv_server_certificate (session=0x805afc0) at gnutls_kx.c:698
#2 0xb7e98fb9 in _gnutls_handshake_client (session=0x805afc0) at gnutls_handshake.c:2774
#3 0xb7e98c81 in gnutls_handshake (session=0x805afc0) at gnutls_handshake.c:2672
#4 0x0804920b in test_tls_session_time_out (session=0x805afc0) at tls_session_time_out_test.c:68
#5 0x080493ea in main (argc=1, argv=0xbffff9f4) at tls_session_time_out_test.c:121

Christian Grothoff

2011-05-20 21:46

manager   ~0004330

Meanwhile in "auth_cert.c", line 1388, I get:

(gdb) print *cred
$3 = {dh_params = 0x805bb00, rsa_params = 0x8058408, params_func = 0x446, cert_list = 0x80590d8, cert_list_length = 0x68f,
  ncerts = 134590400, pkey = 0x8057858, keyring = 0x0, x509_ca_list = 0x804a110, x509_ncas = 0, x509_crl_list = 0xbffff9d8,
  x509_ncrls = 3083509318, verify_flags = 1, verify_depth = 3221223940, verify_bits = 3221223948, x509_rdn_sequence = {
    data = 0xb7f66820 "", size = 3086971953}, client_get_cert_callback = 0xffffffff, server_get_cert_callback = 0xb7ffeff4,
  verify_callback = 0x80489a9, get_cert_callback = 0x1}

Given that 1388 does:

ret = cred->verify_callback (session);

this state of 'cred' seems rather harmfull...

Christian Grothoff

2011-05-20 22:03

manager   ~0004331

Looks like the address in question (session->key->cred.credentials) is on the stack. This looks bad...

Christian Grothoff

2011-05-20 22:14

manager   ~0004332

Fixed in SVN 15276. Stupid issue with gnutls API taking a 'void*' and the test case driver code setting up the session giving it essentially a pointer to the pointer instead of just a pointer. Only impacted the testcase, not the MHD library.

Issue History

Date Modified Username Field Change
2011-03-21 20:43 mrothe New Issue
2011-03-23 10:52 Christian Grothoff Note Added: 0004293
2011-05-07 11:42 Christian Grothoff Status new => assigned
2011-05-07 11:42 Christian Grothoff Assigned To => Christian Grothoff
2011-05-07 11:43 Christian Grothoff Note Added: 0004321
2011-05-07 12:10 Christian Grothoff Note Added: 0004322
2011-05-07 12:41 Christian Grothoff Note Added: 0004323
2011-05-07 12:43 Christian Grothoff Note Added: 0004324
2011-05-07 12:46 Christian Grothoff Note Added: 0004325
2011-05-20 21:46 Christian Grothoff Note Added: 0004330
2011-05-20 22:03 Christian Grothoff Note Added: 0004331
2011-05-20 22:14 Christian Grothoff Note Added: 0004332
2011-05-20 22:14 Christian Grothoff Status assigned => resolved
2011-05-20 22:14 Christian Grothoff Resolution open => fixed
2011-05-20 22:19 Christian Grothoff Status resolved => closed