Skip to content

faulthandler prints "Segmentation fault" on non SIGSEGV signal deaths #96055

Closed
@gpshead

Description

@gpshead

Bug report

The faulthandler module has a hard coded fixed small list of signals that it knows the name of. For anything not in this list it uses the final entry in its table as the value to print in the error message. This is misleading.

Ex: trigger a SIGTRAP in a Python process with faulthandler enabled.

The process exits properly indicating the correct death signal to the OS (Linux on aarch64 in this case), but the message emitted by Python is confusingly:

Fatal Python error: Segmentation fault

Current thread 0x0000005504ffa450 (most recent call first):
...

The cause is the faulthandler_handlers array of structs in https://github.com/python/cpython/blob/main/Modules/faulthandler.c#L130

We should expand that to include more deadly signals. SIGTRAP led someone to notice it here. When we don't have the signal listed in the table it'd be nicer to emit an error message saying that rather than mislabelling it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions