Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flushing [0,-1] results in failing to identify whether code was executed #4097

Closed
derekbruening opened this issue Feb 14, 2020 · 1 comment · Fixed by #4101
Closed

flushing [0,-1] results in failing to identify whether code was executed #4097

derekbruening opened this issue Feb 14, 2020 · 1 comment · Fixed by #4101
Assignees

Comments

@derekbruening
Copy link
Contributor

A vmareas assert hit on Mac (#1979 (comment)) made me think of #4031. I added a check and it did not match Mac but it did fire on the drcachesim.delay-simple test, here:

#0  binary_search (v=0x7fff33c33c58, start=0x0, end=0x0, area=0x7fff33c02638, index=0x0, first=true) at /home/bruening/dr/git/src/core/vmareas.c:1508
#1  0x00007ffff7d1527a in executable_areas_match_flags (addr_start=0x0, 
    addr_end=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, found_area=0x0, first_match_start=0x0, are_all_matching=false, 
    match_vm_flags=2048, match_frag_flags=0) at /home/bruening/dr/git/src/core/vmareas.c:3186
#2  0x00007ffff7d155b3 in executable_vm_area_executed_from (start=0x0, end=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>)
    at /home/bruening/dr/git/src/core/vmareas.c:3303
#3  0x00007ffff7d71658 in dr_unlink_flush_region (start=0x0, size=18446744073709551615) at /home/bruening/dr/git/src/core/lib/instrument.c:7082
#4  0x00007fffb3b911cc in hit_instr_count_threshold () at /home/bruening/dr/git/src/clients/drcachesim/tracer/tracer.cpp:1347

The assert doesn't fire b/c end is NULL. However, this is a bug in executable_areas_match_flags() b/c it doesn't iterate over anything!

@derekbruening
Copy link
Contributor Author

Prior to PR #4098 a binary_search of 0..0 would return the 1st area every time.

derekbruening added a commit that referenced this issue Feb 14, 2020
Fixes a bug where flushing 0..-1 found only the very first code
region, due to passing 0..0 to binary_search.

Adds a unit test and an assert on passing 0..0 in the future.

Fixes #4097
derekbruening added a commit that referenced this issue Feb 14, 2020
Fixes a bug where flushing 0..-1 found only the very first code
region, due to passing 0..0 to binary_search.

Adds a unit test and an assert on passing 0..0 in the future.

Fixes #4097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant