Open debach opened 4 years ago
Note that dynamorio.dll will not show up in lm
after DR initializes because DR removes itself from the PEB module lists (unless you pass -no_hide
). Furthermore, certain types of injections don't use the system loader at all, and thus dynamorio.dll is never in any PEB module list, although those types are off by default (too difficult to support clients using system libraries there). That said, the default late injection used by drrun today does have dynamorio.dll loaded in a normal manner and visible initially until toward the end of DR initialization.
What happens if inkscape is launched by an app already under DR control? E.g., using the create_process app:
bin64/drrun.exe -- bin64/create_process.exe c:/inkscape/msys2-debug-build/inkscape.exe
That will use a different, earlier injection.
There is also an earlier-still injection though I'm not 100% sure how robust it is anymore (not enough devs maintaining it):
bin64/drrun.exe -early_inject_map -early_inject_location 5 -- bin64/create_process.exe c:/inkscape/msys2-debug-build/inkscape.exe
Describe the bug When running
bin64/drrun.exe -debug -- c:/inkscape/msys2-debug-build/inkscape.exe
in WinDbg64 on a 64-bit Windows 10 1903 (Build 18362), the moduledynamorio.dll
is not loaded successfully. The client application Inkscape runs without issues, butdynamo_auto_start
is never reached anddynamorio.dll
never appears in the list of loaded modules.To Reproduce
Edit: It seems you don’t need to compile Inkscape on your own, you can also just download and install the precompiled binaries from https://inkscape.org/release/0.92.4/windows/64-bit/. A DynamoRIO release build will also fail to inject into that binary, see below under Additional context.
Steps to reproduce the behavior:
cmake -G Ninja -DCMAKE_BUILD_TYPE=DEBUG ..
instead ofcmake -G Ninja ..
.Run
drrun.exe -debug -- inkscape.exe
with WinDbg64. Set a breakpoint:.childdbg 1 g
Expected behavior The breakpoint
dynamo_auto_start
should be hit.Screenshots or Pasted Text For my debugging attempts, see below.
Versions
I’m using a debug build of 228933df.
Not tested: I’m using the version that is one commit ahead of the latest cronbuild release.
Windows 10 Version 1903 (Build 18362.752)
64-bit
Additional context
In a release build of Inkscape – built without the additional-DCMAKE_BUILD_TYPE=DEBUG
switch above – the breakpointdynamo_auto_start
is hit. The moduledynamorio.dll
is loaded successfully and shows in the output oflm
for the processinkscape.exe
, but not for the processgdbus.exe
. Even runningdrrun.exe -t drcov -- inkscape/msys2-release-build/inkscape.exe
works fine and outputs a coverage file.Edit: I’ve found that only DynamoRIO debug builds succeed to inject, but only into Inkscape non-debug builds, including the precompiled binaries from the official homepage; even drcov works in these cases. On the other hand, DynamoRIO release builds fail to inject into any Inkscape build, and also not with the precompiled binaries.
Debugging attempts
This is what I’ve done in WinDbg:
The above sets a breakpoint for when a dynamorio module is loaded, which will actually be hit twice.
When I continue, the same ModLoad at the same address is hit again:
Note that the following call stack has a different frame 6, because there is now a
LdrpDrainWorkQueue
betweenLdrpLoadDllInternal
andLdrpProcessWork
. There is nodynamorio.dll
in the output oflm
at any point:Now a new process starts:
At this point, Inkscape is running without any apparent issues. I hit
ctrl+break
in WinDbg to manually break into the process: