DynamoRIO / DynamoRIO/drmemory

Drmemory 2.3.0-1 internal crash with Windows 10 version 1903

Open
#2,292 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

Drmemory, when trying to debug some applications, crashes with **memory internal error**.

An example is **notepad**. (It also crashes the same way for the app I am trying to debug, but I assume the issue will be easier to reproduce with notepad that is available everywhere).

```

~~Dr.M~~ Fetching 2 symbol files...
~~Dr.M~~ [1/2] Fetching symbols for C:\WINDOWS\System32\msvcp_win.dll
~~Dr.M~~ [2/2] Fetching symbols for C:\WINDOWS\System32\msvcrt.dll
~~Dr.M~~ Fetched 2 symbol files successfully
~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff
```

Then I followed the instructions in [Debugging page](https://github.com/DynamoRIO/drmemory/wiki/Debugging):

- This crash occurs every time drmemory is run without the -dr_debug parameter, either with or without -debug parameter

- The output copied above is the result of running with -debug

- Drmemory does **not** crash if run with -dr_debug. I have tested this several times, and in one of them (only in that one) I got a possible hint of what is happening (look for the line containing "CURIOSITY" and "HEAP_UNALLOCATED"):

```
C:\DrMemory-Windows-2.3.0-1\bin64>drmemory.exe -debug -dr_debug -- notepad
~~Dr.M~~ Dr. Memory version 2.3.0
~~Dr.M~~ Running "notepad"
~~Dr.M~~ Using system call file C:\DrMemory-Windows-2.3.0-1\drmemory\logs\symcache\syscalls_x64.txt

~~Dr.M~~ WARNING: application is missing line number information.
~~Dr.M~~
~~Dr.M~~ Error #1: UNINITIALIZED READ: reading 0x0000009c8347e354-0x0000009c8347e358 4 byte(s) within 0x0000009c8347e350-0x0000009c8347e358
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a540680 )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:09.368 in thread 12520
~~Dr.M~~
~~Dr.M~~ Error #2: UNINITIALIZED READ: reading 0x0000009c8347e354-0x0000009c8347e358 4 byte(s) within 0x0000009c8347e350-0x0000009c8347e358
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a54082f )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:25.253 in thread 12520
** = 2 * sizeof(uint) && *(((uint *)p) + 1) != 0xcdcdcdcd)) && *(uint *)(p + size - sizeof(int)) != 0xcdcdcdcd && "attempting to free memory containing HEAP_UNALLOCATED pattern, " "possible double free!" in file D:\drmemory_package\dynamorio\core\heap.c line 4485 **
2.3.0-1-(Feb 6 2020 06:08:06) WinVer=105;Rel=1903;Build=18362;Edition=Professional
-no_dynamic_options -logdir 'C:\DrMemory-Windows-2.3.0-1\drmemory\logs\dynamorio' -client_lib 'C:\DrMemory-Windows-2.3.0-1\bin64\debug\drmemorylib.dll;0;-logdir `C:\DrMemory-Windows-2.3.0-1\drmemory\logs` -symcache_dir `C:\DrMemory-Windows-2.3.0-1\drmemory\logs\symcache` -lib_blacklist `C:\WINDOWS*.d??,C:\Program Files\C
0x0000009c8347fbc9 0x96000000904aaefa
C:\DrMemory-Windows-2.3.0-1\bin64\debug\drmemorylib.dll=0x00007ff6aa580000
C:\DrMemory-Windows-2.3.0-1\bin64\debug/dbghelp.dll=0x00007ff6aadd0000
C:\WINDOWS/system32/ADVAPI32.dll=0x00000262e8280000
C:\WINDOWS/system32/sechost.dll=0x00000262e8610000
C:\WINDOWS/system32/RPCRT4.dll=0x00000262e86b0000
C:\WINDOWS/system32/msvcrt.dll=0x0000026268090000
C:\WINDOWS/system32/kernel32.dll=0x00000262e81c0000
C:\WINDOWS/system32/KERNELBASE.dll=0x00000262e83>

~~Dr.M~~
~~Dr.M~~ ERRORS FOUND:
~~Dr.M~~ 0 unique, 0 total unaddressable access(es)
~~Dr.M~~ 2 unique, 2 total uninitialized access(es)
~~Dr.M~~ 0 unique, 0 total invalid heap argument(s)
~~Dr.M~~ 0 unique, 0 total GDI usage error(s)
~~Dr.M~~ 0 unique, 0 total handle leak(s)
~~Dr.M~~ 0 unique, 0 total warning(s)
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of leak(s)
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of possible leak(s)
~~Dr.M~~ ERRORS IGNORED:
~~Dr.M~~ 175 potential error(s) (suspected false positives)
~~Dr.M~~ (details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.23872.000\potential_errors.txt)
~~Dr.M~~ 34 potential leak(s) (suspected false positives)
~~Dr.M~~ (details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.23872.000\potential_errors.txt)
~~Dr.M~~ 646 unique, 989 total, 218681 byte(s) of still-reachable allocation(s)
~~Dr.M~~ (re-run with "-show_reachable" for details)
~~Dr.M~~ Details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.23872.000\results.txt
```

- However, the "CURIOSITY ... HEAP_UNALLOCATED" line did *not* appear in most of the other trials I made. For example:

_(Remark: "stopping application" appeared when I closed the window)_

```
C:\DrMemory-Windows-2.3.0-1\bin64>drmemory.exe -debug -dr_debug -- notepad
~~Dr.M~~ Dr. Memory version 2.3.0
~~Dr.M~~ Running "notepad"
~~Dr.M~~ Using system call file C:\DrMemory-Windows-2.3.0-1\drmemory\logs\symcache\syscalls_x64.txt

~~Dr.M~~ WARNING: application is missing line number information.
~~Dr.M~~
~~Dr.M~~ Error #1: UNINITIALIZED READ: reading 0x000000c3856ce234-0x000000c3856ce238 4 byte(s) within 0x000000c3856ce230-0x000000c3856ce238
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a540680 )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:08.277 in thread 26336
~~Dr.M~~
~~Dr.M~~ Error #2: UNINITIALIZED READ: reading 0x000000c3856ce234-0x000000c3856ce238 4 byte(s) within 0x000000c3856ce230-0x000000c3856ce238
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a54082f )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:24.098 in thread 26336

