Bug 112512 - pthread_setcancelstate does not work
pthread_setcancelstate does not work
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
1
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-21 17:43 EST by Scott Lamb
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-06 15:13:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Scott Lamb 2003-12-21 17:43:03 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031114

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):
glibc-2.3.2-101.1

How reproducible:
Always

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 17:43:49 EST
Created attachment 96661 [details]
test program
Comment 2 Jakub Jelinek 2003-12-21 17:48:22 EST
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):
        Likewise.

        * 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
though.
Comment 3 Scott Lamb 2003-12-21 18:07:56 EST
Excellent. Thank you.
Comment 4 Scott Lamb 2004-01-06 15:13:17 EST
glibc-2.3.3-3 indeed fixes this for me. Thanks again.
Comment 5 John Flanagan 2004-05-11 21:28:24 EDT
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.

http://rhn.redhat.com/errata/RHBA-2004-212.html

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