DynamoRIO / drmemory

Memory Debugger for Windows, Linux, Mac, and Android
Other
2.42k stars 261 forks source link

wrap_wincrt test fails in all Windows builds #1741

Open byron-hawkins opened 9 years ago

byron-hawkins commented 9 years ago

The first intended error does not occur in wincrt.cpp for any of the Windows builds. The erroneous statement over-reads the 8-byte allocation foo by 40 bytes. The log shows that a second allocation occupies the region accessed by the (undetected) over-read:

MALLOC 0x004e2228-0x004e22ec
MALLOC 0x004e2208-0x004e2210

The app's allocation at 0x004e2208 has the normal type MALLOC_ALLOCATOR_NEW for an app allocation. The allocation at 0x004e2228 has type MALLOC_ALLOCATOR_UNKNOWN occurs via malloc_interface_t.malloc_add on this call stack:

drmemorylib!heap_iter_chunk+0x20
drmemorylib!walk_individual_heap+0x13d5
drmemorylib!heap_iterator+0x9c2
drmemorylib!heap_walk+0x1f
drmemorylib!set_initial_layout+0x2c
drmemorylib!instru_event_bb_app2app+0x62
drmemorylib!drmgr_bb_event+0x164
dynamorio!instrument_basic_block+0x2ad
dynamorio!client_process_bb+0xf5
dynamorio!build_bb_ilist+0x4a9a
dynamorio!build_basic_block_fragment+0x34f
dynamorio!dispatch+0x8a2
dynamorio!call_switch_stack+0x23

The first error (which is missing) should be:

Error #1: UNADDRESSABLE ACCESS beyond heap bounds: reading 0x004e2238-0x004e2239 1 byte(s)

Logs and test results can be found on my website: http://www.hawkinssoftware.net/drmemory/i1741/

derekbruening commented 9 years ago

Something about your machine results in a pre-existing (at our late injection point) alloc already there when it's not on other machines. But basically the test is flaky. Originally all of those accesses were trying to test the crtdbg redzones, and I think 48 was the size we had to exceed. Probably such an access outside of the redzone should just be removed from the test.

derekbruening commented 7 years ago

This has started failing on Appveyor every once in a while:

https://ci.appveyor.com/project/DynamoRIO/drmemory/build/1.0.65/job/3033i1n94qyvkn8g

wrap_wincrt =>   stderr failed to match "~~Dr\.M~~ 5 unique, 5 total unaddressable
          access\(es\)", found "~~Dr.M~~ 4 unique, 4 total unaddressable access(es)"
          instead
derekbruening commented 7 years ago

This is now failing very frequently on Appveyor:

https://ci.appveyor.com/project/DynamoRIO/drmemory/build/1.0.164