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

_dyld_get_image_header not safe to call from signal handler #431

Open
armcknight opened this issue Jul 1, 2022 · 1 comment
Open

_dyld_get_image_header not safe to call from signal handler #431

armcknight opened this issue Jul 1, 2022 · 1 comment

Comments

@armcknight
Copy link
Contributor

We use a fork of KSCrash and received a customer report of watchdog timeouts while handling a signal. _dyld_get_image_header is called from within onCrash and takes an os_unfair_lock, which is not reentrant and thus contravenes the guidelines stated in https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html that syscalls made from signal handlers must be reentrant. It seems that _dyld_get_image_header is hanging or deadlocked while waiting for the lock to be relinquished and the system is killing the process due to the watchdog timeout.

Recommend instead of looking up image information at crash time, to build and maintain a data structure of loaded images ahead of time using _dyld_register_func_for_add_image and _dyld_register_func_for_remove_image.

@GLinnik21
Copy link
Collaborator

Hey!
Have you already implemented this fix in your fork of KSCrash? If so, could you share the changes or possibly submit a pull request to the main repo? It'd be great to see how you've tackled this issue and it could help others facing similar problems!

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

2 participants