~~Dr.M~~
~~Dr.M~~ ERRORS FOUND:
~~Dr.M~~ 0 unique, 0 total unaddressable access(es)
~~Dr.M~~ 2 unique, 2 total uninitialized access(es)
~~Dr.M~~ 0 unique, 0 total invalid heap argument(s)
~~Dr.M~~ 0 unique, 0 total GDI usage error(s)
~~Dr.M~~ 0 unique, 0 total handle leak(s)
~~Dr.M~~ 0 unique, 0 total warning(s)
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of leak(s)
~~Dr.M~~ 0 unique, 0 total, 0 byte(s) of possible leak(s)
~~Dr.M~~ ERRORS IGNORED:
~~Dr.M~~ 169 potential error(s) (suspected false positives)
~~Dr.M~~ (details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.34752.000\potential_errors.txt)
~~Dr.M~~ 34 potential leak(s) (suspected false positives)
~~Dr.M~~ (details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.34752.000\potential_errors.txt)
~~Dr.M~~ 656 unique, 994 total, 219761 byte(s) of still-reachable allocation(s)
~~Dr.M~~ (re-run with "-show_reachable" for details)
~~Dr.M~~ Details: C:\DrMemory-Windows-2.3.0-1\drmemory\logs\DrMemory-notepad.exe.34752.000\results.txt
```

- In one of the tests I made with -dr_debug I kept notepad window open for a while and at a given time notepad crashed with a different error (ASSERT FAILURE):

```
C:\DrMemory-Windows-2.3.0-1\bin64>drmemory.exe -debug -dr_debug -- notepad
~~Dr.M~~ Dr. Memory version 2.3.0
~~Dr.M~~ Running "notepad"
~~Dr.M~~ Using system call file C:\DrMemory-Windows-2.3.0-1\drmemory\logs\symcache\syscalls_x64.txt

~~Dr.M~~ WARNING: application is missing line number information.
~~Dr.M~~
~~Dr.M~~ Error #1: UNINITIALIZED READ: reading 0x0000007a3077e274-0x0000007a3077e278 4 byte(s) within 0x0000007a3077e270-0x0000007a3077e278
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a540680 )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:08.156 in thread 34316
~~Dr.M~~
~~Dr.M~~ Error #2: UNINITIALIZED READ: reading 0x0000007a3077e274-0x0000007a3077e278 4 byte(s) within 0x0000007a3077e270-0x0000007a3077e278
~~Dr.M~~ # 0 system call NtUserCreateWindowEx parameter value #14
~~Dr.M~~ # 1 USER32.dll!VerNtUserCreateWindowEx
~~Dr.M~~ # 2 USER32.dll!CreateWindowInternal
~~Dr.M~~ # 3 USER32.dll!CreateWindowExW
~~Dr.M~~ # 4 notepad.exe!? +0x0 (0x00007ff71a54082f )
~~Dr.M~~ # 5 notepad.exe!? +0x0 (0x00007ff71a53a2f6 )
~~Dr.M~~ # 6 notepad.exe!? +0x0 (0x00007ff71a5502b7 )
~~Dr.M~~ # 7 KERNEL32.dll!BaseThreadInitThunk
~~Dr.M~~ Note: @0:00:24.015 in thread 34316
~~27064~~ ASSERT FAILURE (thread 27064): D:\drmemory_package\drmemory\fastpath_x86.c:1004: mi->memsz <= 4 (load2x of 8-byte memop not supported)
~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff
```
- I made also tests with **--no_count_leaks**, **-light**, **-leaks_only**, **-leaks_only** **-no_count_leaks**, and **-leaks_only -no_count_leaks -no_track_allocs** (always without -dr_debug) and drmemory *crashed* in all cases.

- dynamorio/bin64/drrun did *not* crash

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.