[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#456531: libc6: strerror_r() not thread-safe



Le Sunday 16 December 2007 21:49:10 Pierre Habouzit, vous avez écrit :
>   what is your kernel version ? I would be surprised it matters but …

I started with a self-built vanilla 2.6.23.8, and now using 2.6.22-3-686 from 
Sid running on a "HyperThread" single CPU host. Both of them crash.
I haven't been able to trigger the problem on amd64.

>   have you tried helgrind and other race-condition valgrind tools ?

I didn't know helgrind was fixed nowadays. Tells this (no crash though):

==23149== Helgrind, a thread error detector.
==23149== Copyright (C) 2007-2007, and GNU GPL'd, by OpenWorks LLP et al.
==23149== Using LibVEX rev 1804, a library for dynamic binary translation.
==23149== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==23149== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation 
framework.
==23149== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==23149== For more details, rerun with: -v
==23149==
==23149== Thread #2 was created
==23149==    at 0x4116628: clone (in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x4027625: pthread_create@* (hg_intercepts.c:213)
==23149==    by 0x8048694: main (in /home/remi/a.out)
==23149==
==23149== Thread #3 was created
==23149==    at 0x4116628: clone (in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x4027625: pthread_create@* (hg_intercepts.c:213)
==23149==    by 0x8048694: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0xBEC5D5BC
==23149==    at 0x40333C3: pthread_barrier_wait 
(in /usr/lib/debug/libpthread-2.7.so)
==23149==    by 0x4027710: mythread_wrapper (hg_intercepts.c:193)
==23149==    by 0x402E382: start_thread (pthread_create.c:297)
==23149==    by 0x411663D: clone (in /usr/lib/debug/libc-2.7.so)
==23149==   Old state: shared-readonly by threads #2, #3
==23149==   New state: shared-modified by threads #2, #3
==23149==   Reason:    this thread, #3, holds no consistent locks
==23149==   Location 0xBEC5D5BC has never been protected by any lock
==23149==
==23149== Thread #1 is the program's root thread
==23149==
==23149== Thread #4 was created
==23149==    at 0x4116628: clone (in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x4027625: pthread_create@* (hg_intercepts.c:213)
==23149==    by 0x8048694: main (in /home/remi/a.out)
==23149==
==23149== Thread #5 was created
==23149==    at 0x4116628: clone (in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x4027625: pthread_create@* (hg_intercepts.c:213)
==23149==    by 0x8048694: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0xBEC5D5B4
==23149==    at 0x4033407: pthread_barrier_wait 
(in /usr/lib/debug/libpthread-2.7.so)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #2, #3, #4, #5 and 6 
others
==23149==   New state: shared-modified by threads #1, #2, #3, #4, #5 and 6 
others
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Location 0xBEC5D5B4 has never been protected by any lock
==23149==
==23149== Thread #9 was created
==23149==    at 0x4116628: clone (in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x4027625: pthread_create@* (hg_intercepts.c:213)
==23149==    by 0x8048694: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0x4189C30
==23149==    at 0x41236A5: __lll_unlock_wake_private 
(in /usr/lib/debug/libc-2.7.so)
==23149==    by 0x406668C: _nl_find_domain (finddomain.c:120)
==23149==    by 0x4065FA1: __dcigettext (dcigettext.c:627)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x4027710: mythread_wrapper (hg_intercepts.c:193)
==23149==    by 0x402E382: start_thread (pthread_create.c:297)
==23149==    by 0x411663D: clone (in /usr/lib/debug/libc-2.7.so)
==23149==   Old state: shared-modified by threads #3, #9
==23149==   New state: shared-modified by threads #3, #9
==23149==   Reason:    this thread, #3, holds no consistent locks
==23149==   Last consistently used lock for 0x4189C30 was first observed
==23149==    at 0x40263C4: pthread_rwlock_wrlock (hg_intercepts.c:809)
==23149==    by 0x4064D16: set_binding_values (bindtextdom.c:118)
==23149==    by 0x4064E4F: bindtextdomain (bindtextdom.c:350)
==23149==    by 0x8048653: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0x4190AE8
==23149==    at 0x406582C: _nl_find_msg (dcigettext.c:1041)
==23149==    by 0x4066101: __dcigettext (dcigettext.c:639)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #9
==23149==   New state: shared-modified by threads #1, #9
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Last consistently used lock for 0x4190AE8 was first observed
==23149==    at 0x40263C4: pthread_rwlock_wrlock (hg_intercepts.c:809)
==23149==    by 0x4064D16: set_binding_values (bindtextdom.c:118)
==23149==    by 0x4064E4F: bindtextdomain (bindtextdom.c:350)
==23149==    by 0x8048653: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0x4191924
==23149==    at 0x4057DE4: __gconv (gconv.c:48)
==23149==    by 0x40656E2: _nl_find_msg (dcigettext.c:1089)
==23149==    by 0x4066101: __dcigettext (dcigettext.c:639)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: owned exclusively by thread #9
==23149==   New state: shared-modified by threads #1, #9
==23149==   Reason:    this thread, #1, holds no locks at all
==23149==
==23149== Possible data race during write of size 4 at 0x4191928
==23149==    at 0x4057DE7: __gconv (gconv.c:49)
==23149==    by 0x40656E2: _nl_find_msg (dcigettext.c:1089)
==23149==    by 0x4066101: __dcigettext (dcigettext.c:639)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: owned exclusively by thread #9
==23149==   New state: shared-modified by threads #1, #9
==23149==   Reason:    this thread, #1, holds no locks at all
==23149==
==23149== Possible data race during write of size 4 at 0x419190C
==23149==    at 0x7F67591: gconv (in /usr/lib/gconv/ISO8859-1.so)
==23149==    by 0x4057EA8: __gconv (gconv.c:80)
==23149==    by 0x40656E2: _nl_find_msg (dcigettext.c:1089)
==23149==    by 0x4066101: __dcigettext (dcigettext.c:639)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #9
==23149==   New state: shared-modified by threads #1, #9
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Last consistently used lock for 0x419190C was first observed
==23149==    at 0x40263C4: pthread_rwlock_wrlock (hg_intercepts.c:809)
==23149==    by 0x4064D16: set_binding_values (bindtextdom.c:118)
==23149==    by 0x4064E4F: bindtextdomain (bindtextdom.c:350)
==23149==    by 0x8048653: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0x4191930
==23149==    at 0x405EE2D: __gconv_transform_internal_utf8 (skeleton.c:652)
==23149==    by 0x7F675EF: gconv (in /usr/lib/gconv/ISO8859-1.so)
==23149==    by 0x4057EA8: __gconv (gconv.c:80)
==23149==    by 0x40656E2: _nl_find_msg (dcigettext.c:1089)
==23149==    by 0x4066101: __dcigettext (dcigettext.c:639)
==23149==    by 0x4064EA2: dcgettext (dcgettext.c:53)
==23149==    by 0x40B2338: strerror_r (_strerror.c:65)
==23149==    by 0x407FB43: vfprintf (vfprintf.c:1559)
==23149==    by 0x40A2BC3: vsnprintf (vsnprintf.c:120)
==23149==    by 0x4087274: snprintf (snprintf.c:35)
==23149==    by 0x80485FE: run (in /home/remi/a.out)
==23149==    by 0x80486A9: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #9
==23149==   New state: shared-modified by threads #1, #9
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Last consistently used lock for 0x4191930 was first observed
==23149==    at 0x40263C4: pthread_rwlock_wrlock (hg_intercepts.c:809)
==23149==    by 0x4064D16: set_binding_values (bindtextdom.c:118)
==23149==    by 0x4064E4F: bindtextdomain (bindtextdom.c:350)
==23149==    by 0x8048653: main (in /home/remi/a.out)
==23149==
==23149== Possible data race during write of size 4 at 0x4F41BD8
==23149==    at 0x402F548: pthread_join (pthread_join.c:102)
==23149==    by 0x402583F: pthread_join (hg_intercepts.c:248)
==23149==    by 0x80486BC: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #2
==23149==   New state: shared-modified by threads #1, #2
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Location 0x4F41BD8 has never been protected by any lock
==23149==
==23149== Possible data race during write of size 4 at 0x5741BD8
==23149==    at 0x402F548: pthread_join (pthread_join.c:102)
==23149==    by 0x402583F: pthread_join (hg_intercepts.c:248)
==23149==    by 0x80486D6: main (in /home/remi/a.out)
==23149==   Old state: shared-readonly by threads #1, #3
==23149==   New state: shared-modified by threads #1, #3
==23149==   Reason:    this thread, #1, holds no consistent locks
==23149==   Location 0x5741BD8 has never been protected by any lock
==23149==
==23149== ERROR SUMMARY: 18 errors from 10 contexts (suppressed: 17 from 2)

> > I have libc6-dbg and that won't do it, what else am I supposed to do?
>
>   `bt full` instead of just `bt` doesn't shows line numbers ?

I'm afraid it doesn't (even without libc6-i686).

-- 
Rémi Denis-Courmont
http://www.remlab.net/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: