Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling malloc from signal handler #181

Open
nathanwbrei opened this issue Dec 19, 2022 · 0 comments
Open

Calling malloc from signal handler #181

nathanwbrei opened this issue Dec 19, 2022 · 0 comments

Comments

@nathanwbrei
Copy link
Collaborator

Signal handler is calling malloc. Signal handlers should avoid all non-async-signal-safe (approx the same thing as non-reentrant) syscalls as per https://man7.org/linux/man-pages/man7/signal-safety.7.html. That includes malloc and all IO.

If the segfault corrupts malloc itself, such as here (eic/EICrecon#402), we lose the backtrace.

The solution is to pre-allocate a buffer for the backtrace instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant