ASSERT OWN_MUTEX on lock marked as app
PR #5370 added extra asserts to DR's lock routines, and at least one is too strict, firing on locks marked as the app. This shows up in Dr. Memory when I updated its DR to include PR #5370:
<Application /home/bruening/drmemory/git/build_x64_dbg/tests/free (53504). Internal Error: DynamoRIO debug check failure: /home/bruening/drmemory/git/src/dynamorio/core/utils.c:991 OWN_MUTEX(&lock->lock)
(Error occurred @1934 frags in tid 53504)
#0 report_dynamorio_problem (dcontext=0x0, dumpcore_flag=8, exception_addr=0x0, report_ebp=0x0, fmt=0x7ffff7ec2ac8 "DynamoRIO debug check failure: %s:%d %s\n(Error occurred @%d frags in tid %d)") at /home/bruening/drmemory/git/src/dynamorio/core/utils.c:2110
#1 0x00007ffff7c4b75f in d_r_internal_error (file=0x7ffff7ec2948 "/home/bruening/drmemory/git/src/dynamorio/core/utils.c", line=991, expr=0x7ffff7ec3983 "OWN_MUTEX(&lock->lock)") at /home/bruening/drmemory/git/src/dynamorio/core/utils.c:179
#2 0x00007ffff7c4e8c3 in own_recursive_lock (lock=0x7ffde3c18248) at /home/bruening/drmemory/git/src/dynamorio/core/utils.c:991
#3 0x00007ffff7c4e9ed in acquire_recursive_app_lock (lock=0x7ffde3c18248, mc=0x0) at /home/bruening/drmemory/git/src/dynamorio/core/utils.c:1010
#4 0x00007ffff7c4ea11 in acquire_recursive_lock (lock=0x7ffde3c18248) at /home/bruening/drmemory/git/src/dynamorio/core/utils.c:1018
#5 0x00007ffff7d61bb8 in dr_recurlock_lock (reclock=0x7ffde3c18248) at /home/bruening/drmemory/git/src/dynamorio/core/lib/instrument.c:3716
#6 0x00007fffe3c151d5 in app_heap_lock (drcontext=0x7ffde3bcf080, recur_lock=0x7ffde3c18248) at /home/bruening/drmemory/git/src/common/alloc_replace.c:543
#7 0x00007fffe3c1523a in arena_lock (drcontext=0x7ffde3bcf080, arena=0x7ffff3b57000, app_synch=1 '\001') at /home/bruening/drmemory/git/src/common/alloc_replace.c:563
#8 0x00007fffe3c2163c in replace_alloc_common (arena=0x7ffff3b57000, request_size=20, alignment=16, flags=25, drcontext=0x7ffde3bcf080, mc=0x7fffffffd250, caller=0x7fffe3c28aed <replace_malloc> "UH\211\345SH\201\354X\t", alloc_type=4)
at /home/bruening/drmemory/git/src/common/alloc_replace.c:1706
#9 0x00007ffff7e20286 in dr_call_on_clean_stack () at /home/bruening/drmemory/git/src/dynamorio/core/arch/x86/x86.asm:404
#10 0x00007fffe3c28aed in arena_for_libc_alloc (drcontext=0x7ffff7e20286 <dr_call_on_clean_stack+130>) at /home/bruening/drmemory/git/src/common/alloc_replace.c:2576