DynamoRIO / DynamoRIO/drmemory

implement heap iteration and walking replacement API

Open
#1,719 0 comments 0 reactions 1 assignee Claimed by @derekbruening View on GitHub
Bug-Assert Bug-FalsePositive Hotlist-Chrome OpSys-Windows
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

Split from #1202. This covers implementing RtlEnumProcessHeaps, RtlGetProcessHeaps, and RtlWalkHeap.

A new chrome unit_tests test hits a problem with us not replacing RtlGetProcessHeaps, raising the priority here:
https://code.google.com/p/chromium/issues/detail?id=481231

The current fallback of wrapping ends up exposing our private heap, which we then complain about as being invalid.

A simple local test:

```
% bin/drmemory.exe -debug -batch -dr d:/derek/dr/git/exports -- tests/app_suite_tests.exe --gtest_filter=MallocTests.WalkHeaps
~~Dr.M~~ Dr. Memory version 1.8.16544
~~Dr.M~~ Running "tests/app_suite_tests.exe --gtest_filter=MallocTests.WalkHeaps"
Running main() from gtest_main.cc
Note: Google Test filter = MallocTests.WalkHeaps
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MallocTests
[ RUN ] MallocTests.WalkHeaps
~~Dr.M~~ ASSERT FAILURE (thread 1312): D:\derek\drmemory\git\src\common\alloc_replace.c:2911: heap != get_private_heap_handle() (app using private heap)~~Dr.M~~ WARNING: application exited with abnormal code 0xffffffff
```

Release matches the Chromium issue:

```
[ RUN ] MallocTests.WalkHeaps
~~Dr.M~~
~~Dr.M~~ Error #1: INVALID HEAP ARGUMENT to Windows API routine: invalid heap HANDLE 0x00ca0000
~~Dr.M~~ # 0 replace_RtlLockHeap [d:\derek\drmemory\git\src\common\alloc_replace.c:3584]
~~Dr.M~~ # 1 KERNELBASE.dll!HeapLock +0xd (0x758e566f )
~~Dr.M~~ # 2 MallocTests_WalkHeaps_Test::TestBody [d:\derek\drmemory\git\src\tests\app_suite\malloc_tests_win.cpp:67]
```

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.