Re: [Gc] Reproducible bug report for thread registration

Ivan Maidanski ivmai at mail.ru
Wed Oct 31 07:47:30 PST 2012


Hi Juan,

I haven't tied it yet but could you please explain your code snippet:

import_current_thread()
{
  GC_word *key_buffer = 0;
  switch (GC_register_my_thread((void*)&name)) {
...
  case GC_DUPLICATE:
    /* Thread was probably created using the GC hooks
     * for thread creation */
    pthread_setspecific(key, (void*)0);
    break;
  }
  if (key) {
...
    key_buffer[0] = (GC_word)buffer;
  }
}

main() {
...
  pthread_key_create(&key, NULL);
...
}

To my understanding, it should crash in case pthread_create has been intercepted (because key_buffer is NULL).

Also "if (key)" is a non-portable operation because pthread_key_t is opaque.

Regards,
Ivan

Tue, 30 Oct 2012 22:12:02 +0100 Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com>:
>	
>
>
	
	
>
		
		
			
>
>This reproduces what I mentioned before about thread registration.
>
>
>Just use "make" and see the program fail.
>
>
>The code breaks in the garbage collector library with a bus or segmentation fault. The example attached does not use ECL in any way and I tested it with a recent version of the collector.
>
>
>Note that with a smaller number of threads it sometimes runs fine.
>
>
>Juanjo
>
>-- 
>Instituto de Física Fundamental, CSIC
>c/ Serrano, 113b, Madrid 28006 (Spain) 
>http://juanjose.garciaripoll.googlepages.com
>
			
>_______________________________________________
>
Gc mailing list
>Gc at linux.hpl.hp.com
>http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>
		
		
	

	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20121031/23fffda6/attachment-0001.htm


More information about the Gc mailing list