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

Make initialization thread-safe, and support early callers #19

Closed
wants to merge 1 commit into from

Conversation

mapreri
Copy link
Contributor

@mapreri mapreri commented Apr 28, 2020

The current initialization code is not thread-safe, and assumes that the
only possible caller of open() before initialization completes is
dlsym(), which is not the case if there are other preloaded libraries.

This patch makes the initialization thread-safe by using thread-local
variables, and adjusts the recursive checking logic to support early
callers.

See Debian bug #918520 for more background: https://bugs.debian.org/918520

Signed-off-by: Mattia Rizzolo mattia@debian.org

The current initialization code is not thread-safe, and assumes that the
only possible caller of open() before initialization completes is
dlsym(), which is not the case if there are other preloaded libraries.

This patch makes the initialization thread-safe by using thread-local
variables, and adjusts the recursive checking logic to support early
callers.

Bug-Debian: https://bugs.debian.org/918520
Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
@mapreri
Copy link
Contributor Author

mapreri commented Apr 28, 2020

Note though that this requires c11 for _Thread_local.

@stewartsmith
Copy link
Owner

Well, that's interesting! Merged in at 9159bc1 and in v129. Thanks!

@mapreri mapreri deleted the thread-safe branch April 17, 2021 13:45
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

Successfully merging this pull request may close these issues.

None yet

3 participants