From: Jon Ashburn Date: Wed, 25 Feb 2015 20:51:07 +0000 (-0700) Subject: glave: Fix locking of mem_info entries in UnmapMemory X-Git-Tag: upstream/1.1.92~6007 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75a68beb7cd59e60935f7030bf55f8a7aab5ceff;p=platform%2Fupstream%2FVulkan-Tools.git glave: Fix locking of mem_info entries in UnmapMemory The retruned entry pointer could change after lock released in the case the mem info list was realloc. --- diff --git a/glave-generate.py b/glave-generate.py index 9d5b2f6..f284418 100755 --- a/glave-generate.py +++ b/glave-generate.py @@ -321,7 +321,8 @@ class Subcommand(object): um_body.append(' SEND_ENTRYPOINT_PARAMS("xglUnmapMemory(mem %p)\\n", mem);') um_body.append(' // insert into packet the data that was written by CPU between the xglMapMemory call and here') um_body.append(' // Note must do this prior to the real xglUnMap() or else may get a FAULT') - um_body.append(' entry = find_mem_info_entry_lock(mem);') + um_body.append(' glv_enter_critical_section(&g_memInfoLock);') + um_body.append(' entry = find_mem_info_entry(mem);') um_body.append(' CREATE_TRACE_PACKET(xglUnmapMemory, (entry) ? entry->size : 0);') um_body.append(' pPacket = interpret_body_as_xglUnmapMemory(pHeader);') um_body.append(' if (entry)') @@ -334,6 +335,7 @@ class Subcommand(object): um_body.append(' {') um_body.append(' glv_LogError("Failed to copy app memory into trace packet (idx = %u) on xglUnmapMemory\\n", pHeader->global_packet_index);') um_body.append(' }') + um_body.append(' glv_leave_critical_section(&g_memInfoLock);') um_body.append(' result = real_xglUnmapMemory(mem);') um_body.append(' pPacket->mem = mem;') um_body.append(' pPacket->result = result;')