This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Polished patch (crash after pthread_exit)
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 24 Jun 2013 17:12:09 -0400
- Subject: Re: [PATCH] Polished patch (crash after pthread_exit)
- References: <CAKt5dD1-XUyCSdhys+J5NJbCYQTMunwpcmECvRm1F0VSR4Jh+w at mail dot gmail dot com> <51C89EEB dot 3030604 at suse dot com>
On 06/24/2013 03:32 PM, Andreas Jaeger wrote:
> On 06/24/2013 09:01 PM, Vladimir Nikulichev wrote:
>> http://sourceware.org/bugzilla/show_bug.cgi?id=12310
>>
>> diff --git nptl/ChangeLog nptl/ChangeLog
>> index 0e3b018..03a7d5d 100644
>> --- nptl/ChangeLog
>> +++ nptl/ChangeLog
>> @@ -1,3 +1,7 @@
>> +2013-06-23 Vladimir Nikulichev <v.nikulichev@gmail.com>
>> +
>> + * pthread_exit.c: Add reference to pthread_create()
>> +
>
> We normally do not send ChangeLogs as diff, just the plain text. For details see http://sourceware.org/glibc/wiki/Contribution%20checklist
>
> also, it should mention the bugzilla number - and a sentence ends with a "."
>
>> 2013-06-15 Siddhesh Poyarekar <siddhesh@redhat.com>
>>
>> * Versions (libpthread): Add GLIBC_2.18.
>> diff --git nptl/pthread_exit.c nptl/pthread_exit.c
>> index 3718081..33ba767 100644
>> --- nptl/pthread_exit.c
>> +++ nptl/pthread_exit.c
>> @@ -29,3 +29,7 @@ __pthread_exit (value)
>> __do_cancel ();
>> }
>> strong_alias (__pthread_exit, pthread_exit)
>> +
>> +/* After a thread terminates, __libc_start_main() decrements
>> + __nptl_nthreads defined in pthread_create.c */
>
> This is a sentence, so end it with "." followed by two spaces.
>
>> +PTHREAD_STATIC_FN_REQUIRE (pthread_create)
>>
>
> Carlos, could you commit this after testing with the above changes (including updating NEWS) on behalf of Vladimir?
>
> Vladimir, thanks for your patch!
No regressions on x86-64.
Confirmed that pthread_exit now includes pthread_create:
.text 0x0000000000401a40 0x25 /home/carlos/install-glibc/usr/lib64/libpthread.a(pthread_exit.o)
0x0000000000401a40 pthread_exit
0x0000000000401a40 __pthread_exit
...
.text 0x0000000000401c30 0x2509 /home/carlos/install-glibc/usr/lib64/libpthread.a(pthread_create.o)
0x0000000000401dc0 __free_stacks
0x0000000000401e70 __deallocate_stack
0x00000000004020d0 __make_stacks_executable
0x0000000000402180 __reclaim_stacks
0x0000000000402520 __find_thread_by_id
0x00000000004025b0 __nptl_setxid
0x0000000000402810 __pthread_init_static_tls
0x0000000000402920 __wait_lookup_done
0x0000000000402a60 __find_in_stack_list
0x0000000000402b00 __nptl_deallocate_tsd
0x0000000000402cc0 __free_tcb
0x00000000004030a0 pthread_create
0x00000000004030a0 __pthread_create_2_1
The reproducer which previous failed now passes.
Checked in.
commit 963509c045d192b5a27891617b907fb857042f36
Author: Vladimir Nikulichev <v.nikulichev@gmail.com>
Date: Mon Jun 24 17:08:07 2013 -0400
BZ #12310: pthread_exit in static app. segfaults
Static applications that call pthread_exit on the main
thread segfault. This is because after a thread terminates
__libc_start_main decrements __nptl_nthreads which is only
defined in pthread_create. Therefore the right solution is
to add a requirement to pthread_create from pthread_exit.
~~~
nptl/
2013-06-24 Vladimir Nikulichev <v.nikulichev@gmail.com>
[BZ #12310]
* pthread_exit.c: Add reference to pthread_create.
Cheers,
Carlos.