diff options
| author | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 20:07:50 -0600 |
|---|---|---|
| committer | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 20:07:50 -0600 |
| commit | 450c5e52b3bd1705f04587ba11442c398332aa15 (patch) | |
| tree | 83f2d5f839a40fe5837ae484a65e0d5bd83ae3b3 /runtime/test/tiny_game_exit_code_test.cpp | |
| parent | d1b7d10c76d739125f0e050b52375dff7ab6f4b8 (diff) | |
library_loader: ask Windows for a host module's name on every GetProcAddress
Dropping the HMODULE -> name entry in free_library() after FreeLibrary
left a window (timbot103's review on #2525): between FreeLibrary and the
erase, another thread can load a different DLL at the freed base and
call GetProcAddress, which then found the old name and served the old
module's shims. Holding loader_mutex across FreeLibrary would invite a
lock-order inversion with the loader lock.
So there is no cache any more: host_module_name() calls
GetModuleFileNameW each time, which always answers for the module mapped
at that base now, and free_library() is a plain FreeLibrary again.
library_loader_names_test gains the window itself: the host's
FreeLibrary is called directly, so the shim never sees the unload, and
the plain copy loaded at the same base must not be served the shim. It
fails with the cache-and-erase version and passes now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/tiny_game_exit_code_test.cpp')
0 files changed, 0 insertions, 0 deletions