[openssl/openssl] 1bcbea: Make win32_pathbyaddr more reliable

0 views
Skip to first unread message

Milan Broz

unread,
Sep 10, 2026, 9:34:40 AMSep 10
to openssl...@openssl.org
Branch: refs/heads/openssl-3.5
Home: https://github.com/openssl/openssl
Commit: 1bcbea544698fc4eaa7bcd46f2ad89723c579b2d
https://github.com/openssl/openssl/commit/1bcbea544698fc4eaa7bcd46f2ad89723c579b2d
Author: Neil Horman <nho...@openssl.org>
Date: 2026-09-10 (Thu, 10 Sep 2026)

Changed paths:
M crypto/dso/dso_win32.c

Log Message:
-----------
Make win32_pathbyaddr more reliable

A user has reported that win32_pathbyaddr can be unreliable in
multithreaded environments. See:

https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

Specifically they have observed the following behavior, as noted in the
above article:

When taking snapshots that include heaps and modules for a process other than
the current process, the CreateToolhelp32Snapshot function can fail or return
incorrect information for a variety of reasons. For example, if the loader data
table in the target process is corrupted or not initialized, or if the module
list changes during the function call as a result of DLLs being loaded or
unloaded, the function might fail with ERROR_BAD_LENGTH or other error code.
Ensure that the target process was not started in a suspended state, and try
calling the function again. If the function fails with ERROR_BAD_LENGTH when
called with TH32CS_SNAPMODULE or TH32CS_SNAPMODULE32, call the function again
until it succeeds.

This behavior necessitates calling DSO_pathbyaddr mutiple times to get a
succesful return code.

win32_pathbyaddr can be made more reliable, avoiding the need for multiple calls
by using alternate windows apis that are not/less succeptible to these transient
errors in multithreaded environments.

refactor win32_pathbyaddr here to implement that increased reliability.

Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Norbert Pocs <norb...@openssl.org>
Reviewed-by: Nikola Pajkovsky <nik...@openssl.org>
MergeDate: Thu Sep 10 13:28:30 2026
(Merged from https://github.com/openssl/openssl/pull/32721)

(cherry picked from commit 6552b652c7402c34a8c476910d887c9e95633eff)


Commit: bdc12147744b4048ca1a15bfff0c844c13428bff
https://github.com/openssl/openssl/commit/bdc12147744b4048ca1a15bfff0c844c13428bff
Author: Milan Broz <gmaz...@gmail.com>
Date: 2026-09-10 (Thu, 10 Sep 2026)

Changed paths:
M crypto/dso/dso_win32.c

Log Message:
-----------
Fix warning for incompatible function cast

With pedantic option (strict warnings) and MINGW64,
the GetProcAddress() cannot be simply casted, as it leads to
error: cast between incompatible function types from 'FARPROC' ...

Introduce local macro that will wrap all such calls
and silence benign warnings.

Reviewed-by: Eugene Syromiatnikov <es...@openssl.org>
Reviewed-by: Norbert Pocs <norb...@openssl.org>
Reviewed-by: Nikola Pajkovsky <nik...@openssl.org>
Reviewed-by: Neil Horman <nho...@openssl.org>
MergeDate: Thu Sep 10 13:28:33 2026
(Merged from https://github.com/openssl/openssl/pull/32721)

(cherry picked from commit 26b34c3d2521910d61f7067e3936d985adbb0c78)


Compare: https://github.com/openssl/openssl/compare/1b06afb45210...bdc12147744b

To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
Reply all
Reply to author
Forward
0 new messages