Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

_Py_DumpStack() is not signal-safe the first time it's called #137185

Closed
Labels
extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@colesbury

Description

@colesbury

Bug report

The_Py_DumpStack() should be signal-safe, because we typically call it from signal handlers.

This shows up as an error "signal-unsafe call inside of a signal" if you run./python -m test test_faulthandler -m test_enable_fd -v with TSan enabled.

From theman page:

backtrace() and backtrace_symbols_fd() don't call malloc()
explicitly,but they are part of libgcc, which gets loaded
dynamically when first used
. Dynamic loading usually triggers
a call to malloc(3). If you need certain calls to these two
functions to not allocate memory (in signal handlers, for
example), you need to make sure libgcc is loaded beforehand.

(I thinkbacktrace() is inlibc, but it calls__libc_unwind_link_get(), which is inlibgcc)

If we are going to callbacktrace() from a signal handler, we should ensure thatlibgcc is loadedwhen we install the signal handler. We can do this by callingbacktrace() early, at signal handler installation time, to forcelibgcc to be loaded.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp