Skip to content

Commit

Permalink
i#6570 entry failure: Ignore all privlib failures (#7003)
Browse files Browse the repository at this point in the history
Extends the private loader bcrypt.dll entry failure being ignore to
ignore all private library entry failures. We have had multiple cases of
initializers failing without fatal consequences, and given that we do
not have resources to track down every detail it is best to note the
failure and move on. We have seen Dr. Memory in particular fail on newer
Windows versions and in some cases ignoring that failure lets the tool
continue and succeed, as only a small piece of the private library is
needed (generally pulled in as a chain of dependences from dbghelp.dll
which is used for symbol information). The private loader on Windows is
considered best-effort at this point.

Issue: #6570, #6962
  • Loading branch information
derekbruening authored Sep 23, 2024
1 parent 6cc9748 commit 51b152f
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions core/win32/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,25 +1489,26 @@ privload_call_entry(dcontext_t *dcontext, privmod_t *privmod, uint reason)
res = FALSE;
});

if (!res && get_os_version() >= WINDOWS_VERSION_7 &&
/* i#364: win7 _BaseDllInitialize fails to initialize a new console
* (0xc0000041 (3221225537) - The NtConnectPort request is refused)
* which we ignore for now. DR always had trouble writing to the
* console anyway (xref i#261).
* Update: for i#440, this should now succeed, but we leave this
* in place just in case.
if (!res) {
/* We have had multiple cases of initializers failing without fatal
* consequences, and given that we do not have resources to track
* down every detail it is best to note the failure and move on.
*
* Past examples include:
* + i#364: win7 _BaseDllInitialize fails to initialize a new console
* (0xc0000041 (3221225537) - The NtConnectPort request is refused)
* which we ignore for now. DR always had trouble writing to the
* console anyway (xref i#261).
* Update: for i#440, this should now succeed, but we leave this
* in place just in case.
* + i#2221: combase's entry fails on win10. So far ignoring it
* hasn't cause any problems with simple clients.
* + i#6570: bcrypt's entry suddenly started failing. Ignoring it
* is working so far; if that changes we'll have to dig into it.
*/
(str_case_prefix(privmod->name, "kernel") ||
/* i#2221: combase's entry fails on win10. So far ignoring it
* hasn't cause any problems with simple clients.
*/
str_case_prefix(privmod->name, "combase") ||
/* i#6570: bcrypt's entry suddenly started failing. Ignoring it
* is working so far; if that changes we'll have to dig into it.
*/
str_case_prefix(privmod->name, "bcrypt"))) {
LOG(GLOBAL, LOG_LOADER, 1, "%s: ignoring failure of %s entry\n", __FUNCTION__,
privmod->name);
SYSLOG_INTERNAL_WARNING(
"ignoring failure of private library %s entry (call reason=%d)\n",
privmod->name, reason);
res = TRUE;
}
return_val = CAST_TO_bool(res);
Expand Down

0 comments on commit 51b152f

Please sign in to comment.