preload: Reinitialize mutexes after forking#280
Conversation
|
Thanks @vanvugt ! I'm not familiar with that glibc |
|
Ah nevermind, of course |
There was a problem hiding this comment.
Pull request overview
This PR addresses a fork-safety issue in the libumockdev preload library by ensuring mutex state in the child process cannot remain inherited/locked, which could otherwise deadlock the child when it next uses the preload interposition logic (per Launchpad #2144723).
Changes:
- Add a
pthread_atfork()child handler to reset internal mutexes afterfork(). - Register the at-fork handler via a constructor (
on_load) when the preload library is loaded.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Or else there's a risk the child process has inherited mutexes that are already locked, resulting in a deadlock as soon as it tries to use them. https://bugs.launchpad.net/bugs/2144723
44f1457 to
ac78950
Compare
martinpitt
left a comment
There was a problem hiding this comment.
Thank you! I'll do a release now.
Or else there's a risk the child process has inherited mutexes that are already locked, resulting in a deadlock as soon as it tries to use them.
https://bugs.launchpad.net/bugs/2144723