[SERVER-66562] Audit, document all functions accessed by sync signal handlers Created: 18/May/22  Updated: 07/Dec/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Issue split
split from SERVER-63843 Don't allow recursive doLog in synchr... Closed
Related
related to SERVER-83271 Make synchronous signal handlers sign... Open
is related to SERVER-82459 Fall back to default signal handler w... Closed
Assigned Teams:
Service Arch
Operating System: ALL
Sprint: Service Arch Prioritized List
Participants:

 Description   

Signal handlers for sync signals (SIGSEGV etc) are making calls to diagnostic functions like printStackTrace, setBreakpoint, etc, or even LOGV2 macros. There's a possibility that these functions could make blocking calls or try to acquire resources that the call thread already holds, yielding a deadlock or undefined behavior.

We should make sure that any library calls (logging, stacktracing, etc) used from a signal handler are clearly marked as safe for that purpose. If there's an alternative no-resource path into those libraries (e.g. new "emergency logging" calls, or printStackTrace(mallocFreeOStream), we should audit the call path from the signal handler to make sure it's using those more conservative functions.

We should clearly mark those functions as being called from signal handlers to prevent them from using inappropriate functions. This includes their error paths, which can't e.g. use LOGV2 to report errors. There should be a central block of documentation describing these restrictions in the signal_handlers_synchronous.cpp file.

Changes to these functions should proactively seek to Cc the appropriate context-holding reviewers, as they could introduce subtle side effects.

(split from SERVER-63843)


Generated at Thu Feb 08 06:05:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.