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

 
 

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

Submitter:  Samuel Thibault <sthibaul>
Submitted:  Sun 12 Mar 2006 03:38:56 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Upstream Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Reproducibility:  Every Time
Size (loc):  None Planned Release:  None
Effort:  0.00
Wiki-like text discussion box: 

Ok, thanks :)

* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 02 Mar 2020 10:41:19 AM UTC, comment #3: 

This was fixed!

guy fleury iteriteka <gfleury>
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>
Group administrator
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>
Group 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>
Group administrator

 

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

Attach Files:
   
   
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
  • -email is unavailable- added by gfleury (Posted a comment)
  • -email is unavailable- added by sthibaul (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-03-02 sthibaul StatusIn Progress Upstream
        Open/ClosedOpen Closed
        Wiki-like text discussion box Ok, thanks :)
    2009-05-02 sthibaul StatusNone In Progress
    2006-10-24 andrewresch Attached File- Added pthread_setcancel_null_fixes.patch, #11043
    2006-10-24 andrewresch Attached File- Added pthread_setcancelstate_oldstate_null_fix.patch, #11042
    2006-03-12 sthibaul Attached File- Added test.c, #3496

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code