Signal-safe tracing without _dl_find_object #286
collinjackson93
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We used to have some custom written stack trace-generating code in a project at work that we replaced with Cpptrace. We eventually got bit by ignoring the myriad warnings against generating stack traces in a signal handler without properly considering signal safety and crashed while calling
malloc
, leading to deadlocks. Unfortunately, the version of glibc that we have access to doesn't include_dl_find_object
so we couldn't just migrate to the signal-safe API of Cpptrace.One of my coworkers ended up making a modification to add a couple new functions to Cpptrace that avoid calling
malloc
from the main process and only do so from the child. We haven't seen any issues running this modified version of the code for a few months, so I want to offer up the changes in case they're useful for others.As mentioned above, I wasn't the one that originally made these changes, so I can't answer any questions about why certain changes were made, but I'm happy to help get this change ready for a broader audience if it's deemed useful. Here are the changes and below is output showing that the signal_demo originally only included the addresses before this change and now includes a full stack trace.
Beta Was this translation helpful? Give feedback.
All reactions