Karl Nelson <nelso...@llnl.gov> added the comment:

I will look through the list of samples in Detours to see if there is something 
that can give us better stacktrace information.   If we really need a stack 
trace I can make Detours bust by creating an intentional segfault and see if we 
can attach the debugger after the source of the problem has been triggered.  
Unfortunately as my windows programming knowledge is all from 1994 I may be 
missing something obvious.

In the meantime I am upgrading the sample with some more hooks for any other 
potential LoadLibrary variants and FlsGetValue.  Though given the 
GetProcAddress calls I think that it must be something in the chain leading up 
so the variants are likely not envolved.

The other thing I can do is look at instrumenting SetErrorMode so that I can 
give myself a marker of when we are entering and leaving the dyload code.

```

        /* Don't display a message box when Python can't load a DLL */
        old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);

        /* bpo-36085: We use LoadLibraryEx with restricted search paths
           to avoid DLL preloading attacks and enable use of the
           AddDllDirectory function. We add SEARCH_DLL_LOAD_DIR to
           ensure DLLs adjacent to the PYD are preferred. */
        Py_BEGIN_ALLOW_THREADS
        hDLL = LoadLibraryExW(wpathname, NULL,
                              LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
                              LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
        Py_END_ALLOW_THREADS
#if !USE_UNICODE_WCHAR_CACHE
        PyMem_Free(wpathname);
#endif /* USE_UNICODE_WCHAR_CACHE */

        /* restore old error mode settings */
        SetErrorMode(old_mode);
```

I will post back once I get some results.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42529>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to