[krbdev.mit.edu #9139] git commit
Greg Hudson via RT
rt-comment at krbdev.mit.edu
Wed Sep 11 17:03:55 EDT 2024
Wed Sep 11 17:03:55 2024: Request 9139 was acted upon.
Transaction: Ticket created by ghudson at mit.edu
Queue: krb5
Subject: git commit
Owner: ghudson at mit.edu
Requestors:
Status: new
Ticket <URL: https://krbdev.mit.edu/rt/Ticket/Display.html?id=9139 >
Block library unloading to avoid finalizer races
Library finalizers can run due to the library being unloaded or the
process exiting. If the library is being unloaded, global memory
resources must be released to avoid memory leaks. But if the process
is exiting, releasing memory resources can lead to race conditions if
another thread invokes functions from the library during or after
finalizer execution. Most commonly this manifests as an assertion
error about trying to lock a destroyed mutex.
We can block unloading of our library on ELF platforms by passing "-z
nodelete" to the linker. Add a shell variable "lib_unload_prevented"
to the shlib.conf outputs, set it on platforms where we can block
unloading, and suppress finalizers when it is set.
On Windows we can detect if the process is exiting by checking for a
non-null lpvReserved argument in DllMain(). Do not execute finalizers
when the process is executing.
https://github.com/krb5/krb5/commit/1bfcf572241a4ec0e44e609e5c6b7c0b11b08eea
Author: Greg Hudson <ghudson at mit.edu>
Commit: 1bfcf572241a4ec0e44e609e5c6b7c0b11b08eea
Branch: master
src/aclocal.m4 | 3 +++
src/config/shlib.conf | 34 +++++++++++++++++++++++-----------
src/include/k5-platform.h | 5 ++++-
src/lib/win_glue.c | 6 +++++-
4 files changed, 35 insertions(+), 13 deletions(-)
More information about the krb5-bugs
mailing list