This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/14267] New: fprintf() function is multithread-unsafe
- From: "penght at cn dot fujitsu.com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Wed, 20 Jun 2012 05:32:25 +0000
- Subject: [Bug libc/14267] New: fprintf() function is multithread-unsafe
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14267
Bug #: 14267
Summary: fprintf() function is multithread-unsafe
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: unassigned@sourceware.org
ReportedBy: penght@cn.fujitsu.com
CC: carlos@systemhalted.org, drepper.fsp@gmail.com
Classification: Unclassified
Created attachment 6460
--> http://sourceware.org/bugzilla/attachment.cgi?id=6460
The Patch can make fprintf() function to multithread-safe
fprintf() uses static variables __printf_function_table and
__printf_va_arg_table indirectly, which are not protected. It is
not safe in multithread circumstance.
When call fprintf() and register_printf_specifier() simultaneously
in multithread circumstance, the following case will cause unsafe.
The case has two threads: A and B.
a. thread B call register_printf_specifier('W', print_widget,
print_widget_arginfo)
b. thread A call fprintf (stdout, "|%W|\n", &mywidget), when judge
__printf_function_table is not NULL, but not output &mywidget
c. thread B call register_printf_specifier('W', NULL, NULL)
d. thread A output &mywidget when __printf_function_table is NULL
e. programme will Segmentation fault
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.