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

rank order violation @ -loglevel 4 in client.alloc test #1649

Closed
derekbruening opened this issue Mar 30, 2015 · 1 comment
Closed

rank order violation @ -loglevel 4 in client.alloc test #1649

derekbruening opened this issue Mar 30, 2015 · 1 comment

Comments

@derekbruening
Copy link
Contributor

-loglevel 4 =>

bin32/drrun -debug -loglevel 4 -c suite/tests/bin/libclient.alloc.dll.so -- suite/tests/bin/client.alloc

thank you for testing the client interface testing global memory alloc...success testing nonheap memory alloc...<(1+x) Handling our fault in a TRY at 0xf72742ca> success testing custom memory alloc.... thread_owned_locks->last_lock->rank < lock->rank IF_CLIENT_INTERFACE(|| first_client || both_client)) && "rank order violation" #7 0xf70f692c in read_lock (rw=0xf73a6b20 ) at /work/dr/git/src/core/utils.c:1195 #8 0xf71bbab6 in os_get_module_info_lock () at /work/dr/git/src/core/module_list.c:69 #9 0xf72b1642 in get_module_base (pc=0x49315000 "\177ELF\001\001\001\003") at /work/dr/git/src/core/unix/module.c:319 #10 0xf7192387 in print_vm_area (v=0x4eed67ec, area=0x4eef3950, outf=4000, prefix=0xf730fcef " ")
at /work/dr/git/src/core/vmareas.c:735

#11 0xf71925fb in print_vm_areas (v=0x4eed67ec, outf=4000) at /work/dr/git/src/core/vmareas.c:781
#12 0xf719306e in add_vm_area (v=0x4eed67ec, start=0xf7775000 "", end=0xf7776000 "\177ELF\001\001\001", vm_flags=3, frag_flags=0,

data=0x0, comment=0xf732300b "fls cb in private lib") at /work/dr/git/src/core/vmareas.c:938

#13 0xf719c51b in add_dynamo_vm_area (start=0xf7775000 "", end=0xf7776000 "\177ELF\001\001\001", prot=3, unmod_image=true,

comment=0xf732300b "fls cb in private lib") at /work/dr/git/src/core/vmareas.c:3586

#14 0xf71e4d44 in raw_mem_alloc (size=4096, prot=3, addr=0xf7775000, flags=(unknown: 0))

at /work/dr/git/src/core/lib/instrument.c:2634

#15 0xf71e51de in custom_memory_shared (alloc=true, drcontext=0x0, flags=(DR_ALLOC_NON_HEAP | DR_ALLOC_FIXED_LOCATION), size=4096,

prot=3, addr=0xf7775000, free_res=0x0) at /work/dr/git/src/core/lib/instrument.c:2748

#16 0xf71e53ee in dr_custom_alloc (drcontext=0x0, flags=(DR_ALLOC_NON_HEAP | DR_ALLOC_FIXED_LOCATION), size=4096, prot=3,

addr=0xf7775000) at /work/dr/git/src/core/lib/instrument.c:2792

#17 0xf77997fe in custom_test () at /work/dr/git/src/suite/tests/client-interface/alloc.dll.c:372
#18 0xf779a30e in dr_init (id=0) at /work/dr/git/src/suite/tests/client-interface/alloc.dll.c:693
#19 0xf71e03ef in instrument_init () at /work/dr/git/src/core/lib/instrument.c:592

@derekbruening
Copy link
Contributor Author

Hit another one with modlist_areas:

<rank order violation module_data_lock(readwrite)@/home/dr/git/src/core/module_list.c:59 acquired after privload_lock(recursive)@/home/dr/git/src/core/loader_shared.c:61 in tid:2a5682>

Breakpoint 1, report_dynamorio_problem (dcontext=0x0, dumpcore_flag=8, exception_addr=0x0, report_ebp=0x0, 
    fmt=0x7ffff7d65be8 "DynamoRIO debug check failure: %s:%d %s\n(Error occurred @%d frags in tid %d)") at /home/dr/git/src/core/utils.c:2114
2114        synchronize_dynamic_options();
(gdb) bt
#0  report_dynamorio_problem (dcontext=0x0, dumpcore_flag=8, exception_addr=0x0, report_ebp=0x0, 
    fmt=0x7ffff7d65be8 "DynamoRIO debug check failure: %s:%d %s\n(Error occurred @%d frags in tid %d)") at /home/dr/git/src/core/utils.c:2114
#1  0x00007ffff7aea5ec in d_r_internal_error (file=0x7ffff7d65a68 "/home/dr/git/src/core/utils.c", line=615, 
    expr=0x7ffff7d66718 "(dcontext->thread_owned_locks->last_lock->rank < lock->rank || first_client || both_client) && \"rank order violation\"")
    at /home/dr/git/src/core/utils.c:179
#2  0x00007ffff7aec90e in deadlock_avoidance_lock (lock=0x7ffff7e5a040 <module_data_lock>, acquired=true, ownable=false)
    at /home/dr/git/src/core/utils.c:615
#3  0x00007ffff7aedbef in d_r_read_lock (rw=0x7ffff7e5a040 <module_data_lock>) at /home/dr/git/src/core/utils.c:1220
#4  0x00007ffff7bce8f6 in os_get_module_info_lock () at /home/dr/git/src/core/module_list.c:67
#5  0x00007ffff7d12169 in get_module_base (pc=0x7fffb3a01000 "\177ELF\002\001\001") at /home/dr/git/src/core/unix/module.c:329
#6  0x00007ffff7ba0225 in print_vm_area (v=0x7ffdb3a67e88, area=0x7ffdb3addea8, outf=130976, prefix=0x7ffff7d7c8b7 "  ")
    at /home/dr/git/src/core/vmareas.c:746
