View Issue Details

IDProjectCategoryView StatusLast Update
00019051003.1(2024)/Issue8System Interfacespublic2025-02-13 16:51
Reportergeoffclare Assigned To 
PrioritynormalSeverityObjectionTypeClarification Requested
Status ResolvedResolutionAccepted 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Section2.4.3
Page Number519
Line Number18344
Interp Status---
Final Accepted Text
Summary0001905: Conflicting text about async-signal-safety
DescriptionIn section 2.4.3 this text at line 18330:
If the process is multi-threaded, or if the process is single-threaded and a signal handler is executed other than as the result of:
  • The process calling abort(), raise(), kill(), pthread_kill(), or sigqueue() to generate a signal that is not blocked

  • A pending signal being unblocked and being delivered before the call that unblocked it returns
the behavior is undefined if:
  • [...]

  • The signal handler calls any function or function-like macro defined in this standard other than one of the functions and macros specified below as being async-signal-safe.

conflicts with this text at line 18414:
In the presence of signals, all functions defined by this volume of POSIX.1-2024 shall behave as defined when called from or interrupted by a signal-catching function, with the exception that when a signal interrupts an unsafe function or function-like macro, or equivalent (such as the processing equivalent to exit() performed after a return from the initial call to main()), and the signal-catching function calls an unsafe function or function-like macro, the behavior is undefined.

because the former lacks the condition that the signal interrupted an unsafe function or function-like macro (or equivalent).

Digging into the history, the conflict existed in Issue 6 but only for signal handlers installed using signal(), not sigaction(), because the conflicting text was on the signal() page. Bug 0000066 (which was applied in Issue 7 TC1) updated the text and copied it into 2.4.3. (It made no sense for there to be different signal handler rules depending on which function installed the handler.)

Rather than fix both copies of the duplicated text, the suggested changes fix 2.4.3 and replace the corresponding text on the signal() page with text containing a cross-reference to 2.4.3.
Desired ActionOn page 519 line 18344 section 2.4.3, change:
The signal handler calls any function or function-like macro defined in this standard other than one of the functions and macros specified below as being async-signal-safe.
to:
The signal interrupted a call to any function or function-like macro defined in this standard other than one of the functions and macros specified below as being async-signal-safe (that is; a call to an ``unsafe function or function-like macro''), or equivalent (such as the processing equivalent to exit() performed after a return from the initial call to main()), and the signal handler calls an unsafe function or function-like macro.

On page 2060 line 67612 section signal(), after:
This restriction does not apply to POSIX applications, as POSIX.1-2024 requires raise() to be async-signal-safe (see [xref to 2.4.3]).
append a sentence (continuing the CX shading):
This standard also defines the behavior for signal handlers in various other circumstances under which the ISO C standard states that the behavior is undefined. See [xref to 2.4.3] for details.

On page 2060-2061 line 67613-67628 section signal(), delete:
If the process is multi-threaded, or if the process is single-threaded and a signal handler is executed other than as the result of:

[...]

The signal handler calls any function defined in this standard other than one of the functions listed in [xref to 2.4].

Tagstc1-2024

Relationships

related to 0000066 Closedajosey 1003.1(2008)/Issue 7 sigaction/signal lists are different 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-02-06 14:34 geoffclare New Issue
2025-02-06 14:34 geoffclare Name => Geoff Clare
2025-02-06 14:34 geoffclare Organization => The Open Group
2025-02-06 14:34 geoffclare Section => 2.4.3
2025-02-06 14:34 geoffclare Page Number => 519
2025-02-06 14:34 geoffclare Line Number => 18344
2025-02-06 14:34 geoffclare Interp Status => ---
2025-02-06 14:40 geoffclare Relationship added related to 0000066
2025-02-13 16:51 eblake Status New => Resolved
2025-02-13 16:51 eblake Resolution Open => Accepted
2025-02-13 16:52 eblake Tag Attached: tc1-2024