View Issue Details

IDProjectCategoryView StatusLast Update
00006921003.1(2013)/Issue7+TC1System Interfacespublic2019-06-10 08:55
Reportermdempsky Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status ClosedResolutionAccepted As Marked 
NameMatthew Dempsky
OrganizationOpenBSD
User Reference
SectionXSI 2.4.3 Signal Actions
Page Number494
Line Number16845
Interp StatusApproved
Final Accepted Textsee 0000692:0001609
Summary0000692: More async-signal-safe functions
DescriptionIt's very tedious to not have access to functions like memcpy() and strlen() in an async signal handler. It would ease application developers if they didn't have to reimplement these functions themselves.
Desired ActionAdd the following functions to the table of async-signal-safe functions:

memccpy, memchr, memcmp, memcpy, memmove, memset, stpcpy, stpncpy, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncat, strncmp, strncpy, strnlen, strpbrk, strrchr, strspn, strstr, strtok_r


Alternatively, add a note explaining why these functions aren't async-signal-safe.
Tagstc2-2008

Relationships

related to 0000162 Closedajosey 1003.1(2008)/Issue 7 Determining System Endianess during Preprocessing 

Activities

mdempsky

2013-05-07 18:05

reporter   bugnote:0001592

Oops, Eric Blake points out the second "strchr" in the list should actually be "strrchr".

Don Cragun

2013-05-07 18:26

manager   bugnote:0001593

The Desired Action has been updated as suggested in 0000692:0001592.

eblake

2013-05-07 19:15

manager   bugnote:0001594

It might be worth scrubbing for other functions which don't alter errno, and don't depend on or alter global state, where the result is always determined solely by the parameters. For example, <strings.h> ffs() seems like something useful to declare async-signal safe, and is the sort of bit-twiddling operation that might actually be useful in a signal handler. Likewise for <arpa/inet.h> with ntohl, ntohs, htonl, htons.

The proposal of <endian.h> in 0000162 would add another set of candidates.

eblake

2013-05-16 16:30

manager   bugnote:0001609

Last edited: 2013-05-16 16:35

Interpretation response
------------------------
The standard states that various string functions are not async-signal-safe, and therefore must not be used in signal handlers or between fork and exec in a multithreaded program, and conforming applications must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale:
----------
Since these functions do not modify or depend on global state, there are no known implementations where these functions cannot be safely used in aysnc-signal-safe code.

Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
At page 494 line 16845-16879 [XSH 2.4.3 table of async-signal-safe functions], add the following in proper sorted order:

ffs, htonl, htons, memccpy, memchr, memcmp, memcpy, memmove, memset, ntohl, ntohs, stpcpy, stpncpy, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncat, strncmp, strncpy, strnlen, strpbrk, strrchr, strspn, strstr, strtok_r, wcpcpy, wcpncpy, wcscat, wcschr, wcscmp, wcscpy, wcscspn, wcslen, wcsncat, wcsncmp, wcsncpy, wcsnlen, wcspbrk, wcsrchr, wcsspn, wcsstr, wcstok, wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset

ajosey

2013-09-06 04:56

manager   bugnote:0001811

Interpretation Proposed 6 Sep 2013

ajosey

2013-10-14 13:06

manager   bugnote:0001890

Interpretation approved 14 October 2013

Issue History

Date Modified Username Field Change
2013-05-07 17:57 mdempsky New Issue
2013-05-07 17:57 mdempsky Name => Matthew Dempsky
2013-05-07 17:57 mdempsky Organization => OpenBSD
2013-05-07 17:57 mdempsky Section => XSI 2.4.3 Signal Actions
2013-05-07 18:05 mdempsky Note Added: 0001592
2013-05-07 18:25 Don Cragun Interp Status => ---
2013-05-07 18:25 Don Cragun Desired Action Updated
2013-05-07 18:26 Don Cragun Note Added: 0001593
2013-05-07 19:15 eblake Note Added: 0001594
2013-05-16 16:30 eblake Note Added: 0001609
2013-05-16 16:34 eblake Note Edited: 0001609
2013-05-16 16:35 eblake Note Edited: 0001609
2013-05-16 16:36 eblake Page Number => 494
2013-05-16 16:36 eblake Line Number => 16845
2013-05-16 16:36 eblake Interp Status --- => Pending
2013-05-16 16:36 eblake Final Accepted Text => see 0000692:0001609
2013-05-16 16:36 eblake Status New => Interpretation Required
2013-05-16 16:36 eblake Resolution Open => Accepted As Marked
2013-05-16 16:36 eblake Tag Attached: tc2-2008
2013-05-16 16:36 eblake Relationship added related to 0000162
2013-09-06 04:56 ajosey Interp Status Pending => Proposed
2013-09-06 04:56 ajosey Note Added: 0001811
2013-10-14 13:06 ajosey Interp Status Proposed => Approved
2013-10-14 13:06 ajosey Note Added: 0001890
2019-06-10 08:55 agadmin Status Interpretation Required => Closed