A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=906 ====================================================================== Reported By: dalias Assigned To: ====================================================================== Project: 1003.1(2013)/Issue7+TC1 Issue ID: 906 Category: System Interfaces Type: Clarification Requested Severity: Editorial Priority: normal Status: New Name: Rich Felker Organization: musl libc User Reference: Section: abort Page Number: 560 Line Number: 19406-19414 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2014-12-18 02:10 UTC Last Modified: 2022-06-17 14:22 UTC ====================================================================== Summary: Ambiguity of abort() behavior racing with sigaction ======================================================================
---------------------------------------------------------------------- (0005851) geoffclare (manager) - 2022-06-17 14:22 https://austingroupbugs.net/view.php?id=906#c5851 ---------------------------------------------------------------------- Suggested changes... Page and line numbers are for the 2018 edition. On page 565 line 19766 section abort(), change:<blockquote>unless the signal SIGABRT is being caught and the signal handler does not return.</blockquote>to:<blockquote>unless a SIGABRT signal that it generates is caught and the signal handler does not return.</blockquote> On page 565 line 19771 section abort(), change:<blockquote>The SIGABRT signal shall be sent to the calling process as if by means of <i>raise</i>() with the argument SIGABRT.</blockquote>to:<blockquote>The SIGABRT signal shall be sent to the calling [CX]thread[/CX] as if by means of <i>raise</i>() with the argument SIGABRT. [CX]If this signal does not terminate the process (for example, if the signal is caught and the handler returns), <i>abort</i>() may change the disposition of SIGABRT to SIG_DFL and send the signal (in the same way) again. If a second signal is sent and it does not terminate the process, the behavior is unspecified, except that the <i>abort</i>() call shall not return.[/CX]</blockquote> On page 565 line 19785 section abort(), insert at the start of RATIONALE:<blockquote>Historically, <i>abort</i>() has been implemented by calling other signal manipulation functions such as <i>raise</i>(), <i>sigaction</i>(), and <i>pthread_sigmask</i>(). This means that its operation can be affected by concurrent actions in other threads. For example, if <i>abort</i>() attempts to terminate the process by calling <i>sigaction</i>() to change the disposition for SIGABRT to SIG_DFL and then calling <i>raise</i>(), another thread could change the disposition in between those two calls, resulting in the process not being terminated. If this happens, the only requirement is that <i>abort</i>() does not return. An implementation could call those functions in a loop (which could in theory then execute indefinitely), or could terminate the process by calling <i>_exit</i>() (which would ensure termination but result in the wrong wait status). To avoid these issues, implementations are encouraged to implement <i>abort</i>() in a manner such that its operation cannot be affected by concurrent actions in other threads. For example, it could first halt the execution of all other threads, or it could terminate the process using a ``terminate as if by a signal'' system call instead of by raising (a second) SIGABRT.</blockquote> On page 566 line 19805 section abort(), change FUTURE DIRECTIONS from:<blockquote>None.</blockquote>to:<blockquote>A future version of this standard may require <i>abort</i> to be implemented in a manner such that its operation cannot be affected by concurrent actions in other threads.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2014-12-18 02:10 dalias New Issue 2014-12-18 02:10 dalias Name => Rich Felker 2014-12-18 02:10 dalias Organization => musl libc 2014-12-18 02:10 dalias Section => abort 2014-12-18 02:10 dalias Page Number => unknown 2014-12-18 02:10 dalias Line Number => unknown 2015-03-26 15:38 Don Cragun Note Added: 0002607 2015-03-26 15:41 Don Cragun Page Number unknown => 560 2015-03-26 15:41 Don Cragun Line Number unknown => 19406-19414 2015-03-26 15:41 Don Cragun Interp Status => --- 2022-05-12 15:29 geoffclare Tag Attached: c99 2022-06-16 16:15 geoffclare Tag Detached: c99 2022-06-16 16:22 Don Cragun Note Edited: 0002607 2022-06-16 16:23 Don Cragun Note Edited: 0002607 2022-06-17 14:22 geoffclare Note Added: 0005851 ======================================================================