View Issue Details

IDProjectCategoryView StatusLast Update
00006131003.1(2008)/Issue 7System Interfacespublic2024-06-11 08:52
Reporterdalias Assigned Toajosey  
PrioritynormalSeverityEditorialTypeOmission
Status ClosedResolutionAccepted As Marked 
NameRich Felker
Organizationmusl libc
User Reference
Sectionpthread_cleanup_push
Page Numberunknown
Line Numberunknown
Interp Status---
Final Accepted Text0000613:0005944
Summary0000613: Relationship of automatic object lifetimes to cancellation cleanup functions is not specified
DescriptionPurportedly it is the intent of the standard to allow implementation of thread cancellation and cleanup functions using language-level exception handling, such as the exception extensions to the C language offered by GCC. However, nowhere is it specified that acting on a cancellation request prematurely terminates execution of any block; thus, by a strict reading of the standard as written, cleanup handlers are permitted to access objects with automatic storage duration whose lifetimes have not ended at the point where cancellation is acted upon, but whose lifetimes would have ended if an otherwise-equivalent exception were thrown from that point.

A manifestation of this issue in the GNU C library can be seen in this issue report, which I filed:

http://sourceware.org/bugzilla/show_bug.cgi?id=14609

Also, the follow-up on the issue tracker cites language in the rationale for the original 1996 standard, which I cannot find in the current standard, clarifying that such exception-based implementations were intended to be permitted.
Desired ActionAdding language to this effect in the specification of pthread_cleanup_push should be sufficient:

"Invoking a cancellation cleanup function may terminate the execution of any block being executed by the thread whose execution began began after the corresponding invocation of pthread_cleanup_push."
Tagstc3-2008

Activities

geoffclare

2022-08-25 15:15

manager   bugnote:0005944

After 2018 edition page 48 line 1520 section 3 Definitions, add a new definition:

3.xxx Code Block
In the context of the System Interfaces Volume of this standard, a block as defined in the ISO C standard.

After 2018 edition page 1605 line 52316 section pthread_cleanup_pop(), add a new paragraph:
Invoking a cancellation cleanup handler may terminate the execution of any code block being executed by the thread whose execution began after the corresponding invocation of pthread_cleanup_push().

Issue History

Date Modified Username Field Change
2012-09-24 21:41 dalias New Issue
2012-09-24 21:41 dalias Status New => Under Review
2012-09-24 21:41 dalias Assigned To => ajosey
2012-09-24 21:41 dalias Name => Rich Felker
2012-09-24 21:41 dalias Organization => musl libc
2012-09-24 21:41 dalias Section => pthread_cleanup_push
2012-09-24 21:41 dalias Page Number => unknown
2012-09-24 21:41 dalias Line Number => unknown
2022-08-25 15:15 geoffclare Note Added: 0005944
2022-08-25 15:15 geoffclare Interp Status => ---
2022-08-25 15:15 geoffclare Final Accepted Text => 0000613:0005944
2022-08-25 15:15 geoffclare Status Under Review => Resolved
2022-08-25 15:15 geoffclare Resolution Open => Accepted As Marked
2022-08-25 15:16 geoffclare Tag Attached: tc3-2008
2022-09-27 15:22 geoffclare Status Resolved => Applied
2024-06-11 08:52 agadmin Status Applied => Closed