bugThe GNU Hurd - Bugs: bug #16075, pthread_setcancelstate() makes...

 
 

bug #16075: pthread_setcancelstate() makes pthread_join() crash

Submitted by:  Samuel Thibault <sthibaul>
Submitted on:  Sun 12 Mar 2006 03:38:56 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: In ProgressPrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: OpenReproducibility: Every Time
Size (loc): NonePlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 02 May 2009 01:23:31 PM UTC, comment #2:

I've a patch pending commit for this (there was the issue with
octave3.0 too)

Samuel Thibault <sthibaul>
Project Member
Tue 14 Mar 2006 04:51:17 PM UTC, comment #1:

The crash is occuring in pthread_setcancelstate, not pthread_join. Strictly speaking, POSIX does not require that pthread_setcancelstate interpret NULL as meaning don't care. As this is what implementations (namely glibc) allow, libpthread should likely be modified to handle this situation as well.

Neal H. Walfield <neal>
Project Administrator
Sun 12 Mar 2006 03:38:56 PM UTC, original submission:

Attached is a sample program that always crashes on pthread_join over a thread that called pthread_setcancelstate():

Program received signal SIGSEGV, Segmentation fault.
0x0105126c in mach_msg_trap () from /lib/libc.so.0.3
(gdb) bt
#0 0x0105126c in mach_msg_trap () from /lib/libc.so.0.3
#1 0x01051aff in mach_msg () from /lib/libc.so.0.3
#2 0x010332ad in __pthread_block (thread=0x10004005) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/sysdeps/mach/pt-block.c:35
#3 0x01032c1c in __pthread_cond_timedwait_internal (cond=0x10004005, mutex=0x10004005, abstime=0x0)
at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/sysdeps/generic/pt-cond-timedwait.c:100
#4 0x010329a2 in pthread_cond_wait (cond=0x8049aa4, mutex=0x8049a84) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/sysdeps/generic/pt-cond-wait.c:36
#5 0x010307ad in pthread_join (thread=268451845, status=0x0) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-join.c:43
#6 0x08048577 in main ()
(gdb) info thread
7 thread 17899.7 0x01030c79 in pthread_setcancelstate (state=1, oldstate=0x0) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-setcancelstate.c:38
6 thread 17899.6 0x0105126c in mach_msg_trap () from /lib/libc.so.0.3

  • 5 thread 17899.5 0x0105126c in mach_msg_trap () from /lib/libc.so.0.3

(gdb) thread 7
[Switching to thread 7 (thread 17899.7)]#0 0x01030c79 in pthread_setcancelstate (state=1, oldstate=0x0)
at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-setcancelstate.c:38
38 *oldstate = p->cancel_state;
(gdb) bt
#0 0x01030c79 in pthread_setcancelstate (state=1, oldstate=0x0) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-setcancelstate.c:38
#1 0x080484fe in f ()
#2 0x0102fd12 in entry_point (start_routine=0x80484e4 <f>, arg=0x0) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-create.c:48
#3 0x00000000 in ?? ()
(gdb) thread 6
[Switching to thread 6 (thread 17899.6)]#0 0x0105126c in mach_msg_trap () from /lib/libc.so.0.3
(gdb) bt
#0 0x0105126c in mach_msg_trap () from /lib/libc.so.0.3
#1 0x01051aff in mach_msg () from /lib/libc.so.0.3
#2 0x01052228 in mach_msg_server_timeout () from /lib/libc.so.0.3
#3 0x010522e7 in mach_msg_server () from /lib/libc.so.0.3
#4 0x0105fed7 in _hurd_msgport_receive () from /lib/libc.so.0.3
#5 0x0102fd12 in entry_point (start_routine=0x105fe50 <_hurd_msgport_receive>, arg=0x0) at /build/mbanck/hurd-20050513/build-tree/hurd/libpthread/pthread/pt-create.c:48
#6 0x00000000 in ?? ()

Samuel Thibault <sthibaul>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #11043:  pthread_setcancel_null_fixes.patch added by andrewresch (992B - text/x-patch - A similar bug appears in pthread_setcanceltype so this patch addresses both.)
file #11042:  pthread_setcancelstate_oldstate_null_fix.patch added by andrewresch (335B - text/x-patch - This patch fixes the crash by not setting oldstate if it is NULL.)
file #1522:  test.c added by sthibaul (325B - text/x-csrc - crashes on pthread_join())

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by sthibaul (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 02 May 2009 01:23:31 PM UTCsthibaulStatusNone=>In Progress
    Tue 24 Oct 2006 02:11:52 AM UTCandrewreschAttached File-=>Added pthread_setcancel_null_fixes.patch, #11043
    Tue 24 Oct 2006 01:44:10 AM UTCandrewreschAttached File-=>Added pthread_setcancelstate_oldstate_null_fix.patch, #11042
    Sun 12 Mar 2006 03:38:56 PM UTCsthibaulAttached File-=>Added test.c, #3496

    Back to the top


    Powered by Savane 3.1-cleanup