Bug 112512 - pthread_setcancelstate does not work
Summary: pthread_setcancelstate does not work
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 1
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2003-12-21 22:43 UTC by Scott Lamb
Modified: 2007-11-30 22:10 UTC (History)
0 users

Clone Of:
Last Closed: 2004-01-06 20:13:17 UTC

Attachments (Terms of Use)
test program (2.49 KB, text/plain)
2003-12-21 22:43 UTC, Scott Lamb
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:143 normal SHIPPED_LIVE GNU C Library bugfix update 2004-05-11 04:00:00 UTC
Red Hat Product Errata RHBA-2004:212 normal SHIPPED_LIVE Updated shadow-utils package available 2004-05-11 04:00:00 UTC
Red Hat Product Errata RHBA-2004:213 normal SHIPPED_LIVE Updated ypserv package available 2004-05-11 04:00:00 UTC

Description Scott Lamb 2003-12-21 22:43:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)

Description of problem:
In the soon-to-be-attached test program, I'm able to cancel a thread
despite it having disabled cancellation through pthread_setcancelstate.

This occurs with glibc-2.3.2-101.1 on Fedora Core 1 with both
kernel-2.4.22-1.2115.nptl and kernel-2.6.0-0.test11.1.13. I'm using an
AMD Athlon system.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Save the attached bad_cancellation.c to a file.

2. Compile:
   $ gcc -Wall bad_cancellation.c -o bad_cancellation -lpthread

3. Run:
   $ ./bad_cancellation

Actual Results:  It exits almost immediately with the message
"Canceled thread with cancellation disabled."

Expected Results:  It loops forever.

Additional info:

Marking "high" severity as there's no way my code can use thread
cancellation safely with this bug.

Comment 1 Scott Lamb 2003-12-21 22:43:49 UTC
Created attachment 96661 [details]
test program

Comment 2 Jakub Jelinek 2003-12-21 22:48:22 UTC
Fixed by:
2003-12-19  Jakub Jelinek  <jakub@redhat.com>

        * libc-cancellation.c (__libc_enable_asynccancel): Don't cancel
        if CANCELSTATE_BITMASK is set.
        * sysdeps/pthread/librt-cancellation.c (__librt_enable_asynccancel):

        * Makefile (tests): Add tst-cancel22 and tst-cancel23.
        (tests-reverse): Add tst-cancel23.
        * tst-cancel22.c: New test.
        * tst-cancel23.c: New test.

It will take a few days till there will be FC1 testing updates for glibc

Comment 3 Scott Lamb 2003-12-21 23:07:56 UTC
Excellent. Thank you.

Comment 4 Scott Lamb 2004-01-06 20:13:17 UTC
glibc-2.3.3-3 indeed fixes this for me. Thanks again.

Comment 5 John Flanagan 2004-05-12 01:28:24 UTC
An errata 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 the 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.


Note You need to log in before you can comment on or make changes to this bug.