diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-02-25 13:51:07 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2015-02-25 16:53:17 -0700 |
| commit | 75a68beb7cd59e60935f7030bf55f8a7aab5ceff (patch) | |
| tree | 8714984735d3b85d5a2591d98c708ced7fda538a | |
| parent | 99796388db25dbe159e4306e63ad547aeeed0ee1 (diff) | |
| download | usermoji-75a68beb7cd59e60935f7030bf55f8a7aab5ceff.tar.xz | |
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.
| -rwxr-xr-x | glave-generate.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/glave-generate.py b/glave-generate.py index 9d5b2f64..f2844183 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;') |