#7  0x00007ffff7ba04e4 in print_vm_areas (v=0x7ffdb3a67e88, outf=130976) at /home/dr/git/src/core/vmareas.c:797
#8  0x00007ffff7ba31f6 in add_vm_area (v=0x7ffdb3a67e88, start=0x7fffb3a01000 "\177ELF\002\001\001", end=0x7fffb3a03000 "H\203\354\bH\213\005\305O", vm_flags=0, 
    frag_flags=0, data=0x7ffdb3a685c8, comment=0x7ffff7d7c791 "") at /home/dr/git/src/core/vmareas.c:1272
#9  0x00007ffff7ba6823 in vmvector_add (v=0x7ffdb3a67e88, start=0x7fffb3a01000 "\177ELF\002\001\001", end=0x7fffb3a03000 "H\203\354\bH\213\005\305O", data=0x7ffdb3a685c8)
    at /home/dr/git/src/core/vmareas.c:1926
#10 0x00007ffff7d14f10 in privload_add_areas (privmod=0x7ffdb3a685c8) at /home/dr/git/src/core/unix/loader.c:372
#11 0x00007ffff7bf0a6d in privload_load_process (privmod=0x7ffdb3a685c8) at /home/dr/git/src/core/loader_shared.c:807
#12 0x00007ffff7beeb45 in privload_process_early_mods () at /home/dr/git/src/core/loader_shared.c:139
#13 0x00007ffff7beed2f in loader_init_epilogue (dcontext=0x7ffdb3a83580) at /home/dr/git/src/core/loader_shared.c:203
#14 0x00007ffff7a5e1bf in dynamorio_app_init_part_two_finalize () at /home/dr/git/src/core/dynamo.c:675
#15 0x00007ffff7d19af2 in privload_early_inject (sp=0x7fffffffd790, old_libdr_base=0x0, old_libdr_size=1)
    at /home/dr/git/src/core/unix/loader.c:2245

derekbruening added a commit that referenced this issue Jan 14, 2023
Adds new labels delimiting clean call sequences.
Converts into a translation record flag when storing translations.

Uses the new labels and flag to precisely identify clean call
mangling, replacing the previous scheme which incorrectly thought
mangled tool pc-relative was a clean call, resulting in incorrect
translations and crashes.

Adds a test case to api.detach_state by adding a client (by converting
it to use static DR) which inserts a pc-relative load.  This
reproduces the crash on detach, and is fixed with this fix.
The added instrumentation caused periodic detach failures which were
solved by setting the translation and adding a restore-state event:
i#4232 covers trying to improve the situation.

Adds a new instr_t.offset field.
Stops using instr_t.note to hold encoding offsets for pc-releative
operands.  Adds a new field instr_t.offset which is used for this
purpose.  This leaves note values in place across encodings, which is
needed for new clean call marking labels and also simplifies rseq
handling code.

This instr_t field is a compatibility break and we bump the version and 
OLDEST_COMPATIBLE_VERSION here to 990.

Updates dr_get_note docs.

Augments logging of xl8 info with new flag info.

Reduces DR_NOTE_FIRST_RESERVED to give DR more reserved labels.
This is another compatibility break, while at it.

Fixes several issues hit in tests that happened to trigger on the
heap bucket size and other changes:
+ Fixes a rank order violation at loglevel 5: xref #1649
+ Writes real xstate_bv into signal frame when setting the xstate context to
   avoid lazy AVX restore problems.
+ Tweaks the thread_churn test to work around non-linearities.

Issue: #5786, #4232
Fixes #5786
dolanzhao pushed a commit that referenced this issue Jan 30, 2023
Adds new labels delimiting clean call sequences.
Converts into a translation record flag when storing translations.

Uses the new labels and flag to precisely identify clean call
mangling, replacing the previous scheme which incorrectly thought
mangled tool pc-relative was a clean call, resulting in incorrect
translations and crashes.

Adds a test case to api.detach_state by adding a client (by converting
it to use static DR) which inserts a pc-relative load.  This
reproduces the crash on detach, and is fixed with this fix.
The added instrumentation caused periodic detach failures which were
solved by setting the translation and adding a restore-state event:
i#4232 covers trying to improve the situation.

Adds a new instr_t.offset field.
Stops using instr_t.note to hold encoding offsets for pc-releative
operands.  Adds a new field instr_t.offset which is used for this
purpose.  This leaves note values in place across encodings, which is
needed for new clean call marking labels and also simplifies rseq
handling code.

This instr_t field is a compatibility break and we bump the version and 
OLDEST_COMPATIBLE_VERSION here to 990.

Updates dr_get_note docs.

Augments logging of xl8 info with new flag info.

Reduces DR_NOTE_FIRST_RESERVED to give DR more reserved labels.
This is another compatibility break, while at it.

Fixes several issues hit in tests that happened to trigger on the
heap bucket size and other changes:
+ Fixes a rank order violation at loglevel 5: xref #1649
+ Writes real xstate_bv into signal frame when setting the xstate context to
   avoid lazy AVX restore problems.
+ Tweaks the thread_churn test to work around non-linearities.

Issue: #5786, #4232
Fixes #5786
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant