diff options
Diffstat (limited to 'results/scraper/box64/60')
| -rw-r--r-- | results/scraper/box64/60 | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/results/scraper/box64/60 b/results/scraper/box64/60 new file mode 100644 index 000000000..083deb05e --- /dev/null +++ b/results/scraper/box64/60 @@ -0,0 +1,37 @@ +Two potential deadlock errors due to the unreleased lock &mutex_mmap +Dear developers: + Thank you for your checking. Similarly, in the function AllocDynarecMap, the lock &mutex_mmap also may not be released. The fix is to insert pthread_mutex_unlock(&mutex_mmap); before returning. + +https://github.com/ptitSeb/box64/blob/f000951fc970708bfa0dd5d357a334b8cfc41eb0/src/custommem.c#L436 + + + +``` +uintptr_t AllocDynarecMap(dynablock_t* db, size_t size) +{ + if(!size) + return 0; + if(size>MMAPSIZE-2*sizeof(blockmark_t)) { + #ifndef USE_MMAP + pthread_mutex_lock(&mutex_mmap); // here + void *p = NULL; + if(posix_memalign(&p, box64_pagesize, size)) { + dynarec_log(LOG_INFO, "Cannot create dynamic map of %zu bytes\n", size); + return 0; // return without releasing + } + mprotect(p, size, PROT_READ | PROT_WRITE | PROT_EXEC); + #else + void* p = mmap(NULL, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); + if(p==(void*)-1) { + dynarec_log(LOG_INFO, "Cannot create dynamic map of %zu bytes\n", size); + return 0; // return without releasing + } + #endif + ...; + + return ret; +} +``` + + +Best, |