Created attachment 400274 [details] test program Description of problem: Multithreaded apps can segfault in, e.g., strerror_r, if running in non-C locales like ja_JP.UTF-8. This was fixed in RHEL 5 in bug 439486 but it's still a problem in RHEL 4. Version-Release number of selected component (if applicable): glibc-2.3.4-2.43.el4_8.2 How reproducible: fairly often Steps to Reproduce: 1. Compile the attached test program g++ -o test test.cpp -lpthread 2. ./test Actual results: child killed by signal 11 Expected results: clean exit Additional info:
Created attachment 400279 [details] alternate test case On a multi-CPU/multi-core system: 1. tar xzf strerror_r.tar.gz 2. cd strerror_r 3. make 4. ./test.sh Occasionally you'll see an error message: ./test.sh: line 10: 29993 Segmentation fault ./strerror_r
Created attachment 405622 [details] backport of glibc-rh439486.patch Attached is an attempt to backport glibc-rh439486.patch from RHEL 5 glibc. This patch definitely should be reviewed because I had to backport some other very large changes to get it to compile. These include: - a large portion of _nl_find_msg() in intl/dcigettext.c was re-written - _nl_init_domain_conv() and _nl_free_domain_conv() removed from intl/loadmsgcat.c - added struct converted_domain to gettextP.h - updated struct loaded_domain to use the struct converted_domain - added get_output_charset() internal function to dcigettext.c - included some more headers in gconv_int.h to clear some compiler warnings In my testing with this patch, the test program in comment 0 succeeds every time. I ran it in a loop 100 times and without the patch, it would fail approximately 50/100 times. With the patch, it's successful all the time. let f=0 for i in $(seq 1 100); do echo -n "$i : " if ./test ; then echo Passed else echo let f=f+1 fi done echo echo "Failed $f times out of 100"
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Due to insufficient locking, the use of the strerror() function in a multi-threaded application could cause the application to terminate unexpectedly with a segmentation fault in the gettext subsystem. This update includes backported patches that add the necessary locks to glibc, resolving this issue.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0248.html